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

From MozillaWiki
Jump to navigation Jump to search
(Created page with "== Overview == '''BluetoothDiscoveryHandle''' is used to notify application of discovered remote bluetooth device. Its event handler ondevicefound is fired each time a remote ...")
 
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Overview ==
== Overview ==
'''BluetoothDiscoveryHandle''' is used to notify application of discovered remote bluetooth device. Its event handler ondevicefound is fired each time a remote bluetooth device is discovered.
'''BluetoothDiscoveryHandle''' is used to notify application of discovered remote bluetooth device. Its event handler [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDiscoveryHandle#ondevicefound|ondevicefound]] is fired each time a remote bluetooth device is discovered.


== Interface ==
== Interface ==
  interface BluetoothStartDiscoverRequest: EventTarget {
[CheckPermissions="bluetooth"]
   attribute EventHandler [[B2G/Bluetooth/WebBluetooth-v2/BluetoothStartDiscoveryRequest#ondevicefound|ondevicefound]];
  interface BluetoothDiscoveryHandle: EventTarget {
   attribute EventHandler [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDiscoveryHandle#ondevicefound|ondevicefound]];
  }
  }


== Event Handler ==
== Event Handler ==
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothStartDiscoveryRequest#ondevicefound|BluetoothDiscoveryHandle.ondevicefound]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDiscoveryHandle#ondevicefound|BluetoothDiscoveryHandle.ondevicefound]]


=== ondevicefound ===
=== ondevicefound ===
Line 16: Line 17:
; Parameter
; Parameter
: aDeviceEvent
: aDeviceEvent
:: The event is a [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent|BluetoothDeviceEvent]] with property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent#device|device]] as the discovered remote bluetooth device.
:: The event can be either
:: - a [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent#Interface|BluetoothDeviceEvent]] (for BluetoothDiscoveryHandle returned from [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#startDiscovery.28.29|adapter.startDiscovery()]]) with property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDeviceEvent#device|device]] as the discovered remote bluetooth device, or
:: - a  [[B2G/Bluetooth/WebBluetooth-v2/BluetoothLeDeviceEvent#Interface|BluetoothLeDeviceEvent]] (for BluetoothDiscoveryHandle returned from [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#startLeScan.28sequence.3CDOMString.3E_aUuids.29|adapter.startLeScan()]]) with property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothLeDeviceEvent#device|device]] as the found remote LE device, property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothLeDeviceEvent#rssi|rssi]] as the RSSI value, and property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothLeDeviceEvent#scanRecord|scanRecord]] as the content of advertisement record.

Latest revision as of 10:36, 21 August 2014

Overview

BluetoothDiscoveryHandle is used to notify application of discovered remote bluetooth device. Its event handler ondevicefound is fired each time a remote bluetooth device is discovered.

Interface

[CheckPermissions="bluetooth"]
interface BluetoothDiscoveryHandle: EventTarget {
  attribute EventHandler ondevicefound;
}

Event Handler

ondevicefound

Description
A event handler to trigger each time a remote bluetooth device is discovered.
Parameter
aDeviceEvent
The event can be either
- a BluetoothDeviceEvent (for BluetoothDiscoveryHandle returned from adapter.startDiscovery()) with property device as the discovered remote bluetooth device, or
- a BluetoothLeDeviceEvent (for BluetoothDiscoveryHandle returned from adapter.startLeScan()) with property device as the found remote LE device, property rssi as the RSSI value, and property scanRecord as the content of advertisement record.