Zephyr Project API  3.4.0
A Scalable Open Source RTOS
callbacks.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef H_MCUMGR_CALLBACKS_
8#define H_MCUMGR_CALLBACKS_
9
10#include <inttypes.h>
11#include <zephyr/sys/slist.h>
13
14#ifdef CONFIG_MCUMGR_GRP_FS
16#endif
17
18#ifdef CONFIG_MCUMGR_GRP_IMG
20#endif
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
35#define MGMT_EVT_OP_ID_ALL 0xffff
36
38#define MGMT_DEF_EVT_OP_ID(group, event_id) ((group << 16) | BIT(event_id))
39
41#define MGMT_DEF_EVT_OP_ALL(group) ((group << 16) | MGMT_EVT_OP_ID_ALL)
45#define MGMT_EVT_GET_GROUP(event) ((event >> 16) & MGMT_EVT_OP_ID_ALL)
46
48#define MGMT_EVT_GET_ID(event) (event & MGMT_EVT_OP_ID_ALL)
49
56
59
65};
66
96typedef enum mgmt_cb_return (*mgmt_cb)(uint32_t event, enum mgmt_cb_return prev_status,
97 int32_t *rc, uint16_t *group, bool *abort_more, void *data,
98 size_t data_size);
99
109
111};
112
118 MGMT_EVT_OP_ALL = MGMT_DEF_EVT_OP_ALL(MGMT_EVT_GRP_ALL),
119};
120
126 MGMT_EVT_OP_CMD_RECV = MGMT_DEF_EVT_OP_ID(MGMT_EVT_GRP_SMP, 0),
127
129 MGMT_EVT_OP_CMD_STATUS = MGMT_DEF_EVT_OP_ID(MGMT_EVT_GRP_SMP, 1),
130
132 MGMT_EVT_OP_CMD_DONE = MGMT_DEF_EVT_OP_ID(MGMT_EVT_GRP_SMP, 2),
133
135 MGMT_EVT_OP_CMD_ALL = MGMT_DEF_EVT_OP_ALL(MGMT_EVT_GRP_SMP),
136};
137
144
147};
148
155
158
161
164
167
170};
171
178
181
184
187};
188
195
198
209};
210
217
220
221 union {
223 int err;
224
227 };
228};
229
246enum mgmt_cb_return mgmt_callback_notify(uint32_t event, void *data, size_t data_size,
247 int32_t *ret_rc, uint16_t *ret_group);
248
255
262
267#ifdef __cplusplus
268}
269#endif
270
271#endif /* H_MCUMGR_CALLBACKS_ */
mgmt_cb_return
Definition: callbacks.h:53
void mgmt_callback_unregister(struct mgmt_callback *callback)
Unregister event callback function.
os_mgmt_group_events
Definition: callbacks.h:175
fs_mgmt_group_events
Definition: callbacks.h:141
img_mgmt_group_events
Definition: callbacks.h:152
mgmt_cb_groups
Definition: callbacks.h:103
smp_group_events
Definition: callbacks.h:124
smp_all_events
Definition: callbacks.h:116
void mgmt_callback_register(struct mgmt_callback *callback)
Register event callback function.
enum mgmt_cb_return(* mgmt_cb)(uint32_t event, enum mgmt_cb_return prev_status, int32_t *rc, uint16_t *group, bool *abort_more, void *data, size_t data_size)
Function to be called on MGMT notification/event.
Definition: callbacks.h:96
enum mgmt_cb_return mgmt_callback_notify(uint32_t event, void *data, size_t data_size, int32_t *ret_rc, uint16_t *ret_group)
This function is called to notify registered callbacks about mcumgr notifications/events.
@ MGMT_CB_ERROR_RC
Definition: callbacks.h:58
@ MGMT_CB_OK
Definition: callbacks.h:55
@ MGMT_CB_ERROR_RET
Definition: callbacks.h:64
@ MGMT_EVT_OP_OS_MGMT_INFO_CHECK
Definition: callbacks.h:180
@ MGMT_EVT_OP_OS_MGMT_RESET
Definition: callbacks.h:177
@ MGMT_EVT_OP_OS_MGMT_INFO_APPEND
Definition: callbacks.h:183
@ MGMT_EVT_OP_OS_MGMT_ALL
Definition: callbacks.h:186
@ MGMT_EVT_OP_FS_MGMT_FILE_ACCESS
Definition: callbacks.h:143
@ MGMT_EVT_OP_FS_MGMT_ALL
Definition: callbacks.h:146
@ MGMT_EVT_OP_IMG_MGMT_ALL
Definition: callbacks.h:169
@ MGMT_EVT_OP_IMG_MGMT_DFU_CHUNK
Definition: callbacks.h:154
@ MGMT_EVT_OP_IMG_MGMT_DFU_PENDING
Definition: callbacks.h:163
@ MGMT_EVT_OP_IMG_MGMT_DFU_CONFIRMED
Definition: callbacks.h:166
@ MGMT_EVT_OP_IMG_MGMT_DFU_STOPPED
Definition: callbacks.h:157
@ MGMT_EVT_OP_IMG_MGMT_DFU_STARTED
Definition: callbacks.h:160
@ MGMT_EVT_GRP_ALL
Definition: callbacks.h:104
@ MGMT_EVT_GRP_SMP
Definition: callbacks.h:105
@ MGMT_EVT_GRP_OS
Definition: callbacks.h:106
@ MGMT_EVT_GRP_FS
Definition: callbacks.h:108
@ MGMT_EVT_GRP_USER_CUSTOM_START
Definition: callbacks.h:110
@ MGMT_EVT_GRP_IMG
Definition: callbacks.h:107
@ MGMT_EVT_OP_CMD_RECV
Definition: callbacks.h:126
@ MGMT_EVT_OP_CMD_ALL
Definition: callbacks.h:135
@ MGMT_EVT_OP_CMD_DONE
Definition: callbacks.h:132
@ MGMT_EVT_OP_CMD_STATUS
Definition: callbacks.h:129
@ MGMT_EVT_OP_ALL
Definition: callbacks.h:118
@ MGMT_GROUP_ID_PERUSER
Definition: mgmt.h:77
Single-linked list implementation.
struct _snode sys_snode_t
Definition: slist.h:33
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Definition: callbacks.h:192
uint32_t event_id
Definition: callbacks.h:208
sys_snode_t node
Definition: callbacks.h:194
mgmt_cb callback
Definition: callbacks.h:197
Definition: callbacks.h:214
uint16_t group
Definition: callbacks.h:216
int status
Definition: callbacks.h:226
int err
Definition: callbacks.h:223
uint8_t id
Definition: callbacks.h:219
static fdata_t data[2]
Definition: test_fifo_contexts.c:15