2,011 bytes added,
02:56, 22 August 2014 == Overview ==
'''BluetoothGatt''' provides bluetooth GATT functionality to enable communication with remote bluetooth LE devices. Applications have to call [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#connectGatt.28boolean_aAutoConnect.29|device.connectGatt()]] to create a BluetoothGatt for a remote LE device.
== Interface ==
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#BluetoothGatt|BluetoothGatt]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGatt#BluetoothConnectionState|BluetoothConnectionState]]
=== BluetoothGatt ===
[CheckPermissions="bluetooth"]
interface BluetoothGatt : EventTarget
{
[Cached, Pure]
readonly attribute sequence<BluetoothGattService> services;
readonly attribute BluetoothConnectionState connectionState;
attribute EventHandler onservicechanged;
attribute EventHandler oncharacteristicchanged;
attribute EventHandler onconnectionstatechanged;
Promise<> connect();
Promise<> disconnect();
Promise<short> readRemoteRssi();
BluetoothGattService getService(DOMString serviceUuid);
/**
* Reliable write
*/
Promise<> beginReliableWrite();
Promise<> executeReliableWrite();
Promise<> abortReliableWrite();
};
=== BluetoothConnectionState ===
enum BluetoothConnectionState {
"connected",
"connecting",
"disconnected",
"disconnecting"
};
== Properties ==
* BluetoothGatt.services
* BluetoothGatt.connectionState
=== device ===
; Description
: The found remote LE device.
; Value type
: [[B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice#BluetoothDevice|BluetoothDevice]]
== Event Handlers ==
* BluetoothGatt.onservicechanged
* BluetoothGatt.oncharacteristicchanged
* BluetoothGatt.onconnectionstatechanged
== Methods ==
* BluetoothGatt.connect()
* BluetoothGatt.disconnect()
* BluetoothGatt.readRemoteRssi()
* BluetoothGatt.findService(DOMString serviceUuid)
* BluetoothGatt.beginReliableWrite
* BluetoothGatt.executeReliableWrite
* BluetoothGatt.abortReliableWrite