|
ELEC-C7222
Libraries for ELEC C7222 Course Work
|
Characteristic event handler structure. More...
#include <characteristic.hpp>


Public Member Functions | |
| virtual void | OnUpdatesEnabled (bool is_indication) |
| Called when notifications or indications are enabled by a client. | |
| virtual void | OnUpdatesDisabled () |
| Called when notifications or indications are disabled by a client. | |
| virtual void | OnIndicationComplete (uint8_t status) |
| Called when an indication transaction completes. | |
| virtual void | OnBroadcastEnabled () |
| Called when broadcasts are enabled by a client. | |
| virtual void | OnBroadcastDisabled () |
| Called when broadcasts are disabled by a client. | |
| virtual void | OnRead () |
| Called when a read operation is performed on this characteristic. | |
| virtual void | OnWrite (const std::vector< uint8_t > &data) |
| Called when a write operation is performed on this characteristic. | |
| virtual void | OnConfirmationReceived (bool status) |
| Called when a confirmation for an indication is received. | |
Protected Member Functions | |
| virtual | ~EventHandler ()=default |
| Virtual destructor for the EventHandlers interface. | |
Characteristic event handler structure.
This structure contains callback functions for various characteristic events related to client configuration changes, value access, and confirmations.
These callbacks are fired by:
|
protectedvirtualdefault |
Virtual destructor for the EventHandlers interface.
This ensures proper cleanup of derived classes when deleted through a base class pointer. It provides a default no-op implementation and allows implementing classes to define their own destructor behavior if needed.
|
inlinevirtual |
Called when broadcasts are disabled by a client.
This callback is invoked when a client writes to the SCCD to disable broadcasts for this characteristic (or writes 0x0000). The SCCD value has already been written when this fires.
Reimplemented in CharacteristicEventHandler.
|
inlinevirtual |
Called when broadcasts are enabled by a client.
This callback is invoked when a client writes to the SCCD to enable broadcasts for this characteristic. The SCCD value has already been written when this fires.
Reimplemented in CharacteristicEventHandler.
|
inlinevirtual |
Called when a confirmation for an indication is received.
This callback is invoked when a confirmation is received for an indication previously sent to a client. The status parameter indicates whether the confirmation was successfully received or if there was an error (e.g., timeout, disconnect).
| status | true if confirmation was received successfully, false otherwise |
Reimplemented in CharacteristicEventHandler.
|
inlinevirtual |
Called when an indication transaction completes.
This callback is invoked when the indication process finishes, regardless of outcome. The status parameter indicates whether the confirmation was successfully received, timed out, or the connection was lost. Fired after the HCI ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE is received and parsed in DispatchBleHciPacket().
| status | 0 for success, non-zero for error (timeout, disconnect, etc.) |
Reimplemented in CharacteristicEventHandler.
|
inlinevirtual |
Called when a read operation is performed on this characteristic.
This callback is invoked when a client attempts to read the characteristic value. This is a notification callback from the default read handler. Use this to update the characteristic value (via SetValue()) before it is copied into the read response.
Reimplemented in CharacteristicEventHandler.
|
inlinevirtual |
Called when notifications or indications are disabled by a client.
This callback is invoked when a client writes to the CCCD to disable updates for this characteristic (or writes 0x0000). The CCCD write has been validated, but the stored descriptor value is committed only after the write callback returns.
Reimplemented in CharacteristicEventHandler.
|
inlinevirtual |
Called when notifications or indications are enabled by a client.
This callback is invoked when a client writes to the CCCD to enable updates for this characteristic. The CCCD write has been validated, but the stored descriptor value is committed only after the write callback returns. Use the is_indication argument to understand the requested mode instead of querying the CCCD inside this callback.
| is_indication | true if indications are enabled, false if notifications are enabled |
Reimplemented in CharacteristicEventHandler.
|
inlinevirtual |
Called when a write operation is performed on this characteristic.
This callback is invoked when a client writes data to the characteristic value. This is a notification callback from the default write handler with the written data provided for information. The data has already been stored in the value attribute (dynamic storage).
| data | The data written by the client |
Reimplemented in CharacteristicEventHandler.