7#ifndef H_MCUMGR_CALLBACKS_
8#define H_MCUMGR_CALLBACKS_
14#ifdef CONFIG_MCUMGR_GRP_FS
18#ifdef CONFIG_MCUMGR_GRP_IMG
22#ifdef CONFIG_MCUMGR_GRP_OS
26#ifdef CONFIG_MCUMGR_GRP_SETTINGS
43#define MGMT_EVT_OP_ID_ALL 0xffff
46#define MGMT_DEF_EVT_OP_ID(group, event_id) ((group << 16) | BIT(event_id))
49#define MGMT_DEF_EVT_OP_ALL(group) ((group << 16) | MGMT_EVT_OP_ID_ALL)
53#define MGMT_EVT_GET_GROUP(event) ((event >> 16) & MGMT_EVT_OP_ID_ALL)
56#define MGMT_EVT_GET_ID(event) (event & MGMT_EVT_OP_ID_ALL)
76#define MGMT_CB_ERROR_RET __DEPRECATED_MACRO MGMT_CB_ERROR_ERR
settings_mgmt_group_events
MGMT event opcodes for settings management group.
Definition: callbacks.h:213
mgmt_cb_return
MGMT event callback return value.
Definition: callbacks.h:61
void mgmt_callback_unregister(struct mgmt_callback *callback)
Unregister event callback function.
os_mgmt_group_events
MGMT event opcodes for operating system management group.
Definition: callbacks.h:190
fs_mgmt_group_events
MGMT event opcodes for filesystem management group.
Definition: callbacks.h:153
img_mgmt_group_events
MGMT event opcodes for image management group.
Definition: callbacks.h:164
mgmt_cb_groups
MGMT event callback group IDs.
Definition: callbacks.h:114
smp_group_events
MGMT event opcodes for base SMP command processing.
Definition: callbacks.h:136
smp_all_events
MGMT event opcodes for all command processing.
Definition: callbacks.h:128
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:107
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_OP_SETTINGS_MGMT_ACCESS
Callback when a setting is read/written/deleted.
Definition: callbacks.h:215
@ MGMT_EVT_OP_SETTINGS_MGMT_ALL
Used to enable all settings_mgmt_group events.
Definition: callbacks.h:218
@ MGMT_CB_ERROR_RC
SMP protocol error and err_rc contains the mcumgr_err_t error code.
Definition: callbacks.h:66
@ MGMT_CB_OK
No error.
Definition: callbacks.h:63
@ MGMT_CB_ERROR_ERR
Group (application-level) error and err_group contains the group ID that caused the error and err_rc ...
Definition: callbacks.h:72
@ MGMT_EVT_OP_OS_MGMT_DATETIME_GET
Callback when a datetime get command has been received.
Definition: callbacks.h:201
@ MGMT_EVT_OP_OS_MGMT_DATETIME_SET
Callback when a datetime set command has been received, data is struct rtc_time().
Definition: callbacks.h:204
@ MGMT_EVT_OP_OS_MGMT_INFO_CHECK
Callback when an info command is processed, data is os_mgmt_info_check.
Definition: callbacks.h:195
@ MGMT_EVT_OP_OS_MGMT_RESET
Callback when a reset command has been received, data is os_mgmt_reset_data.
Definition: callbacks.h:192
@ MGMT_EVT_OP_OS_MGMT_INFO_APPEND
Callback when an info command needs to output data, data is os_mgmt_info_append.
Definition: callbacks.h:198
@ MGMT_EVT_OP_OS_MGMT_ALL
Used to enable all os_mgmt_group events.
Definition: callbacks.h:207
@ MGMT_EVT_OP_FS_MGMT_FILE_ACCESS
Callback when a file has been accessed, data is fs_mgmt_file_access().
Definition: callbacks.h:155
@ MGMT_EVT_OP_FS_MGMT_ALL
Used to enable all fs_mgmt_group events.
Definition: callbacks.h:158
@ MGMT_EVT_OP_IMG_MGMT_ALL
Used to enable all img_mgmt_group events.
Definition: callbacks.h:184
@ MGMT_EVT_OP_IMG_MGMT_DFU_CHUNK
Callback when a client sends a file upload chunk, data is img_mgmt_upload_check().
Definition: callbacks.h:166
@ MGMT_EVT_OP_IMG_MGMT_DFU_PENDING
Callback when a DFU operation has finished being transferred.
Definition: callbacks.h:175
@ MGMT_EVT_OP_IMG_MGMT_DFU_CONFIRMED
Callback when an image has been confirmed.
Definition: callbacks.h:178
@ MGMT_EVT_OP_IMG_MGMT_DFU_CHUNK_WRITE_COMPLETE
Callback when an image write command has finished writing to flash.
Definition: callbacks.h:181
@ MGMT_EVT_OP_IMG_MGMT_DFU_STOPPED
Callback when a DFU operation is stopped.
Definition: callbacks.h:169
@ MGMT_EVT_OP_IMG_MGMT_DFU_STARTED
Callback when a DFU operation is started.
Definition: callbacks.h:172
@ MGMT_EVT_GRP_ALL
Definition: callbacks.h:115
@ MGMT_EVT_GRP_SMP
Definition: callbacks.h:116
@ MGMT_EVT_GRP_OS
Definition: callbacks.h:117
@ MGMT_EVT_GRP_SETTINGS
Definition: callbacks.h:120
@ MGMT_EVT_GRP_FS
Definition: callbacks.h:119
@ MGMT_EVT_GRP_USER_CUSTOM_START
Definition: callbacks.h:122
@ MGMT_EVT_GRP_IMG
Definition: callbacks.h:118
@ MGMT_EVT_OP_CMD_RECV
Callback when a command is received, data is mgmt_evt_op_cmd_arg().
Definition: callbacks.h:138
@ MGMT_EVT_OP_CMD_ALL
Used to enable all smp_group events.
Definition: callbacks.h:147
@ MGMT_EVT_OP_CMD_DONE
Callback when a command has been processed, data is mgmt_evt_op_cmd_arg().
Definition: callbacks.h:144
@ MGMT_EVT_OP_CMD_STATUS
Callback when a a status is updated, data is mgmt_evt_op_cmd_arg().
Definition: callbacks.h:141
@ MGMT_EVT_OP_ALL
Used to enable all events.
Definition: callbacks.h:130
@ MGMT_GROUP_ID_PERUSER
User groups defined from 64 onwards.
Definition: mgmt_defines.h:81
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
MGMT callback struct.
Definition: callbacks.h:224
uint32_t event_id
MGMT_EVT_[...] Event ID for handler to be called on.
Definition: callbacks.h:240
sys_snode_t node
Entry list node.
Definition: callbacks.h:226
mgmt_cb callback
Callback that will be called.
Definition: callbacks.h:229
Arguments for MGMT_EVT_OP_CMD_RECV, MGMT_EVT_OP_CMD_STATUS and MGMT_EVT_OP_CMD_DONE.
Definition: callbacks.h:246
uint16_t group
mcumgr_group_t
Definition: callbacks.h:248
int status
img_mgmt_id_upload_t, used in MGMT_EVT_OP_CMD_STATUS
Definition: callbacks.h:261
int err
mcumgr_err_t, used in MGMT_EVT_OP_CMD_DONE
Definition: callbacks.h:258
uint8_t id
Message ID within group.
Definition: callbacks.h:251
uint8_t op
mcumgr_op_t used in MGMT_EVT_OP_CMD_RECV
Definition: callbacks.h:255