B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Overview ==
== Overview ==
'''BluetoothDeviceEvent''' is carried as the paramter of remote device paired/unpaired event handlers, including [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#ondevicepaired adapter.ondevicepaired] and [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#ondeviceunpaired adapter.ondeviceunpaired]. Applications can get the paired [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice BluetoothDevice] object or the address of unpaired remote device.
'''BluetoothDeviceEvent''' is carried as the parameter of remote device found, paired, and unpaired event handlers, including [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDiscoveryHandle#ondevicefound|discoveryHandle.ondevicefound]], [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#ondevicepaired|adapter.ondevicepaired]], [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#ondeviceunpaired|adapter.ondeviceunpaired]]. Applications can get the found/paired [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#BluetoothDevice|BluetoothDevice]] object or the address of unpaired remote device.


== Interface ==
== Interface ==
[CheckPermissions="bluetooth"]
  interface BluetoothDeviceEvent : Event
  interface BluetoothDeviceEvent : Event
  {
  {
   readonly attribute BluetoothDevice? [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent#device device];
   readonly attribute [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#BluetoothDevice|BluetoothDevice]]? [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent#device|device]];
   readonly attribute DOMString?       [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent#address address];
   readonly attribute DOMString? [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent#address|address]];
  };
  };


== Properties ==
== Properties ==
* [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent#device BluetoothAdapterEvent.device]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent#device|BluetoothDeviceEvent.device]]
* [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent#address BluetoothAdapterEvent.address]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent#address|BluetoothDeviceEvent.address]]


=== device ===
=== device ===
; Description
; Description
: The paired remote device.
: The paired remote device. The property is null for event handler [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#ondeviceunpaired|adapter.ondeviceunpaired]] since the event handler only requires the address of unpaired device.


; Value type
; Value type
: [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice BluetoothDevice]
: [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#BluetoothDevice|BluetoothDevice]]
 
; Default Value
: Null pointer


=== address ===
=== address ===
; Description
; Description
: The address of unpaired remote device.
: The address of unpaired remote device. The property is empty string for event handlers [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDiscoveryHandle#ondevicefound|discoveryHandle.ondevicefound]] and [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#ondevicepaired|adapter.ondevicepaired]] since [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#BluetoothDevice|BluetoothDevice]] already has property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#address|address]].  


; Value type
; Value type
: DOMString
: DOMString
; Default Value
: Empty string ("")

Latest revision as of 01:49, 25 January 2016

Overview

BluetoothDeviceEvent is carried as the parameter of remote device found, paired, and unpaired event handlers, including discoveryHandle.ondevicefound, adapter.ondevicepaired, adapter.ondeviceunpaired. Applications can get the found/paired BluetoothDevice object or the address of unpaired remote device.

Interface

[CheckPermissions="bluetooth"]
interface BluetoothDeviceEvent : Event
{
  readonly attribute BluetoothDevice? device;
  readonly attribute DOMString? address;
};

Properties

device

Description
The paired remote device. The property is null for event handler adapter.ondeviceunpaired since the event handler only requires the address of unpaired device.
Value type
BluetoothDevice

address

Description
The address of unpaired remote device. The property is empty string for event handlers discoveryHandle.ondevicefound and adapter.ondevicepaired since BluetoothDevice already has property address.
Value type
DOMString