B2G/BluetoothManager

From MozillaWiki
Jump to navigation Jump to search

Overview

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

interface BluetoothManager: EventTarget
{
  attribute EventHandler onadapteradded;
  attribute EventHandler onadapterremoved;

  BluetoothAdapter[] getAdapters();
  BluetoothAdapter getDefaultAdapter();
};

Event Handlers

  • BluetoothManager.onadapteradded
  • BluetoothManager.onadapterremoved

onadapteradded

Summary

A handler for the adapteradded event; it is triggered when a Bluetooth adapter is enabled on the device.

Sample Code

navigator.mozBluetooth.onadapteradded = funcRef

Where funcRef is a function to be called when the adapteradded event occurs.

onadapterremoved

Summary

A handler for the adapterremoved event; it is triggered when a Bluetooth adapter is disabled on the device.

Sample Code

navigator.mozBluetooth.onadapterremoved = funcRef

Where funcRef is a function to be called when the adapterremoved event occurs.

Methods

  • BluetoothManager.getAdapters()
  • BluetoothManager.getDefaultAdapter()

See also