Files
Momentum-Firmware/lib/toolbox/cli/cli_registry_i.h
Anna Antonenko 096c088bf1 vcp, cli: Handle Tx/Rx events before Connect/Disconnect + extra fixes (#4181)
* cli_vcp: handle tx/rx before connext/disconnect

* cli_vcp: disable trace

* cli_perf: advanced error reporting

* cli_vcp: reset tx flag directly in event handler

* fix formatting

* cli_vcp: make tx flag volatile

* storage_settings: fix scene ids

* cli_shell: add safety check to set_prompt

* cli_registry: move from bptree to dict, fix memory leak

* cli_vcp: go back to message queue for event signaling

* loader: move BeforeLoad event even earlier

* fix formatting
2025-04-11 14:53:10 +04:00

46 lines
1.1 KiB
C

/**
* @file cli_registry_i.h
* Internal API for getting commands registered with the CLI
*/
#pragma once
#include <furi.h>
#include <m-dict.h>
#include "cli_registry.h"
#ifdef __cplusplus
extern "C" {
#endif
#define CLI_BUILTIN_COMMAND_STACK_SIZE (4 * 1024U)
typedef struct {
void* context; //<! Context passed to callbacks
CliCommandExecuteCallback execute_callback; //<! Callback for command execution
CliCommandFlag flags;
size_t stack_depth;
} CliRegistryCommand;
DICT_DEF2(CliCommandDict, FuriString*, FURI_STRING_OPLIST, CliRegistryCommand, M_POD_OPLIST);
#define M_OPL_CliCommandDict_t() DICT_OPLIST(CliCommandDict, FURI_STRING_OPLIST, M_POD_OPLIST)
bool cli_registry_get_command(
CliRegistry* registry,
FuriString* command,
CliRegistryCommand* result);
void cli_registry_lock(CliRegistry* registry);
void cli_registry_unlock(CliRegistry* registry);
/**
* @warning Surround calls to this function with `cli_registry_[un]lock`
*/
CliCommandDict_t* cli_registry_get_commands(CliRegistry* registry);
#ifdef __cplusplus
}
#endif