net.tinyos.sim.script.reflect
Class Mote

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

public class Mote
extends SimObject

The Mote class provides access to the simulated mote objects.

Each mote that is simulated has a corresponding simulator object. These simulator objects are bound into the simcore module as the motes list. Hence for example, motes[3].turnOn() will turn on mote number 3. Generic methods that are available on all simulator objects are described in SimObject.


Constructor Summary
Mote(net.tinyos.sim.script.ScriptInterpreter interp, net.tinyos.sim.SimDriver driver, net.tinyos.sim.MoteSimObject mote)
           
 
Method Summary
 byte getByte(java.lang.String var)
          Resolve and return the value of a mote frame variable, and return it as a byte.
 byte[] getBytes(java.lang.String var)
          Resolve and return the value of a mote frame variable, and return it as a byte array.
 byte[] getBytes(java.lang.String var, long len, long offset)
          Resolve and return the value of a mote frame variable, specifying the length and the offset, and return it as a byte array.
 int getID()
          Return the mote's ID.
 int getInt(java.lang.String var)
          Resolve and return the value of a mote frame variable, and return it as an int.
 long getLong(java.lang.String var)
          Resolve and return the value of a mote frame variable, and return it as a long.
 short getShort(java.lang.String var)
          Resolve and return the value of a mote frame variable, and return it as a short.
 boolean isOn()
          Return whether or not the mote is on.
 void setLabel(java.lang.String label, int xoff, int yoff)
          Set a label in the TinyViz GUI for the given mote at a constant offset to the mote's position.
 java.lang.String toString()
          Return a string representing the mote's state (i.e. power, position).
 void turnOff()
          Turn the mote off.
 void turnOn()
          Turn the mote on.
 
Methods inherited from class net.tinyos.sim.script.reflect.SimObject
addAttribute, addAttributeChangedEvent, getAttribute, getCoord, getDistance, getDistance, getDistance, getXCoord, getYCoord, isSelected, move, moveTo, removeAttribute, setCoord, setSelected, setUnselected
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Mote

public Mote(net.tinyos.sim.script.ScriptInterpreter interp,
            net.tinyos.sim.SimDriver driver,
            net.tinyos.sim.MoteSimObject mote)
Method Detail

getID

public int getID()
Return the mote's ID.


toString

public java.lang.String toString()
Return a string representing the mote's state (i.e. power, position).

Overrides:
toString in class java.lang.Object

turnOn

public void turnOn()
            throws java.io.IOException
Turn the mote on.

java.io.IOException

turnOff

public void turnOff()
             throws java.io.IOException
Turn the mote off.

java.io.IOException

isOn

public boolean isOn()
Return whether or not the mote is on.


setLabel

public void setLabel(java.lang.String label,
                     int xoff,
                     int yoff)
Set a label in the TinyViz GUI for the given mote at a constant offset to the mote's position. Has no effect if the gui is not enabled.

Parameters:
label - the string to display
xoff - x offset of the label
yoff - y offset of the label

getBytes

public byte[] getBytes(java.lang.String var,
                       long len,
                       long offset)
                throws java.io.IOException
Resolve and return the value of a mote frame variable, specifying the length and the offset, and return it as a byte array.

Parameters:
var - variable name to resolve and return
java.io.IOException

getBytes

public byte[] getBytes(java.lang.String var)
                throws java.io.IOException
Resolve and return the value of a mote frame variable, and return it as a byte array.

Parameters:
var - variable name to resolve and return
java.io.IOException

getLong

public long getLong(java.lang.String var)
             throws java.io.IOException
Resolve and return the value of a mote frame variable, and return it as a long.

Parameters:
var - variable name to resolve and return
java.io.IOException

getInt

public int getInt(java.lang.String var)
           throws java.io.IOException
Resolve and return the value of a mote frame variable, and return it as an int.

Parameters:
var - variable name to resolve and return
java.io.IOException

getShort

public short getShort(java.lang.String var)
               throws java.io.IOException
Resolve and return the value of a mote frame variable, and return it as a short.

Parameters:
var - variable name to resolve and return
java.io.IOException

getByte

public byte getByte(java.lang.String var)
             throws java.io.IOException
Resolve and return the value of a mote frame variable, and return it as a byte.

Parameters:
var - variable name to resolve and return
java.io.IOException