subsys: mgmt: Shell transport for SMP (mcumgr).

Enable the shell to transport mcumgr SMP requests and responses.

Signed-off-by: Christopher Collins <ccollins@apache.org>
This commit is contained in:
Christopher Collins 2018-01-17 17:59:49 -08:00 committed by Carles Cufí
commit 76bf5646d5
6 changed files with 599 additions and 3 deletions

View file

@ -44,6 +44,19 @@ struct shell_module {
shell_prompt_function_t prompt;
};
/** @typedef shell_mcumgr_function_t
* @brief Callback that is executed when an mcumgr packet is received over the
* shell.
*
* The packet argument must be exactly what was received over the console,
* except the terminating newline must be replaced with '\0'.
*
* @param line The received mcumgr packet.
* @param arg An optional argument.
*
* @return on success; negative error code on failure.
*/
typedef int (*shell_mcumgr_function_t)(const char *line, void *arg);
/**
* @brief Kernel Shell API
@ -148,6 +161,13 @@ void shell_register_prompt_handler(shell_prompt_function_t handler);
*/
void shell_register_default_module(const char *name);
/** @brief Configures a callback for received mcumgr packets.
*
* @param handler The callback to execute when an mcumgr packet is received.
* @param arg An optional argument to pass to the callback.
*/
void shell_register_mcumgr_handler(shell_mcumgr_function_t handler, void *arg);
/** @brief Execute command line.
*
* Pass command line to shell to execute. The line cannot be a C string literal