lime.motes
Class LimeMoteRequest

java.lang.Object
  extended bymoteaccess.MoteRequest
      extended bylime.motes.LimeMoteRequest

public class LimeMoteRequest
extends MoteRequest

This class is used to call a read on the MoteAccess. It inherits moteaccess.MoteRequest just adding the fromTuple method.

Version:
1.0 alpha
Author:
Carlo Curino, Matteo Giani, Marco Giorgetta, Alessandro Giusti
See Also:
LimeMoteReaction, MoteRequest

Field Summary
 
Fields inherited from class moteaccess.MoteRequest
moteID, sensorType, timedMode
 
Constructor Summary
LimeMoteRequest(MoteID mid, SensorType stype, java.lang.Boolean reqmode)
          Public constructor that simply calls moteaccess.MoteRequest constructor.
 
Method Summary
static LimeMoteRequest fromAggrTuple(lights.interfaces.ITuple tuple)
          This method is used to build a LimeMoteRequest from a tuple of an aggregation request.
static LimeMoteRequest fromTuple(lights.interfaces.ITuple tuple)
          This method is used to build a LimeMoteRequest from a tuple.
 
Methods inherited from class moteaccess.MoteRequest
getMoteID, getSensorType, isTimed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LimeMoteRequest

public LimeMoteRequest(MoteID mid,
                       SensorType stype,
                       java.lang.Boolean reqmode)
Public constructor that simply calls moteaccess.MoteRequest constructor.

Parameters:
mid - the mote id, which can be left unspecified.
stype - the type of the sensor, which can be left unspecified.
reqmode - the mode of the request, that indicates a normal read if false, and a readg if true.
Method Detail

fromTuple

public static LimeMoteRequest fromTuple(lights.interfaces.ITuple tuple)
                                 throws BadRequestFormatException
This method is used to build a LimeMoteRequest from a tuple. It is useful because if the request has been received via lime as a configuration tuple the programmer can easily build the request from the tuple.

Parameters:
tuple - the configuration tuple the request is build on.
Returns:
a LimeMoteRequest constructed on the tuple.
Throws:
BadRequestFormatException - thrown when the configuration tuple passed as parameter has not a correct pattern.

fromAggrTuple

public static LimeMoteRequest fromAggrTuple(lights.interfaces.ITuple tuple)
                                     throws BadRequestFormatException
This method is used to build a LimeMoteRequest from a tuple of an aggregation request.

Parameters:
tuple - the configuration tuple the request is build on.
Returns:
a LimeMoteRequest constructed on the tuple.
Throws:
BadRequestFormatException - thrown when the configuration tuple passed as parameter has not a correct pattern.