BluetoothDevice (Firefox OS)

This API is available on Firefox OS for internal applications only.

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

Interface overview

JavaScript
[CheckPermissions="bluetooth"]
interface BluetoothDevice: EventTarget
{
  readonly attribute DOMString <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#address" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice">address</a>;
  readonly attribute <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothClassOfDevice" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothClassOfDevice">BluetoothClassOfDevice</a> <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#cod" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice">cod</a>;
  readonly attribute DOMString <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#name" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice">name</a>;
  readonly attribute boolean <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#paired" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice">paired</a>;
  [Cached, Pure] readonly attribute sequence<DOMString> <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#uuids" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice">uuids</a>;
  readonly attribute <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#BluetoothDeviceType" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice">BluetoothDeviceType</a> <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#type" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice">type</a>;
  readonly attribute <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#BluetoothGatt.23BluetoothGatt" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice">BluetoothGatt</a>? <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#gatt" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice">gatt</a>;

           attribute EventHandler <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#onattributechanged" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice">onattributechanged</a>;

  [NewObject] Promise<sequence<DOMString>> <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#fetchUuids.28.29" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice">fetchUuids()</a>;
};

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.services Read only
An Array of strings indicating what kind of Bluetooth services the device is able to provide.
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.)

Obsolete properties

BluetoothDevice.class Read only
A number representing the Bluetooth "Class of Device" number for the device.
BluetoothDevice.connected Read only
A boolean indicating if the device is connected to the adapter (true) or not (false).
BluetoothDevice.icon Read only
A string indicating which kind of icon could be used to represent the device.

Methods

BluetoothDevice.fetchUuids()
Fetches the up-to-date UUID list of services that the device provides. If the operation succeeds, an BluetoothDevice_%28Firefox_OS%29.onattributechanged is triggered right before the Promise is resolved to indicate BluetoothDevice.uuids has changed.

Specifications

Specification Status Comment
Web Bluetooth
The definition of 'BluetoothDevice' in that specification.
Draft Rough draft; not part of any official specification yet. It should be discussed as part of the W3C's System Applications Working Group.

Browser Compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support No support No support No support No support No support
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Bluetooth v2 support: cod, type, gatt, onattributechanged, fetchUuids() No support No support No support 2.1 No support No support No support No support
Initial bluetooth support: address, connected, class, icon, name, paired, uuids No support No support No support 1.0.1 No support No support No support No support

 

See also

Using the Web Bluetooth API

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/bluetoothdevice_(firefox_os)

API BluetoothDevice Certified Firefox OS Interface Non-standard Reference Référence Web Bluetooth