BluetoothGatt
Description#
The BluetoothGatt interface of the Bluetooth API handles initial communications and connections with Gatt services.
Interface overview#
Properties#
BluetoothGatt.servicesread-onlyno-linkReturns 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.connectionStateread-onlyno-linkThe 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 handlers#
BluetoothGatt.oncharacteristicchangedDefines a handler to trigger as a result of the characteristicchanged event firing; this occurs when a remote characteristic changes.BluetoothGatt.onconnectionstatechangedDefines 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.
Methods#
BluetoothGatt.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.