BluetoothGatt
#
DescriptionThe BluetoothGatt interface of the Bluetooth API handles initial communications and connections with Gatt services.
#
Interface overview#
PropertiesBluetoothGatt.services
read-only
no-link
Returns the list of GATT services offered by the remote LE device. This property is set to an empty array by default before a connection is established.BluetoothGatt.connectionState
read-only
no-link
The current connection state of GATT client to the remote LE device. This property is set to disconnected by default, before a connection is established.
#
Event handlersBluetoothGatt.oncharacteristicchanged
Defines a handler to trigger as a result of the characteristicchanged event firing; this occurs when a remote characteristic changes.BluetoothGatt.onconnectionstatechanged
Defines a handler to trigger as a result of the connectionstatechanged event firing; this occurs when the connection state of the GATT client to the remote LE device (i.e. the BluetoothGatt.connectionState property) changes.
#
MethodsBluetoothGatt.connect()
Connects to the remote LE device.BluetoothGatt.disconnect()
Disconnects an already-established connection to a remote LE device.BluetoothGatt.discoverServices()
Discovers services, characteristics, and descriptors offered by the remote GATT server.BluetoothGatt.readRemoteRssi()
Reads the RSSI for a connected remote LE device.