WebAPI/WebBluetooth: Difference between revisions

Jump to navigation Jump to search
Line 29: Line 29:
===== Adapter =====
===== Adapter =====


interface nsIDOMBluetoothAdapter : nsIDOMEventTarget
  interface nsIDOMBluetoothAdapter : nsIDOMEventTarget
{
  {
  bool startDiscovery();    // ret: false if bluetooth is not enabled
    bool startDiscovery();    // ret: false if bluetooth is not enabled
  void stopDiscovery();     
    void stopDiscovery();     
  nsIDOMBluetoothDevice getDevice(DOMString address);  // Like a device creator
    nsIDOMBluetoothDevice getDevice(DOMString address);  // Like a device creator
  bool connect(in nsIDOMBluetoothDevice device);
    bool connect(in nsIDOMBluetoothDevice device);
  void disconnect(in nsIDOMBluetoothDevice device);
    void disconnect(in nsIDOMBluetoothDevice device);
 
  readonly attribute DOMString address;
  readonly attribute unsigned long class;
  readonly attribute bool enabled;
  readonly attribute bool discovering;
  readonly attribute DOMString name;                      // Set custom device name
  readonly attribute bool discoverable;                  // Set to false if this device would not like to be discovered
  readonly attribute unsigned long discoverabletimeout;  // Unit: sec
 
  // Since setting properties can require IPC calls based on the
  // bluetooth implementation, set properties via DOMRequests to
  // handle callbacks.
  nsIDOMDOMRequest setName(DOMString name);
  nsIDOMDOMRequest setDiscoverable(bool discoverable);
  nsIDOMDOMRequest setDiscoverableTimeout(unsigned long timeout);
      
      
   attribute nsIDOMEventListener ondevicefound;        // Fired when discoverying and any device is discovered.
    readonly attribute DOMString address;
  attribute nsIDOMEventListener ondevicedisappeared;  // Fired when any device is out of discoverable range.
    readonly attribute unsigned long class;
  attribute nsIDOMEventListener ondeviceconnected;    // Fired when a remote device is connected
    readonly attribute bool enabled;
  attribute nsIDOMEventListener ondevicedisconnected; // Fired when a remote device is disconnected
    readonly attribute bool discovering;
};
    readonly attribute DOMString name;                      // Set custom device name
    readonly attribute bool discoverable;                  // Set to false if this device would not like to be discovered
    readonly attribute unsigned long discoverabletimeout;   // Unit: sec
   
    // Since setting properties can require IPC calls based on the
    // bluetooth implementation, set properties via DOMRequests to
    // handle callbacks.
    nsIDOMDOMRequest setName(DOMString name);
    nsIDOMDOMRequest setDiscoverable(bool discoverable);
    nsIDOMDOMRequest setDiscoverableTimeout(unsigned long timeout);
   
    attribute nsIDOMEventListener ondevicefound;        // Fired when discoverying and any device is discovered.
    attribute nsIDOMEventListener ondevicedisappeared;  // Fired when any device is out of discoverable range.
    attribute nsIDOMEventListener ondeviceconnected;    // Fired when a remote device is connected
    attribute nsIDOMEventListener ondevicedisconnected; // Fired when a remote device is disconnected
  };


===== Device =====
===== Device =====
44

edits

Navigation menu