moteaccess
Class DummyMoteAccess

java.lang.Object
  extended bymoteaccess.DummyMoteAccess
All Implemented Interfaces:
IMoteAccess

public class DummyMoteAccess
extends java.lang.Object
implements IMoteAccess


Nested Class Summary
private  class DummyMoteAccess.Timer
           
 
Field Summary
(package private)  int epoch
           
(package private)  int num_req
           
(package private)  java.util.Random rand
           
(package private)  java.util.Vector requesters
           
(package private)  java.util.Vector requests
           
(package private)  boolean stopReaction
           
(package private)  int timeout
           
(package private)  DummyMoteAccess.Timer timer
           
 
Fields inherited from interface moteaccess.IMoteAccess
DEFAULT_SENSING_TIMEOUT_SECS
 
Constructor Summary
DummyMoteAccess()
           
 
Method Summary
 void doRead(RequestID r, MoteRequest mr, IMoteListener ml)
          Roughly simulate the behaviour of a correct doRead of a IMoteAccess.
 void injectReaction(RequestID r, MoteReaction mr, IMoteListener ml)
          Emulate the behaviour of an injectReaction
 boolean setParameter(java.lang.String parameter, int value)
          Method by which parameters at the MoteAccess level can be set.
 void stopOperation(RequestID rid)
          Method used to stop a running operation, i.e.
private  void timeElapsed(IMoteListener ml)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

requests

java.util.Vector requests

requesters

java.util.Vector requesters

timeout

int timeout

num_req

int num_req

epoch

int epoch

timer

DummyMoteAccess.Timer timer

rand

java.util.Random rand

stopReaction

boolean stopReaction
Constructor Detail

DummyMoteAccess

public DummyMoteAccess()
Method Detail

doRead

public void doRead(RequestID r,
                   MoteRequest mr,
                   IMoteListener ml)
Roughly simulate the behaviour of a correct doRead of a IMoteAccess. The rdg operation is not stopable as it should be in a real MoteAccess

Specified by:
doRead in interface IMoteAccess
Parameters:
r - : the RequestID that the client application has generated.
mr - : the MoteRequest object describing the desired reading.
ml - : reference to the IMoteListener implementation to be notified of incoming results.

stopOperation

public void stopOperation(RequestID rid)
Description copied from interface: IMoteAccess
Method used to stop a running operation, i.e. a reading or a reaction.

Specified by:
stopOperation in interface IMoteAccess
Parameters:
rid - : the RequestID identifying the operation to be stopped.

injectReaction

public void injectReaction(RequestID r,
                           MoteReaction mr,
                           IMoteListener ml)
Emulate the behaviour of an injectReaction

Specified by:
injectReaction in interface IMoteAccess
Parameters:
r - : the RequestID that the client application has generated.
mr - : the MoteReaction object describing the desired reaction.
ml - : reference to the IMoteListener implementation to be notified of incoming results.

timeElapsed

private void timeElapsed(IMoteListener ml)

setParameter

public boolean setParameter(java.lang.String parameter,
                            int value)
Description copied from interface: IMoteAccess
Method by which parameters at the MoteAccess level can be set.

Specified by:
setParameter in interface IMoteAccess
Parameters:
parameter - String identifying the parameter to be modified
value - integer to which the parameter has to be set.
Returns:
boolean indicating wheter the update has taken place or not