This API is available on Firefox OS for internal applications 仅。
BluetoothManager
接口在
Web Bluetooth API
allows to access all Bluetooth adapters available on the device. Adapters are the connection interface to connect a Bluetooth device to that device.
[CheckPermissions="bluetooth"]
interface BluetoothManager: EventTarget
{
readonly attribute BluetoothAdapter? defaultAdapter;
attribute EventHandler onattributechanged;
attribute EventHandler onadapteradded;
attribute EventHandler onadapterremoved;
sequence<BluetoothAdapter> getAdapters();
};
BluetoothManager.enabled
只读
true
) or off (
false
).
BluetoothManager.onadapteradded
adapteradded
event; it is triggered when a Bluetooth adapter is enabled on the device.
BluetoothManager.onadapterremoved
adapterremoved
event; it is triggered when a Bluetooth adapter is disabled on the device, or removed.
BluetoothManager.onattributechanged
attributechanged
event; it is triggered when the
BluetoothManager.defaultAdapter
特性改变。
注意:
由于
BluetoothManager
interface inherits from the
EventTarget
interface, all these events can be listened by using the
addEventListener
方法。
BluetoothManager.onenabled
被启用
event; it is triggered when the Bluetooth is turned on.
BluetoothManager.ondisabled
被禁用
event; it is triggered when the Bluetooth is turned off.
BluetoothManager.getAdapters()
BluetoothAdapter
s in use on the device.
BluetoothManager.getDefaultAdapter()
DOMRequest
to handle the success or error of the operation. In case of success, the request's
result
是
BluetoothAdapter
object. Superceded by the
BluetoothManager.getAdapters()
方法。
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web Bluetooth
The definition of 'BluetoothManager' in that specification. |
草案 | Rough draft; not part of any official specification yet. It should be discussed as part of the W3C's System Applications Working Group . |
getAdapters()
,
onattributechange
,
onadapterremoved
.
getDefaultAdapter(), onenabled
,
ondisabled
,
onadapteradded
.
Archive
BluetoothAdapter
BluetoothAdapterEvent
BluetoothAttributeEvent
BluetoothClassOfDevice
BluetoothDevice
BluetoothDeviceEvent
BluetoothDiscoveryHandle
BluetoothGatt
BluetoothGattCharacteristic
BluetoothGattCharacteristicEvent
BluetoothGattDescriptor
BluetoothGattServer
BluetoothGattService
BluetoothLeDeviceEvent
BluetoothManager
BluetoothPairingEvent
BluetoothPairingHandle
BluetoothPairingListener