BluetoothGattServer
Description#
The BluetoothGattServer interface of the Bluetooth API provides Bluetooth GATT server functionality to allow creation of Bluetooth Smart/LE services and characteristics.
Interface overview#
Properties#
BluetoothGattServer.servicesread-onlyno-linkReturns an array of the services offered by this device.
Event handlers#
BluetoothGattServer.ondeviceconnectionstatechangedDefines a handler to trigger as a result of the deviceconnectionstatechanged event firing; this occurs when a remote LE device has been connected or disconnected.BluetoothGattServer.onattributereadreqDefines a handler to trigger as a result of the attributereadreq event firing; this occurs when a remote client has requested to read a server's characteristic or descriptor.BluetoothGattServer.onattributewritereqDefines a handler to trigger as a result of the attributewritereq event firing; this occurs when a remote client has requested to write a server's characteristic or descriptor.
Methods#
BluetoothGattServer.connect()Initiates a connection to a remote LE device.BluetoothGattServer.disconnect()Disconnects an already-established connection to a remote LE device.BluetoothGattServer.addservice()Adds a BluetoothGattService to the server's list of provided services.BluetoothGattServer.removeservice()Removes a BluetoothGattService from the server's list of provided services.BluetoothGattServer.notifyCharacteristicChanged()Sends a notification/indication that a local characteristic has been updated.BluetoothGattServer.sendResponse()Sends a response to a remote LE device's read or write request.