Version: Smart Feature Phone 3.0

BluetoothManager

Description#

The BluetoothManager interface of the Bluetooth 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 overview#

[CheckAnyPermissions="bluetooth"]
interface BluetoothManager: EventTarget
{
readonly attribute BluetoothAdapter? defaultAdapter;
attribute EventHandler onattributechanged;
attribute EventHandler onadapteradded;
attribute EventHandler onadapterremoved;
sequence<BluetoothAdapter> getAdapters();
};

Properties#

  • BluetoothManager.defaultAdapter

      A BluetoothAdapter object selected by default. The value would be null if the device doesn't have any Bluetooth chip.

Event Handlers#

  • BluetoothManager.onadapteradded

      A handler for the adapteradded event; it is triggered when a Bluetooth adapter is enabled on the device.

  • BluetoothManager.onadapterremoved

      A handler for the adapterremoved event; it is triggered when a Bluetooth adapter is disabled on the device, or removed.

  • BluetoothManager.onattributechanged

      A handler for the attributechanged event; it is triggered when the BluetoothManager.defaultAdapter property changes.

Note: Because the BluetoothManager interface inherits from the EventTarget interface, all these events can be listened by using the addEventListener method.

Methods#

  • BluetoothManager.getAdapters()

      Returns a list of the current BluetoothAdapters in use on the device.