Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
callbacks.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022-2026 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#include "callback_defines.h"
14
15#if defined(CONFIG_MCUMGR_GRP_FS) || defined(__DOXYGEN__)
17#endif
18
19#if defined(CONFIG_MCUMGR_GRP_IMG) || defined(__DOXYGEN__)
21#endif
22
23#if defined(CONFIG_MCUMGR_GRP_OS) || defined(__DOXYGEN__)
25#endif
26
27#if defined(CONFIG_MCUMGR_GRP_SETTINGS) || defined(__DOXYGEN__)
29#endif
30
31#if defined(CONFIG_MCUMGR_GRP_ENUM) || defined(__DOXYGEN__)
33#endif
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
45
75typedef enum mgmt_cb_return (*mgmt_cb)(uint32_t event, enum mgmt_cb_return prev_status,
76 int32_t *rc, uint16_t *group, bool *abort_more, void *data,
77 size_t data_size);
78
84 MGMT_EVT_OP_CMD_RECV = MGMT_DEF_EVT_OP_ID(MGMT_EVT_GRP_SMP, 0),
85
87 MGMT_EVT_OP_CMD_STATUS = MGMT_DEF_EVT_OP_ID(MGMT_EVT_GRP_SMP, 1),
88
90 MGMT_EVT_OP_CMD_DONE = MGMT_DEF_EVT_OP_ID(MGMT_EVT_GRP_SMP, 2),
91
93 MGMT_EVT_OP_CMD_ALL = MGMT_DEF_EVT_OP_ALL(MGMT_EVT_GRP_SMP),
94};
95
117
124
127
128 union {
131
133 int err;
134
137 };
138};
139
148
165enum mgmt_cb_return mgmt_callback_notify(uint32_t event, void *data, size_t data_size,
166 int32_t *err_rc, uint16_t *err_group);
167
174
181
185
186#ifdef __cplusplus
187}
188#endif
189
190#endif /* H_MCUMGR_CALLBACKS_ */
mgmt_cb_return
MGMT event callback return value.
Definition callback_defines.h:41
void mgmt_callback_unregister(struct mgmt_callback *callback)
Unregister event callback function.
smp_group_events
MGMT event opcodes for base SMP command processing.
Definition callbacks.h:82
void mgmt_callback_register(struct mgmt_callback *callback)
Register event callback function.
uint8_t mgmt_evt_get_index(uint32_t event)
Get event ID index from event.
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:75
enum mgmt_cb_return mgmt_callback_notify(uint32_t event, void *data, size_t data_size, int32_t *err_rc, uint16_t *err_group)
This function is called to notify registered callbacks about mcumgr notifications/events.
@ MGMT_EVT_GRP_SMP
Definition callback_defines.h:60
@ MGMT_EVT_OP_CMD_RECV
Callback when a command is received, data is mgmt_evt_op_cmd_arg.
Definition callbacks.h:84
@ MGMT_EVT_OP_CMD_ALL
Used to enable all smp_group events.
Definition callbacks.h:93
@ MGMT_EVT_OP_CMD_DONE
Callback when a command has been processed, data is mgmt_evt_op_cmd_arg.
Definition callbacks.h:90
@ MGMT_EVT_OP_CMD_STATUS
Callback when a status is updated, data is mgmt_evt_op_cmd_arg.
Definition callbacks.h:87
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
__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
Group structure.
Definition grp.h:18
MGMT callback struct.
Definition callbacks.h:99
uint32_t event_id
MGMT_EVT_[...] Event ID for handler to be called on.
Definition callbacks.h:115
sys_snode_t node
Entry list node.
Definition callbacks.h:101
mgmt_cb callback
Callback that will be called.
Definition callbacks.h:104
Arguments for MGMT_EVT_OP_CMD_RECV, MGMT_EVT_OP_CMD_STATUS and MGMT_EVT_OP_CMD_DONE.
Definition callbacks.h:121
uint16_t group
mcumgr_group_t
Definition callbacks.h:123
int status
img_mgmt_id_upload_t, used in MGMT_EVT_OP_CMD_STATUS
Definition callbacks.h:136
int err
mcumgr_err_t, used in MGMT_EVT_OP_CMD_DONE
Definition callbacks.h:133
uint8_t id
Message ID within group.
Definition callbacks.h:126
uint8_t op
mcumgr_op_t used in MGMT_EVT_OP_CMD_RECV
Definition callbacks.h:130