nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
qos.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef QOS_H__
8#define QOS_H__
9
17#include <zephyr/kernel.h>
18#include <stdbool.h>
19#include <stdio.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
26#define QOS_MESSAGE_ID_BASE 15000
27
39#define QOS_FLAG_RELIABILITY_ACK_DISABLED 0x01
40
48#define QOS_FLAG_RELIABILITY_ACK_REQUIRED 0x02
49
77
81 uint8_t *buf;
83 size_t len;
84};
85
87struct qos_data {
91 uint32_t flags;
92
94 uint16_t id;
95
100
106 uint8_t type;
107
110
116};
117
119struct qos_evt {
124};
125
130typedef void (*qos_evt_handler_t)(const struct qos_evt *evt);
131
137
151
160int qos_message_remove(uint32_t id);
161
170bool qos_message_has_flag(const struct qos_data *message, uint32_t flag);
171
177
184
190
197
200
201#ifdef __cplusplus
202}
203#endif
204
209#endif /* QOS_H__ */
qos_evt_type
Events notified by the library's callback handler.
Definition qos.h:53
@ QOS_EVT_MESSAGE_NEW
Definition qos.h:58
@ QOS_EVT_MESSAGE_TIMER_EXPIRED
Definition qos.h:66
@ QOS_EVT_MESSAGE_REMOVED_FROM_LIST
Definition qos.h:75
void qos_message_notify_all(void)
Notify all pending messages. All messages that are currently stored in the internal list will be noti...
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_MA...
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 ...
int qos_init(qos_evt_handler_t evt_handler)
Function that initializes the QoS library.
void qos_message_remove_all(void)
Remove all pending messages. All messages that are currently stored in the internal list will be remo...
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.
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...
void(* qos_evt_handler_t)(const struct qos_evt *evt)
QoS library event handler.
Definition qos.h:130
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 leve...
void qos_timer_reset(void)
Reset and stop an ongoing timer backoff.
uint16_t notified_count
Definition qos.h:99
bool heap_allocated
Definition qos.h:115
uint16_t id
Definition qos.h:94
struct qos_payload data
Definition qos.h:109
uint8_t type
Definition qos.h:106
uint32_t flags
Definition qos.h:91
Structure that contains the message payload and corresponding metadata.
Definition qos.h:87
enum qos_evt_type type
Definition qos.h:121
struct qos_data message
Definition qos.h:123
Library callback event structure.
Definition qos.h:119
size_t len
Definition qos.h:83
uint8_t * buf
Definition qos.h:81
Structure used to keep track of unACKed messages.
Definition qos.h:79