Confirmed users
891
edits
| Line 121: | Line 121: | ||
; Description | ; Description | ||
: The method is used to re-connect to the remote LE device after the connection has been dropped. If the device is not in range | : 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 | ; Return | ||
: A Promise to indicate whether the operation is resolved or rejected | : A Promise to indicate whether the operation is resolved or rejected. | ||
; Sample | ; Sample | ||