Changes

Jump to: navigation, search

B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt

116 bytes removed, 03:12, 27 January 2015
remove auto connect
attribute EventHandler [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#onconnectionstatechanged|onconnectionstatechanged]];
[NewObject, Throws] Promise<void> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#connect.28boolean_autoConnect28.29|connect(boolean autoConnect)]];
[NewObject, Throws] Promise<void> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#disconnect.28.29|disconnect()]];
[NewObject, Throws] Promise<short> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#readRemoteRssi.28.29|readRemoteRssi()]];
== Methods ==
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#connect.28boolean_autoConnect28.29|BluetoothGatt.connect(boolean autoConnect)]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#disconnect.28.29|BluetoothGatt.disconnect()]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#readRemoteRssi.28.29|BluetoothGatt.readRemoteRssi()]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#abortReliableWrite.28.29|BluetoothGatt.abortReliableWrite()]]
=== connect(boolean autoConnect) ===
; Description
: The method is used connect to the remote LE device.
: 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>.
 
; Parameter
: ''autoConnect''
:: Whether to directly connect to the remote device (false) or to automatically connect as soon as the remote device becomes available (true).
; Return
});
}
 
; Note
: Auto connection establishment procedure defined in bluetooth specification(3.C.9.3.5) is not support yet.
: Please see [https://bugzilla.mozilla.org/show_bug.cgi?id=1126123 Bug 1126123] for details.
=== disconnect() ===
; Description
: The method disconnects an established connection or cancels an ongoing connection.
: 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>disconnecting</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>disconnected</tt>.
; Return
: A Promise to indicate whether the operation is resolved or rejected. If the property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#connectionState|connectionState]] is not <tt>connected</tt> or <tt>connecting</tt> when the method is called, the Promise would be rejected.
; Sample
120
edits

Navigation menu