-
Notifications
You must be signed in to change notification settings - Fork 0
Bluetooth Connections
GATT SERVICE "<uuid>" ONCONNECT GOSUB <linenr>
GATT CLOSE
The BLE Generic Attribute Protocol allows you to read, write, and access data seamlessly. It’s a protocol for handling generic attributes. It manages Writing and Reading these attributes, as well as notifications when an attribute changes state. It is only available when the two BLE devices are connected to each other. Depending on the service, the client may need to respond, or to wait for further commands. Once the data is exchanged, the connection should be closed.
ONCONNECT modifies the following variables:
- H: connection handle
- S: change type
- V: state flags, S = LINKDB_STATUS_UPDATE_STATEFLAGS
- V: rssi, S = LINKDB_STATUS_UPDATE_RSSI
following change types are defined, other values may exist:
- 0: LINKDB_STATUS_UPDATE_NEW
- 1: LINKDB_STATUS_UPDATE_REMOVED
- 2: LINKDB_STATUS_UPDATE_STATEFLAGS
- 16: LINKDB_STATUS_UPDATE_RSSI
In case any of the below variables H, S, or V is an array (e.g. DIM V(2)
) the GOSUB will be silently ignored!
##Examples
// Advertise the GATT Service 25FB9E91-1616-448D-B5A3-F70A64BDA73A and on connection call the subroutine
40 GATT SERVICE "25FB9E91-1616-448D-B5A3-F70A64BDA73A" ONCONNECT GOSUB 100
50 GATT CLOSE
60 RETURN
100 A = 10
110 RETURN