Public API of Nordic's CoAP Observe implementation. More...
Data Structures |
|
| struct | coap_observer_t |
|
Struct for CoAP Server for holding an instance of a remote observer.
More...
|
|
| struct | coap_observable_t |
|
Struct for CoAP Client for holding an instance of a remote observable resource.
More...
|
|
Macros |
|
| #define | COAP_OPT_OBSERVE 6 |
Functions |
|
| uint32_t | coap_observe_server_register (uint32_t *p_handle, coap_observer_t *p_observer) |
|
Register a new observer.
More...
|
|
| uint32_t | coap_observe_server_unregister (uint32_t handle) |
|
Unregister an observer.
More...
|
|
| uint32_t | coap_observe_server_search (uint32_t *p_handle, coap_remote_t *p_observer_addr, coap_resource_t *p_resource) |
|
Search the observer list for an observer matching remote address and subject given.
More...
|
|
| uint32_t | coap_observe_server_next_get ( coap_observer_t **pp_observer, coap_observer_t *p_observer, coap_resource_t *p_resource) |
|
Iterate through observers subscribing to a specific resource.
More...
|
|
| uint32_t | coap_observe_server_get (uint32_t handle, coap_observer_t **pp_observer) |
|
Retrieve the observer based on handle.
More...
|
|
| uint32_t | coap_observe_client_register (uint32_t *p_handle, coap_observable_t *p_observable) |
|
Register a new observable resource.
More...
|
|
| uint32_t | coap_observe_client_unregister (uint32_t handle) |
|
Unregister an observable resource.
More...
|
|
| uint32_t | coap_observe_client_search (uint32_t *p_handle, uint8_t *p_token, uint16_t token_len) |
|
Search for a observable resource instance by token.
More...
|
|
| uint32_t | coap_observe_client_get (uint32_t handle, coap_observable_t **pp_observable) |
|
Retrieve the observable resource based on handle.
More...
|
|
| uint32_t | coap_observe_client_next_get ( coap_observable_t **pp_observable, uint32_t *p_handle, coap_observable_t *p_observable) |
|
Iterate through observable resources.
More...
|
|
Detailed Description
Public API of Nordic's CoAP Observe implementation.
Macro Definition Documentation
| #define COAP_OPT_OBSERVE 6 |
Observe option number.
Function Documentation
| uint32_t coap_observe_client_get | ( | uint32_t | handle , |
| coap_observable_t ** | pp_observable | ||
| ) |
Retrieve the observable resource based on handle.
- Parameters
-
[in] handle Handle to the coap_observable_t instance. [out] pp_observable Pointer to an observable resource return by reference. Should not be NULL.
- Return values
-
NRF_SUCCESS If observable resource was found in the observable resource list. NRF_ERROR_NULL If pp_observable pointer is NULL. NRF_ERROR_NOT_FOUND If observable resource associated with the handle was not found.
| uint32_t coap_observe_client_next_get | ( | coap_observable_t ** | pp_observable , |
| uint32_t * | p_handle , | ||
| coap_observable_t * | p_observable | ||
| ) |
Iterate through observable resources.
- Parameters
-
[out] pp_observable Pointer to be filled by the search function upon finding the next observable resource starting from from the pointer provided. Should not be NULL. [out] p_handle Handler to the observable resource found returned by reference. Should not be NULL. [in] p_observable Pointer to the observable resource where to start the search.
- Return values
-
NRF_SUCCESS If observer was found. NRF_ERROR_NULL If pp_observer or p_observer pointer is NULL. NRF_ERROR_NOT_FOUND If next observer was not found.
| uint32_t coap_observe_client_register | ( | uint32_t * | p_handle , |
| coap_observable_t * | p_observable | ||
| ) |
Register a new observable resource.
- Parameters
-
[out] p_handle Handle to the observable resource instance registered. Returned by reference. Should not be NULL. [in] p_observable Pointer to a observable resource structure to register. The structure will be copied. Should not be NULL.
- Return values
-
NRF_SUCCESS If the observable resource was registered successfully. NRF_ERROR_NO_MEM If the observable resource could not be added to the list. NRF_ERROR_NULL If one of the parameters is a NULL pointer.
| uint32_t coap_observe_client_search | ( | uint32_t * | p_handle , |
| uint8_t * | p_token , | ||
| uint16_t | token_len | ||
| ) |
Search for a observable resource instance by token.
- Parameters
-
[out] p_handle Handle to the observable resource instance registered. Returned by reference. Should not be NULL. [in] p_token Pointer to the byte array holding the token id. Should not be NULL. [in] token_len Length of the token.
- Return values
-
NRF_SUCCESS If observable resource was found in the observable resource list. NRF_ERROR_NULL If one of the pointers are NULL. NRF_ERROR_NOT_FOUND If observable resource was not found in the observable resource list.
| uint32_t coap_observe_client_unregister | ( | uint32_t | handle | ) |
Unregister an observable resource.
Unregister the observable resource and clear the memory used by this instance.
- Parameters
-
[in] handle Handle to the observable resource instance registered.
- Return values
-
NRF_SUCCESS If the observable resource was successfully unregistered. NRF_ERROR_NOT_FOUND If the given handle was not found in the observable resource list.
| uint32_t coap_observe_server_get | ( | uint32_t | handle , |
| coap_observer_t ** | pp_observer | ||
| ) |
Retrieve the observer based on handle.
- Parameters
-
[in] handle Handle to the coap_observer_t instance. [out] pp_observer Pointer to an observer return by reference. Should not be NULL.
- Return values
-
NRF_SUCCESS If observer was found in the observer list. NRF_ERROR_NULL If pp_observer pointer is NULL. NRF_ERROR_NOT_FOUND If observer associated with the handle was not found.
| uint32_t coap_observe_server_next_get | ( | coap_observer_t ** | pp_observer , |
| coap_observer_t * | p_observer , | ||
| coap_resource_t * | p_resource | ||
| ) |
Iterate through observers subscribing to a specific resource.
- Parameters
-
[out] pp_observer Pointer to be filled by the search function upon finding the next observer starting from from the p_observer pointer provided. Should not be NULL. [in] p_observer Pointer to the observer where to start the search. [in] p_resource Pointer to the resource of interest. Should not be NULL.
- Return values
-
NRF_SUCCESS If observer was found. NRF_ERROR_NULL If pp_observer or p_resource pointer is NULL. NRF_ERROR_NOT_FOUND If next observer was not found.
| uint32_t coap_observe_server_register | ( | uint32_t * | p_handle , |
| coap_observer_t * | p_observer | ||
| ) |
Register a new observer.
- Parameters
-
[out] p_handle Handle to the observer instance registered. Returned by reference. Should not be NULL. [in] p_observer Pointer to the observer structure to register. The data will be copied. Should not be NULL.
- Return values
-
NRF_SUCCESS If the observer was registered successfully. NRF_ERROR_NO_MEM If the observer could not be added to the list. NRF_ERROR_NULL If one of the parameters is a NULL pointer.
| uint32_t coap_observe_server_search | ( | uint32_t * | p_handle , |
| coap_remote_t * | p_observer_addr , | ||
| coap_resource_t * | p_resource | ||
| ) |
Search the observer list for an observer matching remote address and subject given.
- Parameters
-
[out] p_handle Handle to the observer instance registered. Returned by reference. Should not be NULL. [in] p_observer_addr Pointer to an address structure giving remote address of the observer and port number. Should not be NULL. [in] p_resource Pointer to the resource the observer is registered to. Should not be NULL.
- Return values
-
NRF_SUCCESS If observer was found in the observer list. NRF_ERROR_NULL If one of the pointers are NULL. NRF_ERROR_NOT_FOUND If observer was not found.
| uint32_t coap_observe_server_unregister | ( | uint32_t | handle | ) |
Unregister an observer.
Unregister the observer and clear the memory used by this instance.
- Parameters
-
[in] handle Handle to the observer instance registered.
- Return values
-
NRF_SUCCESS If the observer was successfully unregistered. NRF_ERROR_NOT_FOUND If the given handle was not found in the observer list.