Confirmed users
891
edits
| Line 287: | Line 287: | ||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#startLeScan.28sequence.3CDOMString.3E_aServiceUuids.29|BluetoothAdapter.startLeScan(sequence<DOMString> aServiceUuids)]] | * [[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#stopLeScan.28BluetoothDiscoveryHandle_aDiscoveryHandle.29|BluetoothAdapter.stopLeScan(BluetoothDiscoveryHandle aDiscoveryHandle)]] | ||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#openGattServer.28.29|BluetoothAdapter.openGattServer()]] | |||
=== enable() === | === enable() === | ||
| Line 504: | Line 505: | ||
; Return | ; Return | ||
: A Promise to indicate whether the operation is resolved or rejected. If the bluetooth adapter is currently disabled, the Promise would be rejected. | : 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 | ; Sample | ||
| Line 515: | Line 516: | ||
console.log("Rejected with this reason: " + aReason); | 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 == | == See also == | ||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothManager|BluetoothManager]] | * [[B2G/Bluetooth/WebBluetooth-v2/BluetoothManager|BluetoothManager]] | ||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice|BluetoothDevice]] | * [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice|BluetoothDevice]] | ||