Interface provided by the backend to interact with a published service. LocalService is valid for the lifetime of a published GATT service. It is used to control the service and send notifications/indications.
Sends an indication to peers. Indications should be used instead of notifications when the service does require peer confirmation of the update.
Indications should not be sent to peers which have not enabled indications on a particular characteristic. If they are sent, they will not be propagated and the result_sender
will be set to an error condition. The Bluetooth stack will track this configuration for the lifetime of the service.
If any of the peers in parameters.peer_ids
fails to confirm the indication within the ATT transaction timeout (30 seconds per Bluetooth 6.0 Vol. 3 Part F 3.3.3), the link between the peer and the local adapter will be closed.
The maximum size of the parameters.value
field depends on the MTU negotiated with the peer. A 3-byte header plus the value contents must fit in a packet of MTU bytes.
- Parameters
-
parameters | The parameters associated with the changed characteristic. |
- Returns
- When all the peers listed in
parameters.peer_ids
have confirmed the indication, the result is returned. If the implementation wishes to receive indication confirmations on a per-peer basis, they should send this event with a single PeerId in parameters.peer_ids
. Additional values should not be indicated until this procedure completes.
Sends a notification to peers. Notifications should be used instead of indications when the service does not require peer confirmation of the update.
Notifications should not be sent to peers which have not enabled notifications on a particular characteristic or that have disconnected. If notifications are sent, they will not be propagated and the result_sender
will be set to an error condition. The Bluetooth stack will track this configuration for the lifetime of the service.
The maximum size of the parameters.value
field depends on the Maximum Transmission Unit (MTU) negotiated with the peer. A 3-byte header plus the value contents must fit in a packet of MTU bytes.
- Parameters
-
parameters | The parameters associated with the changed characteristic. |
- Returns
- The result is returned when the notification has been sent to all peers or an error is produced when trying to send the notification to any of the peers. This value is only set only once when all associated work is done, if the implementation wishes to receive a call on a per-peer basis, they should send this event with a single PeerId in
parameters.peer_ids
. Additional values should not be notified until this notification completes.