net.tinyos.sim.script.reflect
Class Commands

java.lang.Object
  |
  +--net.tinyos.sim.script.reflect.SimReflect
        |
        +--net.tinyos.sim.script.reflect.Commands

public class Commands
extends net.tinyos.sim.script.reflect.SimReflect

The Commands class is a reflection of the 'raw' simulator interface. It is expetect that most functionality will be accessible through one of the other reflected classes, however this class is available for a lower-level interface.

The class is bound into the simcore module as the comm global instance.


Field Summary
static long DBG_ADC
           
static long DBG_ALL
           
static long DBG_AM
           
static long DBG_BOOT
           
static long DBG_CLOCK
           
static long DBG_CRC
           
static long DBG_CRYPTO
           
static long DBG_ENCODE
           
static long DBG_ERROR
           
static long DBG_HARD
           
static long DBG_I2C
           
static long DBG_LED
           
static long DBG_LOG
           
static long DBG_MEM
           
static long DBG_NONE
           
static long DBG_PACKET
           
static long DBG_PROG
           
static long DBG_QUEUE
           
static long DBG_RADIO
           
static long DBG_ROUTE
           
static long DBG_SCHED
           
static long DBG_SENSOR
           
static long DBG_SIM
           
static long DBG_SIMRADIO
           
static long DBG_SOUNDER
           
static long DBG_TASK
           
static long DBG_TEMP
           
static long DBG_TIME
           
static long DBG_UART
           
static long DBG_USR1
           
static long DBG_USR2
           
static long DBG_USR3
           
 
Constructor Summary
Commands(net.tinyos.sim.script.ScriptInterpreter interp, net.tinyos.sim.SimDriver driver)
          Constructor for the Commands object.
 
Method Summary
 int getInterruptID()
          Get a unique interrupt ID.
 void interruptInFuture(long time, int interruptID)
          Schedule an interrupt event.
 net.tinyos.sim.event.VariableRequestResponse requestVariable(long addr, short length)
          Send a variable request command and return the result value.
 net.tinyos.sim.event.VariableResolveResponse resolveVariable(short moteID, java.lang.String name)
          Send a variable resolve command and return the result.
 void sendRadioMessage(short moteID, long time, net.tinyos.message.Message msg)
          Sends a radio message to the given mote.
 void sendUARTMessage(short moteID, long time, net.tinyos.message.Message msg)
          Sends a UART message to the given mote.
 void setADCValue(short moteID, long time, byte port, short value)
          Set the ADC value at the given mote to the specified value.
 void setDBG(long dbg)
          Enable the given debug flag.
 void setEventMask(short mask)
          Set the mask for which events are transmitted.
 void setLinkBitErrorProbability(short src, long time, short dest, double loss)
          Set the ADC value at the given mote to the specified value.
 void setSimRate(double rate)
          Sets the simulator rate
 void turnMoteOff(short moteID, long time)
          Turn off the given mote.
 void turnMoteOn(short moteID, long time)
          Turn on the given mote.
 void waitFor(long time)
          Block execution for a specified amount of time.
 void waitUntil(long time)
          Block execution until the given simulator time.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBG_BOOT

public static final long DBG_BOOT
See Also:
Constant Field Values

DBG_CLOCK

public static final long DBG_CLOCK
See Also:
Constant Field Values

DBG_TASK

public static final long DBG_TASK
See Also:
Constant Field Values

DBG_SCHED

public static final long DBG_SCHED
See Also:
Constant Field Values

DBG_SENSOR

public static final long DBG_SENSOR
See Also:
Constant Field Values

DBG_LED

public static final long DBG_LED
See Also:
Constant Field Values

DBG_CRYPTO

public static final long DBG_CRYPTO
See Also:
Constant Field Values

DBG_ROUTE

public static final long DBG_ROUTE
See Also:
Constant Field Values

DBG_AM

public static final long DBG_AM
See Also:
Constant Field Values

DBG_CRC

public static final long DBG_CRC
See Also:
Constant Field Values

DBG_PACKET

public static final long DBG_PACKET
See Also:
Constant Field Values

DBG_ENCODE

public static final long DBG_ENCODE
See Also:
Constant Field Values

DBG_RADIO

public static final long DBG_RADIO
See Also:
Constant Field Values

DBG_LOG

public static final long DBG_LOG
See Also:
Constant Field Values

DBG_ADC

public static final long DBG_ADC
See Also:
Constant Field Values

DBG_I2C

public static final long DBG_I2C
See Also:
Constant Field Values

DBG_UART

public static final long DBG_UART
See Also:
Constant Field Values

DBG_PROG

public static final long DBG_PROG
See Also:
Constant Field Values

DBG_SOUNDER

public static final long DBG_SOUNDER
See Also:
Constant Field Values

DBG_TIME

public static final long DBG_TIME
See Also:
Constant Field Values

DBG_SIM

public static final long DBG_SIM
See Also:
Constant Field Values

DBG_QUEUE

public static final long DBG_QUEUE
See Also:
Constant Field Values

DBG_SIMRADIO

public static final long DBG_SIMRADIO
See Also:
Constant Field Values

DBG_HARD

public static final long DBG_HARD
See Also:
Constant Field Values

DBG_MEM

public static final long DBG_MEM
See Also:
Constant Field Values

DBG_USR1

public static final long DBG_USR1
See Also:
Constant Field Values

DBG_USR2

public static final long DBG_USR2
See Also:
Constant Field Values

DBG_USR3

public static final long DBG_USR3
See Also:
Constant Field Values

DBG_TEMP

public static final long DBG_TEMP
See Also:
Constant Field Values

DBG_ERROR

public static final long DBG_ERROR
See Also:
Constant Field Values

DBG_NONE

public static final long DBG_NONE
See Also:
Constant Field Values

DBG_ALL

public static final long DBG_ALL
See Also:
Constant Field Values
Constructor Detail

Commands

public Commands(net.tinyos.sim.script.ScriptInterpreter interp,
                net.tinyos.sim.SimDriver driver)
Constructor for the Commands object. This should not be called explicitly, rather the pre-constructed instance comm should be used.

Method Detail

sendRadioMessage

public void sendRadioMessage(short moteID,
                             long time,
                             net.tinyos.message.Message msg)
                      throws java.io.IOException
Sends a radio message to the given mote.

Parameters:
moteID - the id of the target mote
time - simulator time when to do the operation
msg - the actual message class
java.io.IOException

sendUARTMessage

public void sendUARTMessage(short moteID,
                            long time,
                            net.tinyos.message.Message msg)
                     throws java.io.IOException
Sends a UART message to the given mote.

Parameters:
moteID - the id of the target mote
time - simulator time when to do the operation
msg - the actual message class
java.io.IOException

turnMoteOff

public void turnMoteOff(short moteID,
                        long time)
                 throws java.io.IOException
Turn off the given mote.

Parameters:
moteID - the id of the mote
time - simulator time when to do the operation
java.io.IOException

turnMoteOn

public void turnMoteOn(short moteID,
                       long time)
                throws java.io.IOException
Turn on the given mote.

Parameters:
moteID - the id of the mote
time - simulator time when to do the operation
java.io.IOException

setADCValue

public void setADCValue(short moteID,
                        long time,
                        byte port,
                        short value)
                 throws java.io.IOException
Set the ADC value at the given mote to the specified value.

Parameters:
moteID - the id of the mote
time - simulator time when to do the operation
port - the ADC port to set
value - the new value
java.io.IOException

setSimRate

public void setSimRate(double rate)
                throws java.io.IOException
Sets the simulator rate

Parameters:
rate - the new simulator rate (relative to real time)
java.io.IOException

setLinkBitErrorProbability

public void setLinkBitErrorProbability(short src,
                                       long time,
                                       short dest,
                                       double loss)
                                throws java.io.IOException
Set the ADC value at the given mote to the specified value.

Parameters:
src - the source mote id
dest - the destination mote id
time - simulator time when to do the operation
loss - the bit error loss value
java.io.IOException

getInterruptID

public int getInterruptID()
Get a unique interrupt ID.


interruptInFuture

public void interruptInFuture(long time,
                              int interruptID)
                       throws java.io.IOException
Schedule an interrupt event.

Parameters:
time - simulator time when to do the operation
interruptID - id code for the interrupt event
java.io.IOException

resolveVariable

public net.tinyos.sim.event.VariableResolveResponse resolveVariable(short moteID,
                                                                    java.lang.String name)
                                                             throws java.io.IOException
Send a variable resolve command and return the result.

Parameters:
moteID - mote identifier
name - mote frame variable name
java.io.IOException

requestVariable

public net.tinyos.sim.event.VariableRequestResponse requestVariable(long addr,
                                                                    short length)
                                                             throws java.io.IOException
Send a variable request command and return the result value.

Parameters:
addr - variable address
length - variable length
java.io.IOException

setDBG

public void setDBG(long dbg)
            throws java.io.IOException
Enable the given debug flag.

Parameters:
dbg - debug flag
java.io.IOException

setEventMask

public void setEventMask(short mask)
                  throws java.io.IOException
Set the mask for which events are transmitted.

Parameters:
mask - event mask
java.io.IOException

waitUntil

public void waitUntil(long time)
               throws java.io.IOException
Block execution until the given simulator time. This should be used with care; specifically should not be called from within an event handler.

Parameters:
time - simulator time at which to unblock
java.io.IOException

waitFor

public void waitFor(long time)
             throws java.io.IOException
Block execution for a specified amount of time. This should be used with care; specifically should not be called from within an event handler.

Parameters:
time - simulator time amount to wait for
java.io.IOException