BSB Developer Docs
Loading...
Searching...
No Matches
cli_registry_i.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <furi.h>
9#include <m-dict.h>
10#include "cli_registry.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#define CLI_BUILTIN_COMMAND_STACK_SIZE (4 * 1024U)
17
18typedef struct {
19 void* context; //<! Context passed to callbacks
20 CliCommandExecuteCallback execute_callback; //<! Callback for command execution
21 CliCommandFlag flags;
22 size_t stack_depth;
23 FuriSemaphore* run_semaphore;
25
26void cli_registry_command_clear(CliRegistryCommand cmd);
27
28#define CLI_REGISTRY_COMMAND_CLEAR(a) \
29 do { \
30 if(a.run_semaphore) furi_semaphore_free(a.run_semaphore); \
31 } while(0)
32#define CLI_REGISTRY_COMMAND_OPTLIST M_OPEXTEND(M_POD_OPLIST, CLEAR(CLI_REGISTRY_COMMAND_CLEAR))
33DICT_DEF2(
34 CliCommandDict,
35 FuriString*,
36 FURI_STRING_OPLIST,
38 CLI_REGISTRY_COMMAND_OPTLIST);
39#define M_OPL_CliCommandDict_t() DICT_OPLIST(CliCommandDict, FURI_STRING_OPLIST, M_POD_OPLIST)
40
41bool cli_registry_get_command(
42 CliRegistry* registry,
43 FuriString* command,
44 CliRegistryCommand* result);
45
46void cli_registry_lock(CliRegistry* registry);
47
48void cli_registry_unlock(CliRegistry* registry);
49
53CliCommandDict_t* cli_registry_get_commands(CliRegistry* registry);
54
55#ifdef __cplusplus
56}
57#endif
CliCommandFlag
Definition cli_command_min.h:13
void(* CliCommandExecuteCallback)(PipeSide *pipe, FuriString *args, void *context)
CLI command execution callback pointer.
Definition cli_command_min.h:48
API for registering commands with a CLI shell.
CliCommandDict_t * cli_registry_get_commands(CliRegistry *registry)
Definition cli_registry.c:190
Definition cli_registry_i.h:18
Definition cli_registry.c:8