BluetoothGattServer
#
DescriptionThe BluetoothGattServer interface of the Bluetooth API provides Bluetooth GATT server functionality to allow creation of Bluetooth Smart/LE services and characteristics.
#
Interface overview#
PropertiesBluetoothGattServer.services
Returns an array of the services offered by this device.
#
Event handlersBluetoothGattServer.ondeviceconnectionstatechanged
Defines 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.onattributereadreq
Defines 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.onattributewritereq
Defines 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.
#
MethodsBluetoothGattServer.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.