Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
MCUmgr mgmt API. More...
Data Structures | |
struct | mgmt_handler |
Read handler and write handler for a single command ID. More... | |
struct | mgmt_group |
A collection of handlers for an entire command group. More... | |
Macros | |
#define | MGMT_CTXT_SET_RC_RSN(mc, rsn) |
#define | MGMT_CTXT_RC_RSN(mc) NULL |
#define | MGMT_RETURN_CHECK(ok) ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE |
Used at end of MCUmgr handlers to return an error if the message size limit was reached, or OK if it was not. | |
#define | MGMT_HDR_SIZE 8 |
Typedefs | |
typedef void *(* | mgmt_alloc_rsp_fn) (const void *src_buf, void *arg) |
Allocates a buffer suitable for holding a response. | |
typedef void(* | mgmt_reset_buf_fn) (void *buf, void *arg) |
Resets a buffer to a length of 0. | |
typedef int(* | mgmt_handler_fn) (struct smp_streamer *ctxt) |
Processes a request and writes the corresponding response. | |
Enumerations | |
enum | mcumgr_op_t { MGMT_OP_READ = 0 , MGMT_OP_READ_RSP , MGMT_OP_WRITE , MGMT_OP_WRITE_RSP } |
Opcodes; encoded in first byte of header. More... | |
enum | mcumgr_group_t { MGMT_GROUP_ID_OS = 0 , MGMT_GROUP_ID_IMAGE , MGMT_GROUP_ID_STAT , MGMT_GROUP_ID_SETTINGS , MGMT_GROUP_ID_LOG , MGMT_GROUP_ID_CRASH , MGMT_GROUP_ID_SPLIT , MGMT_GROUP_ID_RUN , MGMT_GROUP_ID_FS , MGMT_GROUP_ID_SHELL , MGMT_GROUP_ID_PERUSER = 64 , ZEPHYR_MGMT_GRP_BASIC = (MGMT_GROUP_ID_PERUSER - 1) } |
MCUmgr groups. More... | |
enum | mcumgr_err_t { MGMT_ERR_EOK = 0 , MGMT_ERR_EUNKNOWN , MGMT_ERR_ENOMEM , MGMT_ERR_EINVAL , MGMT_ERR_ETIMEOUT , MGMT_ERR_ENOENT , MGMT_ERR_EBADSTATE , MGMT_ERR_EMSGSIZE , MGMT_ERR_ENOTSUP , MGMT_ERR_ECORRUPT , MGMT_ERR_EBUSY , MGMT_ERR_EACCESSDENIED , MGMT_ERR_UNSUPPORTED_TOO_OLD , MGMT_ERR_UNSUPPORTED_TOO_NEW , MGMT_ERR_EPERUSER = 256 } |
MCUmgr error codes. More... | |
Functions | |
void | mgmt_register_group (struct mgmt_group *group) |
Registers a full command group. | |
void | mgmt_unregister_group (struct mgmt_group *group) |
Unregisters a full command group. | |
const struct mgmt_handler * | mgmt_find_handler (uint16_t group_id, uint16_t command_id) |
Finds a registered command handler. | |
const struct mgmt_group * | mgmt_find_group (uint16_t group_id) |
Finds a registered command group. | |
const struct mgmt_handler * | mgmt_get_handler (const struct mgmt_group *group, uint16_t command_id) |
Finds a registered command handler. | |
MCUmgr mgmt API.
#define MGMT_CTXT_RC_RSN | ( | mc | ) | NULL |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt.h>
#define MGMT_CTXT_SET_RC_RSN | ( | mc, | |
rsn | |||
) |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt.h>
#define MGMT_HDR_SIZE 8 |
#define MGMT_RETURN_CHECK | ( | ok | ) | ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt_defines.h>
Used at end of MCUmgr handlers to return an error if the message size limit was reached, or OK if it was not.
mgmt_alloc_rsp_fn |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt.h>
Allocates a buffer suitable for holding a response.
If a source buf is provided, its user data is copied into the new buffer.
src_buf | An optional source buffer to copy user data from. |
arg | Optional streamer argument. |
mgmt_handler_fn |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt.h>
Processes a request and writes the corresponding response.
A separate handler is required for each supported op-ID pair.
ctxt | The mcumgr context to use. |
mgmt_reset_buf_fn |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt.h>
Resets a buffer to a length of 0.
The buffer's user data remains, but its payload is cleared.
buf | The buffer to reset. |
arg | Optional streamer argument. |
enum mcumgr_err_t |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt_defines.h>
MCUmgr error codes.
enum mcumgr_group_t |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt_defines.h>
MCUmgr groups.
The first 64 groups are reserved for system level mcumgr commands. Per-user commands are then defined after group 64.
enum mcumgr_op_t |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt_defines.h>
Opcodes; encoded in first byte of header.
Enumerator | |
---|---|
MGMT_OP_READ | Read op-code. |
MGMT_OP_READ_RSP | Read response op-code. |
MGMT_OP_WRITE | Write op-code. |
MGMT_OP_WRITE_RSP | Write response op-code. |
const struct mgmt_group * mgmt_find_group | ( | uint16_t | group_id | ) |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt.h>
Finds a registered command group.
group_id | The group id of the command group to find. |
const struct mgmt_handler * mgmt_find_handler | ( | uint16_t | group_id, |
uint16_t | command_id | ||
) |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt.h>
Finds a registered command handler.
group_id | The group of the command to find. |
command_id | The ID of the command to find. |
const struct mgmt_handler * mgmt_get_handler | ( | const struct mgmt_group * | group, |
uint16_t | command_id | ||
) |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt.h>
Finds a registered command handler.
group | The group of the command to find. |
command_id | The ID of the command to find. |
void mgmt_register_group | ( | struct mgmt_group * | group | ) |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt.h>
Registers a full command group.
group | The group to register. |
void mgmt_unregister_group | ( | struct mgmt_group * | group | ) |
#include <include/zephyr/mgmt/mcumgr/mgmt/mgmt.h>
Unregisters a full command group.
group | The group to register. |