Changes

Jump to: navigation, search

B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter

1,037 bytes added, 03:51, 17 November 2014
Methods
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#startLeScan.28sequence.3CDOMString.3E_aServiceUuids.29|BluetoothAdapter.startLeScan(sequence<DOMString> aServiceUuids)]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#stopLeScan.28BluetoothDiscoveryHandle_aDiscoveryHandle.29|BluetoothAdapter.stopLeScan(BluetoothDiscoveryHandle aDiscoveryHandle)]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#openGattServer.28.29|BluetoothAdapter.openGattServer()]]
=== enable() ===
; Return
: A Promise to indicate whether the operation is resolved or rejected. If the promise is resolved, it returns a BluetoothGattServer objectIf the bluetooth adapter is currently disabled, the Promise would be rejected.
; Sample
console.log("Rejected with this reason: " + aReason);
});
 
=== openGattServer() ===
 
; Description
: The method creates a [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#BluetoothGattServer|BluetoothGattServer]] object and assigns it to property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#gattServer|gattServer]].
 
; Return
: A Promise to indicate whether the operation is resolved or rejected. If the promise is resolved, it returns a [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#BluetoothGattServer|BluetoothGattServer]]. The Promise would be rejected if the bluetooth adapter is currently disabled.
 
; Sample
var adapter = navigator.mozBluetooth.defaultAdapter;
if (adapter) {
adapter.openGattServer().then ( function onResolve(gattServer) {
console.log("Resolved with gatt server");
}, function onReject(aReason) {
console.log("Rejected with this reason: " + aReason);
});
}
== See also ==
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothManager|BluetoothManager]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice|BluetoothDevice]]
Confirm
891
edits

Navigation menu