Macros
Command specific macros. More...
Macros |
|
#define | GOS_CMD_CREATE_COMMAND (component, name, key, shortcut, min, max, retval) _GOS_CMD_CREATE_COMMAND(component, name, key, shortcut, min, max, retval) |
#define | GOS_CMD_CREATE_GETTER (component, name, key, shortcut, argc) _GOS_CMD_CREATE_GETTER(component, name, key, MACRO_NO_EXPAND_ARG(shortcut), argc) |
#define | GOS_CMD_CREATE_SETTER (component, name, key, shortcut, argc) _GOS_CMD_CREATE_SETTER(component, name, key, MACRO_NO_EXPAND_ARG(shortcut), argc) |
#define | GOS_CMD_CREATE_GETTER_SETTER (component, name, key, shortcut, get_argc, set_argc) _GOS_CMD_CREATE_GETTER_SETTER(component, name, key, MACRO_NO_EXPAND_ARG(shortcut), get_argc, set_argc) |
#define | GOS_DEFINE_COMMAND (component, name) gos_cmd_result_t component ## _ ## name ## _command(int argc, char **argv) |
#define | GOS_DEFINE_GETTER (component, name) gos_cmd_result_t component ## _get_ ## name ## _command(int argc, char **argv) |
#define | GOS_DEFINE_SETTER (component, name) gos_cmd_result_t component ## _set_ ## name ## _command(int argc, char **argv) |
#define | SC2 (a1, a2, b) GOS_CMD_SHORTCUT_ID2(a1, a2, b) |
#define | SC3 (a1, a2, b, c) GOS_CMD_SHORTCUT_ID3(a1, a2, b, c) |
#define | GOS_CMD_RESULT (gos_result) ((gos_result) == GOS_SUCCESS ) ? GOS_CMD_SUCCESS : GOS_CMD_FAILED |
#define | GOS_CMD_VERIFY (gos_result) if((gos_result) != GOS_SUCCESS ) return GOS_CMD_FAILED |
#define | GOS_CMD_FAILED (result, func) ((result = func) != GOS_CMD_SUCCESS ) |
#define | GOS_CMD_SET_FAILED (result, func) ((result = func) != GOS_CMD_SET_OK ) |
#define | GOS_CMD_EXECUTE_OK (gos_result) (gos_result == GOS_SUCCESS ) ? GOS_CMD_EXECUTE_AOK : GOS_CMD_FAILED |
#define | GOS_CMD_PARSE_INT_ARG_WITH_VAR (type, var, str, min, max) |
Utility macro to parse an integer argument and store in supplied variable.
More...
|
|
#define | GOS_CMD_PARSE_INT_ARG (type, name, str, min, max) |
Utility macro to parse an integer argument and store in created variable.
More...
|
|
#define | GOS_CMD_PARSE_HEX_ARG_WITH_VAR (type, var, str, min, max) |
Utility macro to parse an hexadecimal argument and store in supplied variable.
More...
|
|
#define | GOS_CMD_PARSE_HEX_ARG (type, name, str, min, max) |
Utility macro to parse an hexadecimal argument and store in created variable.
More...
|
|
Detailed Description
Command specific macros.
Macro Definition Documentation
◆ GOS_CMD_CREATE_COMMAND
#define GOS_CMD_CREATE_COMMAND | ( |
component,
|
|
name,
|
|||
key,
|
|||
shortcut,
|
|||
min,
|
|||
max,
|
|||
retval
|
|||
) | _GOS_CMD_CREATE_COMMAND(component, name, key, shortcut, min, max, retval) |
Define a Gecko OS Command
This automatically adds a command line command. The command implementation should be defined in the same file as the definition, e.g.
- Parameters
-
component
The name of the component that this command belows, e.g. my_app
name
The name of the command, e.g. start_polling
key
The command-line command key, e.g. start_polling
shortcut
The command-line command shortcut, e.g. sp
min
The minimum number of arguments this command accepts max
The maximum number of arguments this commands accepts retval
true if the command prints its own response, false else
◆ GOS_CMD_CREATE_GETTER
#define GOS_CMD_CREATE_GETTER | ( |
component,
|
|
name,
|
|||
key,
|
|||
shortcut,
|
|||
argc
|
|||
) | _GOS_CMD_CREATE_GETTER(component, name, key, MACRO_NO_EXPAND_ARG(shortcut), argc) |
Define a Gecko OS settings 'getter'
This automatically adds a setting to the available 'get' command line options. The 'getter' implementation should be defined in the same file as the definition, e.g.
- Note
- This only creates a 'getter'. Use GOS_CMD_CREATE_GETTER_SETTER to create both a 'getter' and 'setter'.
- Parameters
-
component
The name of the component that this command belows, e.g. my_app
name
The name of the getter command, e.g. polling_period
key
The command-line 'get' command option key, e.g. get my_app.polling_period
shortcut
The command-line 'get' command options shortcut, e.g. get ma p
argc
The minimum number of arguments this 'getter' accepts, typically this value is 0.
◆ GOS_CMD_CREATE_GETTER_SETTER
#define GOS_CMD_CREATE_GETTER_SETTER | ( |
component,
|
|
name,
|
|||
key,
|
|||
shortcut,
|
|||
get_argc,
|
|||
set_argc
|
|||
) | _GOS_CMD_CREATE_GETTER_SETTER(component, name, key, MACRO_NO_EXPAND_ARG(shortcut), get_argc, set_argc) |
Define a Gecko OS settings 'getter' and 'setter'
This automatically adds a setting to the available 'get' and 'set' command line options. The 'getter' and 'setter' implementations should be defined in the same file as the definition, e.g.
- Parameters
-
component
The name of the component that this command belows, e.g. my_app
name
The name of the getter/setter commands, e.g. polling_period
key
The command-line 'get' and 'set' command option key, e.g. get my_app.polling_period
andset my_app.polling_period
shortcut
The command-line 'get' command options shortcut, e.g. get ma p
andset ma p
get_argc
The minimum number of arguments this 'getter' accepts, typically this value is 0 set_argc
The minimum number of arguments this 'setter' accepts, typically this value is 1
◆ GOS_CMD_CREATE_SETTER
#define GOS_CMD_CREATE_SETTER | ( |
component,
|
|
name,
|
|||
key,
|
|||
shortcut,
|
|||
argc
|
|||
) | _GOS_CMD_CREATE_SETTER(component, name, key, MACRO_NO_EXPAND_ARG(shortcut), argc) |
Define a Gecko OS settings 'setter'
This automatically adds a setting to the available 'set' command line options. The 'setter' implementation should be defined in the same file as the definition, e.g.
- Note
- This only creates a 'setter'. Use GOS_CMD_CREATE_GETTER_SETTER to create both a 'getter' and 'setter'.
- Parameters
-
component
The name of the component that this command belows, e.g. my_app
name
The name of the setter command, e.g. polling_period
key
The command-line 'set' command option key, e.g. set my_app.polling_period
shortcut
The command-line 'set' command options shortcut, e.g. set ma p
argc
The minimum number of arguments this 'setter' accepts, typically this value is 1.
- Examples:
- system/custom_commands/main.c .
◆ GOS_CMD_EXECUTE_OK
#define GOS_CMD_EXECUTE_OK | ( |
gos_result
|
) | (gos_result == GOS_SUCCESS ) ? GOS_CMD_EXECUTE_AOK : GOS_CMD_FAILED |
Helper macro to return GOS_CMD_EXECUTE_AOK on GOS_SUCCESS else GOS_CMD_FAILED
◆ GOS_CMD_FAILED
#define GOS_CMD_FAILED | ( |
result,
|
|
func
|
|||
) | ((result = func) != GOS_CMD_SUCCESS ) |
Store the result of command util API call, return TRUE if API was successful, FALSE else
◆ GOS_CMD_PARSE_HEX_ARG
#define GOS_CMD_PARSE_HEX_ARG | ( |
type,
|
|
name,
|
|||
str,
|
|||
min,
|
|||
max
|
|||
) |
Utility macro to parse an hexadecimal argument and store in created variable.
- Note
- If parsing fails then then function returns with the value GOS_CMD_BAD_ARGS
- Parameters
-
type
The datatype of variable to create(e.g. uint32_t) name
The name of the variable to create str
Hex string to parse min
Minimum value of the integer max
Maximum value of the integer
◆ GOS_CMD_PARSE_HEX_ARG_WITH_VAR
#define GOS_CMD_PARSE_HEX_ARG_WITH_VAR | ( |
type,
|
|
var,
|
|||
str,
|
|||
min,
|
|||
max
|
|||
) |
Utility macro to parse an hexadecimal argument and store in supplied variable.
- Note
- If parsing fails then then function returns with the value GOS_CMD_BAD_ARGS
- Parameters
-
type
The argument datatype (e.g. uint32_t) var
The name of existing variable str
Hex string to parse min
Minumum value of the integer max
Maximum value of the integer
◆ GOS_CMD_PARSE_INT_ARG
#define GOS_CMD_PARSE_INT_ARG | ( |
type,
|
|
name,
|
|||
str,
|
|||
min,
|
|||
max
|
|||
) |
Utility macro to parse an integer argument and store in created variable.
- Note
- If parsing fails then then function returns with the value GOS_CMD_BAD_ARGS
-
If the supplied string starts with
0x
it will be parsed as HEX.
- Parameters
-
type
The datatype of variable to create(e.g. uint32_t) name
The name of the variable to create str
Integer string to parse min
Minumum value of the integer max
Maximum value of the integer
- Examples:
- utility/buffer_dump/main.c .
◆ GOS_CMD_PARSE_INT_ARG_WITH_VAR
#define GOS_CMD_PARSE_INT_ARG_WITH_VAR | ( |
type,
|
|
var,
|
|||
str,
|
|||
min,
|
|||
max
|
|||
) |
Utility macro to parse an integer argument and store in supplied variable.
- Note
- If parsing fails then then function returns with the value GOS_CMD_BAD_ARGS
-
If the supplied string starts with
0x
it will be parsed as HEX.
- Parameters
-
type
The argument datatype (e.g. uint32_t) var
The name of existing variable str
Integer string to parse min
Minumum value of the integer max
Maximum value of the integer
◆ GOS_CMD_RESULT
#define GOS_CMD_RESULT | ( |
gos_result
|
) | ((gos_result) == GOS_SUCCESS ) ? GOS_CMD_SUCCESS : GOS_CMD_FAILED |
Helper macro to convert a gos_result_t to a gos_cmd_result_t
◆ GOS_CMD_SET_FAILED
#define GOS_CMD_SET_FAILED | ( |
result,
|
|
func
|
|||
) | ((result = func) != GOS_CMD_SET_OK ) |
Store the result of SET API call, return TRUE if API was successful, FALSE else
- Examples:
- demo/uart_blaster/commands.c .
◆ GOS_CMD_VERIFY
#define GOS_CMD_VERIFY | ( |
gos_result
|
) | if((gos_result) != GOS_SUCCESS ) return GOS_CMD_FAILED |
Helper macro to return GOS_CMD_FAILED if the Gecko OS API fails
◆ GOS_DEFINE_COMMAND
#define GOS_DEFINE_COMMAND | ( |
component,
|
|
name
|
|||
) | gos_cmd_result_t component ## _ ## name ## _command(int argc, char **argv) |
Helper macro to define a command's implementation
◆ GOS_DEFINE_GETTER
#define GOS_DEFINE_GETTER | ( |
component,
|
|
name
|
|||
) | gos_cmd_result_t component ## _get_ ## name ## _command(int argc, char **argv) |
Helper macro to define a getter's implementation
◆ GOS_DEFINE_SETTER
#define GOS_DEFINE_SETTER | ( |
component,
|
|
name
|
|||
) | gos_cmd_result_t component ## _set_ ## name ## _command(int argc, char **argv) |
Helper macro to define a getter's implementation
◆ SC2
#define SC2 | ( |
a1,
|
|
a2,
|
|||
b
|
|||
) | GOS_CMD_SHORTCUT_ID2(a1, a2, b) |
Helper function for creating a two item short, e.g.
◆ SC3
#define SC3 | ( |
a1,
|
|
a2,
|
|||
b,
|
|||
c
|
|||
) | GOS_CMD_SHORTCUT_ID3(a1, a2, b, c) |
Helper function for creating a three item short, e.g.