Version: Smart Feature Phone 2.5

BluetoothDevice

Description#

The BluetoothDevice interface of the Bluetooth API provides information regarding a given Bluetooth device.

Interface overview#

[CheckAnyPermissions="bluetooth"]
interface BluetoothDevice: EventTarget
{
readonly attribute DOMString address;
readonly attribute BluetoothClassOfDevice cod;
readonly attribute DOMString name;
readonly attribute boolean paired;
readonly attribute BluetoothDeviceType type;
[Cached, Pure] readonly attribute sequence<DOMString> uuids;
readonly attribute BluetoothGatt? gatt;
attribute EventHandler onattributechanged;
[NewObject] Promise<sequence<DOMString>> fetchUuids();
};

Properties#

  • BluetoothDevice.address read-only A string representing the address of the device on the Bluetooth micro-network.
  • BluetoothDevice.cod read-only Returns a BluetoothClassOfDevice object containing information about the device's capabilities.
  • BluetoothDevice.gatt read-only Returns a BluetoothGatt object that allows JavaScript to conduct GATT client operations on a remote LE device. This property will return null for devices of type classic or unknown.
  • BluetoothDevice.name read-only The human readable name of the device.
  • BluetoothDevice.paired read-only A boolean indicating if the device is paired to the adapter (true) or not (false).
  • BluetoothDevice.type read-only Returns the device type of the remote device.
  • BluetoothDevice.uuids read-only An Array of strings indicating the UUIDs of each Bluetooth service the device is able to provide.

Event handlers#

  • BluetoothDevice.onattributechanged Defines a handler for the attributechanged event; triggers when a remote device's properties have changed (has a BluetoothAttributeEvent as a parameter.)

Methods#

BluetoothDevice by Mozilla Contributors is licensed under CC-BY-SA 2.5.