Changes

Jump to: navigation, search

B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter

1,178 bytes removed, 03:01, 22 April 2015
remove openGattServer
[NewObject] Promise<[[B2G/Bluetooth/WebBluetooth-v2/BluetoothDiscoveryHandle|BluetoothDiscoveryHandle]]> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#startLeScan.28sequence.3CDOMString.3E_aServiceUuids.29|startLeScan(sequence<DOMString> aServiceUuids)]];
[NewObject] Promise<void> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#stopLeScan.28BluetoothDiscoveryHandle_aDiscoveryHandle.29|stopLeScan(BluetoothDiscoveryHandle aDiscoveryHandle)]];
[NewObject] Promise<[[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#BluetoothGattServer|BluetoothGattServer]]> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#openGattServer.28.29|openGattServer()]];
};
=== gattServer ===
; Description
: The gattServer property is object to conduct GATT server operations on local bluetooth adapter. Applications have to call openGattServer() to update this This propertywill be a null pointer if the adapter is not enabled.
; Value type
* [[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() ===
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]]
120
edits

Navigation menu