#include <server2.h>
Public Member Functions | |
virtual void | OnError (Error error)=0 |
virtual void | CharacteristicConfiguration (PeerId peer_id, Handle handle, bool notify, bool indicate)=0 |
virtual async2::OnceReceiver< pw::expected< multibuf::MultiBuf, Error > > | ReadValue (PeerId peer_id, Handle handle, uint32_t offset)=0 |
virtual async2::OnceReceiver< pw::expected< void, Error > > | WriteValue (PeerId peer_id, Handle handle, uint32_t offset, multibuf::MultiBuf &&value)=0 |
virtual void | MtuUpdate (PeerId peer_id, uint16_t mtu)=0 |
Interface for serving a local GATT service. This is implemented by the API client.
|
pure virtual |
This notifies the current configuration of a particular characteristic/descriptor for a particular peer. It will be called when the peer GATT client changes the configuration.
The Bluetooth stack maintains the state of each peer's configuration across reconnections. As such, this method will be called with both notify
and indicate
set to false for each characteristic when a peer disconnects. Also, when a peer reconnects this method will be called again with the persisted state of the newly-connected peer's configuration. However, clients should not rely on this state being persisted indefinitely by the Bluetooth stack.
peer_id | The PeerId of the GATT client associated with this particular CCC. |
handle | The handle of the characteristic associated with the notify and indicate parameters. |
notify | True if the client has enabled notifications, false otherwise. |
indicate | True if the client has enabled indications, false otherwise. |
|
pure virtual |
Called when the MTU of a peer is updated. Also called for peers that are already connected when the server is published.
Notifications and indications must fit in a single packet including both the 3-byte notification/indication header and the user-provided payload. If these are not used, the MTU can be safely ignored as it is intended for use cases where the throughput needs to be optimized.
|
pure virtual |
Called when there is a fatal error related to this service that forces the service to close. LocalServiceDelegate methods will no longer be called. This invalidates the associated LocalService. It is OK to destroy both LocalServiceDelegate
and the associated LocalService::Ptr
from within this method.
|
pure virtual |
Called when a peer requests to read the value of a characteristic or descriptor. It is guaranteed that the peer satisfies the permissions associated with this attribute.
peer_id | The PeerId of the GATT client making the read request. |
handle | The handle of the requested descriptor/characteristic. |
offset | The offset at which to start reading the requested value. |
|
pure virtual |
Called when a peer issues a request to write the value of a characteristic or descriptor. It is guaranteed that the peer satisfies the permissions associated with this attribute.
peer_id | The PeerId of the GATT client making the write request. |
handle | The handle of the requested descriptor/characteristic. |
offset | The offset at which to start writing the requested value. If the offset is 0, any existing value should be overwritten by the new value. Otherwise, the existing value between offset:(offset + len(value)) should be changed to value . |
value | The new value for the descriptor/characteristic. |