B2G/BluetoothManager: Difference between revisions
< B2G
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
== | == Overview == | ||
The BluetoothManager API allows to access all Bluetooth adapters available on the device. Adapters are the connection interface to connect a Bluetooth device to that device. | The BluetoothManager API allows to access all Bluetooth adapters available on the device. Adapters are the connection interface to connect a Bluetooth device to that device. | ||
=== Interface | === Interface === | ||
interface BluetoothManager: EventTarget | interface BluetoothManager: EventTarget | ||
| Line 14: | Line 14: | ||
}; | }; | ||
== | == Event Handlers == | ||
* BluetoothManager.onadapteradded | * BluetoothManager.onadapteradded | ||
* BluetoothManager.onadapterremoved | * BluetoothManager.onadapterremoved | ||
=== Methods | === onadapteradded === | ||
==== Summary ==== | |||
A handler for the adapteradded event; it is triggered when a Bluetooth adapter is enabled on the device. | |||
==== Sample Code ==== | |||
navigator.mozBluetooth.onadapteradded = ''funcRef'' | |||
Where ''funcRef'' is a function to be called when the adapteradded event occurs. | |||
==== onadapterremoved ==== | |||
===== Summary ===== | |||
A handler for the adapterremoved event; it is triggered when a Bluetooth adapter is disabled on the device. | |||
==== Sample Code ==== | |||
navigator.mozBluetooth.onadapterremoved = ''funcRef'' | |||
Where ''funcRef'' is a function to be called when the adapterremoved event occurs. | |||
== Methods == | |||
* BluetoothManager.getAdapters() | * BluetoothManager.getAdapters() | ||
* BluetoothManager.getDefaultAdapter() | * BluetoothManager.getDefaultAdapter() | ||
== See also == | |||
* [[BluetoothAdapter]] | |||
Revision as of 06:44, 25 February 2014
Overview
The BluetoothManager API allows to access all Bluetooth adapters available on the device. Adapters are the connection interface to connect a Bluetooth device to that device.
Interface
interface BluetoothManager: EventTarget
{
attribute EventHandler onadapteradded;
attribute EventHandler onadapterremoved;
BluetoothAdapter[] getAdapters();
BluetoothAdapter getDefaultAdapter();
};
Event Handlers
- BluetoothManager.onadapteradded
- BluetoothManager.onadapterremoved
onadapteradded
Summary
A handler for the adapteradded event; it is triggered when a Bluetooth adapter is enabled on the device.
Sample Code
navigator.mozBluetooth.onadapteradded = funcRef
Where funcRef is a function to be called when the adapteradded event occurs.
onadapterremoved
Summary
A handler for the adapterremoved event; it is triggered when a Bluetooth adapter is disabled on the device.
Sample Code
navigator.mozBluetooth.onadapterremoved = funcRef
Where funcRef is a function to be called when the adapterremoved event occurs.
Methods
- BluetoothManager.getAdapters()
- BluetoothManager.getDefaultAdapter()