BluetoothClassOfDevice (Firefox OS)

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

The BluetoothClassOfDevice interface of the Web Bluetooth API provides identifying/classification information about a given remote Bluetooth device, available at discovery stage.

Interface overview

JavaScript
[CheckPermissions="bluetooth"]
interface BluetoothClassOfDevice
{
  /**
   * The following constants are defined in Assigned Numbers of bluetooth General Access Profile (GAP) spec.
   * See <a href="https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband" rel="nofollow" class="external free">https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband</a> for more information.
   */

  // Major service class
  const unsigned short LIMITED_DISCOVERABILITY = 0x0001;
  const unsigned short POSITIONING             = 0x0008;
  const unsigned short NETWORKING              = 0x0010;
  const unsigned short RENDERING               = 0x0020;
  const unsigned short CAPTURING               = 0x0040;
  const unsigned short OBJECT_TRANSFER         = 0x0080;
  const unsigned short AUDIO                   = 0x0100;
  const unsigned short TELEPHONY               = 0x0200;
  const unsigned short INFORMATION             = 0x0400;

  // Major device class
  const octet MISC          = 0x00;
  const octet COMPUTER      = 0x01;
  const octet PHONE         = 0x02;
  const octet NETWORK       = 0x03;
  const octet AUDIO_VIDEO   = 0x04;
  const octet PERIPHERAL    = 0x05;
  const octet IMAGING       = 0x06;
  const octet WEARABLE      = 0x07;
  const octet TOY           = 0x08;
  const octet HEALTH        = 0x09;
  const octet UNCATEGORIZED = 0x1F;

  readonly attribute unsigned short <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothClassOfDevice#majorServiceClass" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothClassOfDevice">majorServiceClass</a>;
  readonly attribute octet <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothClassOfDevice#majorDeviceClass" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothClassOfDevice">majorDeviceClass</a>;
  readonly attribute octet <a href="https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothClassOfDevice#minorDeviceClass" class="external" title="B2G/Bluetooth/WebBluetooth-v2/BluetoothClassOfDevice">minorDeviceClass</a>;
};

Properties

BluetoothClassOfDevice.majorDeviceClass Read only
Represents the Major Device Class of the CoD field of a Bluetooth Device; "the highest level of granularity for defining a Bluetooth device". [1]
BluetoothClassOfDevice.minorDeviceClass Read only
Represents the Minor Device Class of the CoD field of a Bluetooth Device; "interpreted only in the context of the Major Device Class (but independently of the Service Class field)". [1]
BluetoothClassOfDevice.majorServiceClass Read only
Represents the Major Service Class of the CoD field of a Bluetooth Device; "the general families of devices with which Bluetooth SIG members want their applications to be associated". [1]

[1] https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband

Specifications

Specification Status Comment
Web Bluetooth
The definition of 'BluetoothClassOfDevice' 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
Basic support No support No support No support 2.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/bluetoothclassofdevice_(firefox_os)

API B2G Bluetooth BluetoothClassOfDevice Certified Firefox OS Interface Non-standard Reference Web Bluetooth