Apps     Components     Interfaces     All Files     Source Tree     source: apps.SimpleCmd.SimpleCmdM.nc

Component: SimpleCmdM

SimpleCmdM is a tiny OS application module. This module demonstrates a simple command interpreter for the TinyOS tutorial. The module receives a command message from the radio, which is passed to the ProcessCmd interface for processing. A task is posted to process the command. The command packet contains a one-byte 'action' field specifying which action to take; as a simple version, this module can only interpret the follwoing commands: Led_on (action = 1), Led_off (2), radio_quieter (3), and radio_louder (4). This module also implements the ProcessCmd interface.
Author: Robert Szewczyk
  Su Ping

Required Interfaces

Provided Interfaces

Variables

Function Index

Function Descriptions

cmdInterpret

task void cmdInterpret(void)

This task evaluates a command and execute it if it is a supported command.The protocol for the command interpreter is that it operates on the message and returns a (potentially modified) message to the calling layer, as well a status word for whether the message should be futher processed.
Returns: Return: None

StdControl.init

command result_t StdControl.init (void)

Initialization for the application: 1. Initialize module static variables 2. Initialize communication layer
Returns: Returns SUCCESS or FAILED

ProcessCmd.execute

command result_t ProcessCmd.execute (TOS_MsgPtr pmsg)

Posts the cmdInterpret() task to handle the recieved command.
Returns: Always returns SUCCESS

ReceiveCmdMsg.receive

event TOS_MsgPtr ReceiveCmdMsg.receive (TOS_MsgPtr pmsg)

Called upon message reception and invokes the ProcessCmd.execute() command.
Returns: Returns a pointer to a TOS_Msg buffer

ProcessCmd.done

event result_t ProcessCmd.done (TOS_MsgPtr pmsg, result_t status)

Called upon completion of command execution.
Returns: Always returns SUCCESS