Files | |
| file | state.h |
| State and Memo API. | |
Typedefs | |
| typedef struct unicoap_memo | unicoap_memo_t |
| Memo typealias. | |
Event Scheduling | |
| typedef void(* | unicoap_event_callback_t) (unicoap_scheduled_event_t *event) |
| Scheduled event callback. | |
| void | unicoap_event_schedule (unicoap_scheduled_event_t *event, unicoap_event_callback_t callback, uint32_t duration) |
| Schedules an event on the internal unicoap queue. | |
| static void | unicoap_event_reschedule (unicoap_scheduled_event_t *event, uint32_t duration) |
Discards the currently set timeout, and reschedules the event to be posted in duration ms. | |
| void | unicoap_event_cancel (unicoap_scheduled_event_t *event) |
| Cancels the event. | |
| #define | UNICOAP_CLOCK ZTIMER_MSEC |
| The ztimer clock used for event scheduling. | |
| #define UNICOAP_CLOCK ZTIMER_MSEC |
| typedef void(* unicoap_event_callback_t) (unicoap_scheduled_event_t *event) |
Scheduled event callback.
Use the event parameter and the container_of macro to get a pointer to the parent structure.
| [in] | event | pointer to event |
| typedef struct unicoap_memo unicoap_memo_t |
| void unicoap_event_cancel | ( | unicoap_scheduled_event_t * | event | ) |
Cancels the event.
Internally, the timer is removed from the clock.
|
inlinestatic |
Discards the currently set timeout, and reschedules the event to be posted in duration ms.
Use this method to rerun the timer with the same callbacks but a new timeout value. E.g., the RFC 7252 driver utilizes this method for setting the next acknowledgement timeout.
| [in] | event | Scheduled event you want to reschedule |
| [in] | duration | Number of milliseconds the event should be posted on the queue |
| void unicoap_event_schedule | ( | unicoap_scheduled_event_t * | event, |
| unicoap_event_callback_t | callback, | ||
| uint32_t | duration ) |
Schedules an event on the internal unicoap queue.
| [in,out] | event | The event to schedule. Provide a pointer to a pre-allocated event |
| [in] | callback | Function pointer to be called on the internal queue after duration ms have elapses |
| duration | Number of milliseconds to wait |