Apps     Components     Interfaces     All Files     Source Tree     source: tos.interfaces.CommandRegister.nc

Interface: CommandRegister

The interface for registering commands.

See lib/Commands/... for examples of components that register commands.

See interfaces/Command.h for the data structures used in this interface

Implemented by lib/Command.td

Author: Wei Hong (wei.hong@intel-research.net)

Components providing this interface:
tos.lib.Command

Components requiring this interface:
tos.lib.Commands.CommandAttrM
tos.lib.Commands.CommandLedsM
tos.lib.Commands.CommandPotM
tos.lib.Commands.CommandResetM
tos.lib.Commands.CommandSounderM

Commands

Events

Commands - Details

registerCommand

result_t registerCommand(char *name, TOSType retType, uint8_t retLen, ParamList *paramList)

Register a command with the specified name, return type, return length, and parameters.

Parameters:

name - The name of the command to register

retType - The type of the command (see SchemaType.h)

retLen - The length (in bytes) of the command

paramList - The parameters to this command (see Command.h for the def of paramList)

Events - Details

commandFunc

result_t commandFunc(char *commandName, char *resultBuf, SchemaErrorNo *errorNo, ParamVals *params)

Called by Command.td when a specified command is invoked by the user. The implementer must actually carry out the command.

Parameters:

The - name of the command that was invoked

The - buffer where the command result should be written

An - error code (may be SCHEMA_RESULT_PENDING, in which case commandDone must be called at some time in the future.)