BluetoothManager

この記事は技術レビューを必要としています。

この記事はまだ日本語に翻訳されていません。MDN の翻訳はボランティアによって行われています。是非 MDN に登録し、私たちの力になって下さい。

« BluetoothManager

Non-standard
This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

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

Summary

The BluetoothManager 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

interface BluetoothManager: EventTarget
{
  readonly attribute boolean enabled;

  attribute EventHandler onenabled;
  attribute EventHandler ondisabled;
  attribute EventHandler onadapteradded;

  boolean isConnected(unsigned short aProfile);
  DOMRequest? getDefaultAdapter();
};

Properties

BluetoothManager.enabled Read only
A boolean indicating whether the Bluetooth is on (true) or off (false).

Event Handlers

BluetoothManager.onenabled
A handler for the enabled event; it is triggered when the Bluetooth is turned on.
BluetoothManager.ondisabled
A handler for the disabled event; it is triggered when the Bluetooth is turned off.
BluetoothManager.onadapteradded
A handler for the adapteradded event; it is triggered when a Bluetooth adapter is enabled on the device.

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

Methods

BluetoothManager.isConnected()
Return a boolean indicating if a device with a given Bluetooth profile is connected (true) or not (false).
BluetoothManager.getDefaultAdapter()
Allows to retrieve the default adapter in use by the device. Returns a DOMRequest to handle the success or error of the operation. In case of success, the request's result is a BluetoothAdapter object.

Specification

Not part of any specification yet. It should be discussed as part of the W3C's System Applications Working Group.

See also

Document Tags and Contributors

Contributors to this page: kscarfone, Jeremie
最終更新者: Jeremie,