Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added language limiting command length and clarifying number of commands

...

Your application can augment this list by registering additional commands.  The mote has capacity for a total of 32 CLI commands.  The list of built-in commands above uses 10 of those 32 available, meaning you can add up to 22 commands can be added to the built in additional commands. A handler function needs to be defined for each command; it will be called when the user enters the corresponding command. The 

Include Page
_def_ocsdk_stack
_def_ocsdk_stack
 takes care of dispatching the entered commands to the right handler. When a command is entered, the corresponding handler is given the full string entered by the user, allowing the handler to parse the string for arguments, and take appropriate action.  The command string itself (the string that a person will type) must be short, up to 10 characters in length.  For example: toggleOutput won't work, but togOut will work.  Your handler is responsible for determining if the number and format of the passed arguments are correct.  The handler may return DN_ERR_INVALID if validation fails, which will result in an "invalid argument(s)" error message being printed by the stack, in addition to any error messages your handler might generate. 

...

Note

Only the command that are enabled by the current access level are listed in the output of the "help" command.

active access levelwhat commands are enabled?
DN_CLI_ACCESS_LOGIN (default)Only commands of access level DN_CLI_ACCESS_LOGIN.
DN_CLI_ACCESS_VIEWERAll commands of access levels DN_CLI_ACCESS_VIEWER and DN_CLI_ACCESS_LOGIN.
DN_CLI_ACCESS_USERAll commands of access levels DN_CLI_ACCESS_USER, DN_CLI_ACCESS_VIEWER and DN_CLI_ACCESS_LOGIN.
DN_CLI_ACCESS_DUSTAll commands of access levels DN_CLI_ACCESS_DUST, DN_CLI_ACCESS_USER, DN_CLI_ACCESS_VIEWER and DN_CLI_ACCESS_LOGIN.

The default access level is DN_CLI_ACCESS_LOGIN. Use dnm_ucli_changeAccessLevel() to change the active access level.

...

The 03-cli_accesslevel sample application shows how to use the access level. Internally, it defines the following dummy CLI commands:

CLI commandaccess level valueaccess level
clogin1DN_CLI_ACCESS_LOGIN
cviewer2DN_CLI_ACCESS_VIEWER
cuser3DN_CLI_ACCESS_USER
cdust4DN_CLI_ACCESS_DUST

It also defines a level command which allows you to switch the current user level.

...