Confirmed users
891
edits
No edit summary |
|||
| Line 19: | Line 19: | ||
; Summary | ; Summary | ||
: A handler to trigger when a | : A handler to trigger when a Bluetooth adapter becomes enabled on the device. | ||
; Sample | ; Sample | ||
var manager = navigator.mozBluetooth; | var manager = navigator.mozBluetooth; | ||
manager.onadapteradded = ''funcRef'' | manager.onadapteradded = ''funcRef'' | ||
| Line 29: | Line 29: | ||
; Summary | ; Summary | ||
: A handler to trigger when a | : A handler to trigger when a Bluetooth adapter becomes disabled on the device. The disabled BluetoothAdapter object is already unavailable inside the event handler. | ||
; Sample | ; Sample | ||
var manager = navigator.mozBluetooth | var manager = navigator.mozBluetooth; | ||
manager.onadapterremoved = ''funcRef'' | manager.onadapterremoved = ''funcRef'' | ||
: Where ''funcRef'' is a function to be called when a Bluetooth adapter becomes disabled on the device. | : Where ''funcRef'' is a function to be called when a Bluetooth adapter becomes disabled on the device. | ||
| Line 46: | Line 46: | ||
; Return | ; Return | ||
: | : An array of BluetoothAdapter objects. | ||
; Sample | ; Sample | ||
var | var manager = navigator.mozBluetooth; | ||
var adapter = manager.getAdapters(); | |||
; // TODO | |||
* What would happen if 0 is unplugged and another dongle is plugged? | |||
* Does the array keeps BluetoothAdapter with state 'disabled'? | |||
=== getDefaultAdapter() === | === getDefaultAdapter() === | ||
; Summary | ; Summary | ||
: The <tt>getDefaultAdapter</tt> method is used to retrieve the default adapter | : The <tt>getDefaultAdapter</tt> method is used to retrieve the default adapter used to connect the device to third-party Bluetooth devices. | ||
; Return | ; Return | ||
: The default BluetoothAdapter object. | : The default BluetoothAdapter object. | ||
; Sample | ; Sample | ||
var | var manager = navigator.mozBluetooth; | ||
var adapter = manager.getDefaultAdapter(); | |||
; // TODO | |||
* How do we know defaultAdapter has been changed? | |||
== See also == | == See also == | ||
* BluetoothAdapter | * [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter BluetoothAdapter] | ||