nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
qos.h File Reference
#include <zephyr/kernel.h>
#include <stdbool.h>
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  qos_payload
 Structure used to keep track of unACKed messages. More...
 
struct  qos_data
 Structure that contains the message payload and corresponding metadata. More...
 
struct  qos_evt
 Library callback event structure. More...
 

Macros

#define QOS_MESSAGE_ID_BASE   15000
 ID base used for message IDs retrieved using qos_message_id_get_next() API.
 
#define QOS_FLAG_RELIABILITY_ACK_DISABLED   0x01
 Set this flag to disable acknowledging of a message.
 
#define QOS_FLAG_RELIABILITY_ACK_REQUIRED   0x02
 Set this flag to require acknowledging of a message.
 

Typedefs

typedef void(* qos_evt_handler_t) (const struct qos_evt *evt)
 QoS library event handler.
 

Enumerations

enum  qos_evt_type { QOS_EVT_MESSAGE_NEW , QOS_EVT_MESSAGE_TIMER_EXPIRED , QOS_EVT_MESSAGE_REMOVED_FROM_LIST }
 Events notified by the library's callback handler. More...
 

Functions

int qos_init (qos_evt_handler_t evt_handler)
 Function that initializes the QoS library.
 
int qos_message_add (struct qos_data *message)
 Add a message to the library. If the message fails to be added to the internal list because the list is full, the message will be notified with the QOS_EVT_MESSAGE_REMOVED_FROM_LIST event, so that it can be freed if heap allocated. When this API is called, the event QOS_EVT_MESSAGE_NEW is always notified with the corresponding message.
 
int qos_message_remove (uint32_t id)
 Remove message from internal list. An event QOS_EVT_MESSAGE_REMOVED_FROM_LIST will be notified in the library callback.
 
bool qos_message_has_flag (const struct qos_data *message, uint32_t flag)
 Function that checks if a flag is part of the bitmask associated with a message.
 
void qos_message_print (const struct qos_data *message)
 Function that prints the contents of a qos message structure. This requires that the library log level is set to debug level. CONFIG_QOS_LOG_LEVEL_DBG=y.
 
uint16_t qos_message_id_get_next (void)
 Generate message ID that counts from QOS_MESSAGE_ID_BASE message ID base. Count is reset if UINT16_MAX is reached.
 
void qos_message_notify_all (void)
 Notify all pending messages. All messages that are currently stored in the internal list will be notified via the QOS_EVT_MESSAGE_TIMER_EXPIRED event. This API does not clear the internal pending list.
 
void qos_message_remove_all (void)
 Remove all pending messages. All messages that are currently stored in the internal list will be removed. Each message will be notified in the QOS_EVT_MESSAGE_REMOVED_FROM_LIST callback event. This API clears the internal pending list.
 
void qos_timer_reset (void)
 Reset and stop an ongoing timer backoff.