BluetoothManager

  • Revision slug: Web/API/BluetoothManager
  • Revision title: BluetoothManager
  • Revision id: 488027
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment

Revision Content

{{ domref() }}

{{ non-standard_header() }}

{{ B2GOnlyHeader2('certified') }}

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

{{domxref("BluetoothManager.enabled")}} {{readonlyinline}}
A boolean indicating whether the Bluetooth is on (true) or off (false).

Event Handlers

{{domxref("BluetoothManager.onenabled")}}
A handler for the {{event("enabled")}} event; it is triggered when the Bluetooth is turned on.
{{domxref("BluetoothManager.ondisabled")}}
A handler for the {{event("disabled")}} event; it is triggered when the Bluetooth is turned off.
{{domxref("BluetoothManager.onadapteradded")}}
A handler for the {{event("adapteradded")}} event; it is triggered when a new Bluetooth adapter is plugged to the device.

Methods

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

Specification

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

See also

  • {{domxref("window.navigator.mozBluetooth","navigator.mozBluetooth")}}
  • Web Bluetooth

Revision Source

<p>{{ domref() }}</p>
<p>{{ non-standard_header() }}</p>
<p>{{ B2GOnlyHeader2('certified') }}</p>
<h2 id="Summary">Summary</h2>
<p>The <code>BluetoothManager</code> API allows to access all Bluetooth adapters available on the device. Adapters are the connection interface to connect a Bluetooth device to that device.</p>
<h2 id="Interface_overview">Interface overview</h2>
<pre>
interface BluetoothManager: EventTarget
{
  readonly attribute boolean enabled;

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

  boolean isConnected(<span id="the-code">unsigned short aProfile</span>);
  DOMRequest? getDefaultAdapter();
};</pre>
<h2 id="Properties">Properties</h2>
<dl>
 <dt>
  {{domxref("BluetoothManager.enabled")}} {{readonlyinline}}</dt>
 <dd>
  A boolean indicating whether the Bluetooth is on (<code>true</code>) or off (<code>false</code>).</dd>
</dl>
<h3>Event Handlers</h3>
<dl>
 <dt>
  {{domxref("BluetoothManager.onenabled")}}</dt>
 <dd>
  A handler for the {{event("enabled")}} event; it is triggered when the Bluetooth is turned on.</dd>
 <dt>
  {{domxref("BluetoothManager.ondisabled")}}</dt>
 <dd>
  A handler for the {{event("disabled")}} event; it is triggered when the Bluetooth is turned off.</dd>
 <dt>
  {{domxref("BluetoothManager.onadapteradded")}}</dt>
 <dd>
  A handler for the {{event("adapteradded")}} event; it is triggered when a new Bluetooth adapter is plugged to the device.</dd>
</dl>
<h2 id="Methods">Methods</h2>
<dl>
 <dt>
  {{ domxref("BluetoothManager.isConnected()") }}</dt>
 <dd>
  Return a boolean indicating if a divice with a given Bluetooth profile is connected (<code>true</code>) or not (<code>false</code>).</dd>
 <dt>
  {{ domxref("BluetoothManager.getDefaultAdapter()") }}</dt>
 <dd>
  Allows to retrieve the default adapter in use by the device. Returns a {{domxref("DOMRequest")}} to handle the success or error of the operation. In case of success, the request's <code>result</code> is a {{domxref("BluetoothAdapter")}} object.</dd>
</dl>
<h2 id="Specification">Specification</h2>
<p>Not part of any specification yet. It should be discuss as part of the <a href="http://www.w3.org/2012/sysapps/">W3C's System Applications Working Group</a>.</p>
<h2 id="See_also">See also</h2>
<ul>
 <li>{{domxref("window.navigator.mozBluetooth","navigator.mozBluetooth")}}</li>
 <li><a href="/en-US/docs/WebAPI/WebBluetooth">Web Bluetooth</a></li>
</ul>
Revert to this revision