B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt: Difference between revisions

remove auto connect
(remove auto connect)
Line 105: Line 105:


; Return
; 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, 2) autoConnect is false and the remote LE device is not in range, or 3) [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#disconnect.28.29|BluetoothGatt.disconnect()]] is issued and succeeded before the connect process is done.
: 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.


; Sample
; Sample
Line 111: Line 111:
  if (gatt) {
  if (gatt) {
   gatt.connect(false).then ( function onResolve() {
   gatt.connect(false).then ( function onResolve() {
     console.log("Re-connection succeeds. ConnectionState becomes:", gatt.connectionState);
     console.log("Connection established. ConnectionState becomes:", gatt.connectionState);
   }, function onReject(aReason) {
   }, function onReject(aReason) {
     console.log("Rejected with this reason: ", aReason, ". ConnectionState becomes:", gatt.connectionState);
     console.log("Rejected with this reason: ", aReason, ". ConnectionState becomes:", gatt.connectionState);
Line 118: Line 118:


; Note
; Note
: Auto connection establishment procedure defined in bluetooth specification(3.C.9.3.5) is not support yet.
: Auto connection establishment procedure defined in bluetooth specification(3.C.9.3.5) is not supported yet.
: Please see [https://bugzilla.mozilla.org/show_bug.cgi?id=1126123 Bug 1126123] for details.
: Please see [https://bugzilla.mozilla.org/show_bug.cgi?id=1126123 Bug 1126123] for details.


120

edits