Loading...
Searching...
No Matches

Detailed Description

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.
 

Macro Definition Documentation

◆ UNICOAP_CLOCK

#define UNICOAP_CLOCK   ZTIMER_MSEC

The ztimer clock used for event scheduling.

Definition at line 95 of file state.h.

Typedef Documentation

◆ unicoap_event_callback_t

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.

Parameters
[in]eventpointer to event

Definition at line 105 of file state.h.

◆ unicoap_memo_t

typedef struct unicoap_memo unicoap_memo_t

Memo typealias.

Definition at line 87 of file state.h.

Function Documentation

◆ unicoap_event_cancel()

void unicoap_event_cancel ( unicoap_scheduled_event_t * event)

Cancels the event.

Internally, the timer is removed from the clock.

Note
If the event has already been posted on the queue, this method will try to remove the cancel the event that has already been posted to the queue.

◆ unicoap_event_reschedule()

static void unicoap_event_reschedule ( unicoap_scheduled_event_t * event,
uint32_t duration )
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.

Parameters
[in]eventScheduled event you want to reschedule
[in]durationNumber of milliseconds the event should be posted on the queue

Definition at line 126 of file state.h.

◆ unicoap_event_schedule()

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.

Parameters
[in,out]eventThe event to schedule. Provide a pointer to a pre-allocated event
[in]callbackFunction pointer to be called on the internal queue after duration ms have elapses
durationNumber of milliseconds to wait