Version: Smart Feature Phone 2.5Version: Smart Feature Phone 2.6

BluetoothAdapter

Description#

The BluetoothAdapter interface of the Web Bluetooth API is used to handle all the operations requested by Bluetooth networks. A Bluetooth adapter is the physical interface which is used to interact with local Bluetooth device.

Interface overview#

[Exposed=Window]
interface BluetoothAdapter: EventTarget
{
readonly attribute BluetoothAdapterState state;
readonly attribute DOMString name;
readonly attribute boolean discoverable;
readonly attribute boolean discovering;
readonly attribute BluetoothGattServer? gattServer;
attribute EventHandler onattributechanged;
attribute EventHandler ondevicepaired;
attribute EventHandler ondeviceunpaired;
attribute EventHandler onpairingaborted;
attribute EventHandler ona2dpstatuschanged;
attribute EventHandler onhfpstatuschanged;
attribute EventHandler onscostatuschanged;
attribute EventHandler onrequestmediaplaystatus;
[NewObject] Promise<void> setDiscoverable(boolean aDiscoverable);
[NewObject] Promise<BluetoothDiscoveryHandle> startDiscovery();
[NewObject] Promise<void> stopDiscovery();
[NewObject] Promise<void> pair(DOMString aAddress);
[NewObject] Promise<void> unpair(DOMString aAddress);
sequence<BluetoothDevice> getPairedDevices();
// BLE methods
[NewObject] Promise<BluetoothDiscoveryHandle> startLeScan(sequence<DOMString> aServiceUuids);
[NewObject] Promise<void> stopLeScan(BluetoothDiscoveryHandle aDiscoveryHandle);
};

Properties#

Event Handlers#

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

Methods#