libcoap 4.3.1
|
API for interfacing with the observe handling (RFC7641) More...
Macros | |
#define | COAP_OBSERVE_ESTABLISH 0 |
The value COAP_OBSERVE_ESTABLISH in a GET/FETCH request option COAP_OPTION_OBSERVE indicates a new observe relationship for (sender address, token) is requested. More... | |
#define | COAP_OBSERVE_CANCEL 1 |
The value COAP_OBSERVE_CANCEL in a GET/FETCH request option COAP_OPTION_OBSERVE indicates that the observe relationship for (sender address, token) must be cancelled. More... | |
Functions | |
void | coap_resource_set_get_observable (coap_resource_t *resource, int mode) |
Set whether a resource is observable. More... | |
int | coap_resource_notify_observers (coap_resource_t *resource, const coap_string_t *query) |
Initiate the sending of an Observe packet for all observers of resource , optionally matching query if not NULL. More... | |
API for interfacing with the observe handling (RFC7641)
#define COAP_OBSERVE_CANCEL 1 |
The value COAP_OBSERVE_CANCEL in a GET/FETCH request option COAP_OPTION_OBSERVE indicates that the observe relationship for (sender address, token) must be cancelled.
Definition at line 40 of file coap_subscribe.h.
#define COAP_OBSERVE_ESTABLISH 0 |
The value COAP_OBSERVE_ESTABLISH in a GET/FETCH request option COAP_OPTION_OBSERVE indicates a new observe relationship for (sender address, token) is requested.
Definition at line 33 of file coap_subscribe.h.
int coap_resource_notify_observers | ( | coap_resource_t * | resource, |
const coap_string_t * | query | ||
) |
Initiate the sending of an Observe packet for all observers of resource
, optionally matching query
if not NULL.
resource | The CoAP resource to use. |
query | The Query to match against or NULL |
1
if the Observe has been triggered, 0
otherwise. void coap_resource_set_get_observable | ( | coap_resource_t * | resource, |
int | mode | ||
) |
Set whether a resource
is observable.
If the resource is observable and the client has set the COAP_OPTION_OBSERVE in a request packet, then whenever the state of the resource changes (a call to coap_resource_trigger_observe()), an Observer response will get sent.
resource | The CoAP resource to use. |
mode | 1 if Observable is to be set, 0 otherwise. |