EmberCommandEntry Struct Reference

Command entry for a command table.

#include <command-interpreter2.h>

Data Fields

const char * name
 
CommandAction action
 
const char * argumentTypes
 
const char * description
 
const char *const * argumentDescriptions

Command entry for a command table.

Field Documentation

◆ action

CommandAction EmberCommandEntry::action

A reference to a function in the application that implements the command. If this entry refers to a nested command, then action field has to be set to NULL.

◆ argumentDescriptions

const char* const* EmberCommandEntry::argumentDescriptions

An array of strings, with a NULL terminator, indicating what each argument is.

◆ argumentTypes

const char* EmberCommandEntry::argumentTypes

In case of normal (non-nested) commands, argumentTypes is a string that specifies the number and types of arguments the command accepts. The argument specifiers are:

  • u: one-byte unsigned integer.
  • v: two-byte unsigned integer
  • w: four-byte unsigned integer
  • s: one-byte signed integer
  • r: two-byte signed integer
  • q: four-byte signed integer
  • b: string. The argument can be entered in ascii by using quotes, for example: "foo". Or it may be entered in hex by using curly braces, for example: { 08 A1 f2 }. There must be an even number of hex digits, and spaces are ignored.
  • *: zero or more of the previous type. If used, this must be the last specifier.
  • ?: Unknown number of arguments. If used this must be the only character. This means, that command interpreter will not perform any validation of arguments, and will call the action directly, trusting it that it will handle with whatever arguments are passed in.
  • !: Optional argument delimiter. If the command input has sufficient arguments such that the parser ends on a ! symbol, then the command will be considered valid, even if it does not necessarily process the entire argumentTypes string. If there are additional arguments beyond a !, but still fewer arguments than the next either the next ! or the end of the string, then the command will be considered invalid. Note that this leaves the called CommandAction function to actually validate what number of optional arguments it actually got. Example: Given a argumentTypes String: uu!vv!u!vv The following inputs type orders are valid: uu, uuvv, uuvvu, uuvvuvv The following are invalid: u, uuv, uuvvuv, uuvvuvvv

Integer arguments can be either decimal or hexidecimal. A 0x prefix indicates a hexidecimal integer. Example: 0x3ed.

In case of a nested command (action is NULL), then this field contains a pointer to the nested EmberCommandEntry array.

◆ description

const char* EmberCommandEntry::description

A description of the command.

◆ name

const char* EmberCommandEntry::name

Use letters, digits, and underscores, '_', for the command name. Command names are case-sensitive.


The documentation for this struct was generated from the following file:
  • command-interpreter2.h