Changes

Jump to: navigation, search

B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt

3 bytes removed, 07:36, 22 August 2014
connect()
: The method is used to re-connect to the remote LE device after the connection has been dropped.
: This is an asynchronous method and its result is returned via a Promise. Once the method is called, property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#connectionState|connectionState]] becomes <tt>connecting</tt> and a corresponding [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#onconnectionstatechanged|onconnectionstatechanged]] would be triggered. If the connect operation succeeds, another [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#onconnectionstatechanged|onconnectionstatechanged]] would be triggered before the Promise is resolved to indicate property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#connectionState|connectionState]] becomes <tt>connected</tt>.
: The Promise would be rejected if 1) property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#connectionState|connectionState]] is not <tt>disconnected</tt> when the method is called, or 2) the remote LE device is not in range. The re-connection will be triggered once the device is back in range and, if re-connection succeeds, an [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#onconnectionstatechanged|onconnectionstatechanged]] would be fired to indicate property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#connectionState|connectionState]] becomes <tt>connected</tt>.
; Return
: A Promise to indicate whether the operation is resolved or rejected. The Promise would be rejected if 1) property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#connectionState|connectionState]] is not <tt>disconnected</tt> when the method is called, or 2) the remote LE device is not in range. The re-connection will be triggered once the device is back in range and, if re-connection succeeds, an [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#onconnectionstatechanged|onconnectionstatechanged]] would be fired to indicate property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#connectionState|connectionState]] becomes <tt>connected</tt>.
; Sample
Confirm
891
edits

Navigation menu