A remote CoAP observer. More...
#include <Observers.h>
Public Member Functions | |
| Observer () | |
| Default constructor that creates an inactive observer. | |
| Observer (IPAddress ip, uint16_t port, const uint8_t *token, uint8_t tokenLength) | |
| Constructor that creates an active observer with the given parameters. | |
| bool | isActive () const |
| Check if the observer is currently active. | |
| bool | isStale () const |
| Check if the observer is stale. | |
| void | activate () |
| Set the observer as active. | |
| void | deactivate () |
| Set the observer as deactivated. | |
| IPAddress | getIp () const |
| Get the IP address of the observer. | |
| uint16_t | getPort () const |
| Get the port of the observer. | |
| const uint8_t * | getToken () const |
| Get the token pointer used by the observer. | |
| uint8_t | getTokenLength () const |
| Get the token length used by the observer. | |
| uint32_t | getNextSequentialNumber () |
| The sequential number for notifications, as per specifications. | |
A remote CoAP observer.
It tracks a remote observer registered to a specific resource for notifications.
|
inline |
Default constructor that creates an inactive observer.
|
inline |
Constructor that creates an active observer with the given parameters.
| ip | The IP address of the observer. |
| port | The port of the observer. |
| token | The token used by the observer. |
| tokenLength | The length of the token in bytes. |
| void Coap::Observer::activate | ( | ) |
Set the observer as active.
Setting an observer as active also updates its internal last seen value. Inactive observers are ignored by the registry and their slot can be reused to store new observers.
| void Coap::Observer::deactivate | ( | ) |
Set the observer as deactivated.
Inactive observers are ignored by the registry and their slot can be reused to store new observers.
|
inline |
Get the IP address of the observer.
| uint32_t Coap::Observer::getNextSequentialNumber | ( | ) |
The sequential number for notifications, as per specifications.
As per https://datatracker.ietf.org/doc/html/rfc7641#section-4.4, the sequence number MAY start at any value and MUST NOT increase so fast that it increases by more than 2^23 within less than 256 seconds.
As per implementation notes, using the local clock (e.g. millis()) is a simple way to meet this requirement.
|
inline |
Get the port of the observer.
|
inline |
Get the token pointer used by the observer.
|
inline |
Get the token length used by the observer.
|
inline |
Check if the observer is currently active.
Inactive observers are ignored by the registry and their slot can be reused to store new observers.
| bool Coap::Observer::isStale | ( | ) | const |
Check if the observer is stale.
An observer is considered stale if it is active AND has not been seen for 24 hours or more.