The GATT Server allows the device to act as a peripheral and hold its own ATT lookup data, server & characteristic definitions. In this mode, the device acts as a slave and a master must initiate a request.
Services are used to categorise data up into specific chunks of data known as characteristics. A service may have multiple characteristics, and each service has a unique numeric ID called a UUID.
The following class allows control over Server services.
Starts the service if not already started.
Stops the service if previously started.
Creates a new characteristic on the service. Returns an object of the class
GATTSCharacteristic. The arguments are:
uuidis the UUID of the service. Can take an integer or a 16 byte long string or bytes object.
permissionsconfigures the permissions of the characteristic. Takes an integer with a combination of the flags. When bluetooth object is initialized with PIN, read and write permissions are set to encrypted. Setting PIN later with set_pin() call does not affect the permissions of the already existing characteristics, thus they will remain not secured.
propertiessets the properties. Takes an integer with an OR-ed combination of the flags.
valuesets the initial value. Can take an integer, a string or a bytes object.