SunSPOT API V5.0


com.sun.spot.peripheral.radio.mhrp.lqrp
Class LQRPManager

java.lang.Object
  extended by com.sun.spot.peripheral.radio.mhrp.lqrp.LQRPManager
All Implemented Interfaces:
IRoutingManager, IService

public class LQRPManager
extends Object
implements IRoutingManager

Version:
0.1
Author:
Allen Ajit George, modification by Pradip De and Pete St. Pierre

Field Summary
 
Fields inherited from interface com.sun.spot.service.IService
PAUSED, PAUSING, READY, RESUMING, RUNNING, STARTING, STOPPED, STOPPING
 
Method Summary
 void addEventListener(IMHEventListener listener)
          Registers an application etc. that is notified when this node processes supported route events
 void addLQRPListener(ILQRPEventListener listener)
          Registers an application etc. that is notified when this node processes supported route events
 void deregisterEventListener(IMHEventListener listener)
          Deprecated. replaced by removeEventListener
 void deregisterLQRPListener(ILQRPEventListener listener)
          Deprecated. replaced by removeLQRPListener
 void enableAdvertising(boolean enable)
          Control if an advertising thread will be run.
 boolean findRoute(long address, RouteEventClient eventClient, Object uniqueKey)
          This method triggers a new route request.
 int getCurrentSequenceNumber()
           
 boolean getEnabled()
          Return whether service is started automatically on reboot.
static LQRPManager getInstance()
           
 NodeLifeAndLinkMonitor getLinkMonitor()
           
 int getNextSequenceNumber()
          This method creates new sequence numbers.
 int getNextSequenceNumber(int givenNumber)
          This method creates new sequence numbers.
 RouteInfo getRouteInfo(long address)
          This method is called to obtain a route info, and to refreshen a route whenever it is used
 RouteTable getRoutingTable()
          This method returns a snapshot of the routing table
 String getServiceName()
          Return the name of this service.
 int getStatus()
          Return the current status of this service.
 void initialize(long ourAddress, ILowPan lowPan)
          initializes this routing manager by starting the sender and receiver threads
 boolean initiateRouteDiscovery(long address)
           
 boolean invalidateRoute(long originator, long destination)
          This method is called when it is recognized that the route is broken somewhere.
 boolean isRunning()
          Return whether the service is currently running.
 boolean pause()
          Pause the service, and return whether successful.
 void registerEventListener(IMHEventListener listener)
          Deprecated. replaced by addEventListener
 void registerLQRPListener(ILQRPEventListener listener)
          Deprecated. replaced by addLQRPListener
 void removeEventListener(IMHEventListener listener)
          Deregisters an application etc. that was registered for route events
 void removeLQRPListener(ILQRPEventListener listener)
          Deregisters an application etc. that was registered for route events
 boolean resume()
          Resume the service, and return whether successful.
 void setEnabled(boolean enable)
          Enable/disable whether service is started automatically.
 void setServiceName(String who)
          Assign a name to this service.
 boolean start()
          Start the service, and return whether successful.
 boolean stop()
          Stop the service, and return whether successful.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static LQRPManager getInstance()
Returns:
lqrpManager instance of this singleton

initialize

public void initialize(long ourAddress,
                       ILowPan lowPan)
initializes this routing manager by starting the sender and receiver threads

Specified by:
initialize in interface IRoutingManager
Parameters:
lowPan - LowPan layer that is our route client

getRoutingTable

public RouteTable getRoutingTable()
This method returns a snapshot of the routing table

Specified by:
getRoutingTable in interface IRoutingManager

getRouteInfo

public RouteInfo getRouteInfo(long address)
This method is called to obtain a route info, and to refreshen a route whenever it is used

Specified by:
getRouteInfo in interface IRoutingManager
Parameters:
address - destination for which this method returns a route info
Returns:
routeInfo

findRoute

public boolean findRoute(long address,
                         RouteEventClient eventClient,
                         Object uniqueKey)
                  throws NoRouteException
This method triggers a new route request. Note: the radio must be on or no route will be found.

Specified by:
findRoute in interface IRoutingManager
Returns:
true when finished
Throws:
NoRouteException

initiateRouteDiscovery

public boolean initiateRouteDiscovery(long address)

invalidateRoute

public boolean invalidateRoute(long originator,
                               long destination)
This method is called when it is recognized that the route is broken somewhere. The route is marked deactivated and a RERR is being sent.

Specified by:
invalidateRoute in interface IRoutingManager
Returns:
true when finished

addEventListener

public void addEventListener(IMHEventListener listener)
Registers an application etc. that is notified when this node processes supported route events

Specified by:
addEventListener in interface IRoutingManager
Parameters:
listener - object that is notified when route events occur

removeEventListener

public void removeEventListener(IMHEventListener listener)
Deregisters an application etc. that was registered for route events

Specified by:
removeEventListener in interface IRoutingManager
Parameters:
listener - object that is notified when route events occur

registerEventListener

public void registerEventListener(IMHEventListener listener)
Deprecated. replaced by addEventListener

Description copied from interface: IRoutingManager
Registers an application etc. that is notified when this node initiates/receives supported route events

Specified by:
registerEventListener in interface IRoutingManager
Parameters:
listener - object that is notified when route events occur

deregisterEventListener

public void deregisterEventListener(IMHEventListener listener)
Deprecated. replaced by removeEventListener

Description copied from interface: IRoutingManager
Deregisters an application etc. that was registered for route events

Specified by:
deregisterEventListener in interface IRoutingManager
Parameters:
listener - object that is notified when route events occur

addLQRPListener

public void addLQRPListener(ILQRPEventListener listener)
Registers an application etc. that is notified when this node processes supported route events


removeLQRPListener

public void removeLQRPListener(ILQRPEventListener listener)
Deregisters an application etc. that was registered for route events


registerLQRPListener

public void registerLQRPListener(ILQRPEventListener listener)
Deprecated. replaced by addLQRPListener


deregisterLQRPListener

public void deregisterLQRPListener(ILQRPEventListener listener)
Deprecated. replaced by removeLQRPListener


getNextSequenceNumber

public int getNextSequenceNumber()
This method creates new sequence numbers.

Returns:
seqNumber the next sequence number.

getNextSequenceNumber

public int getNextSequenceNumber(int givenNumber)
This method creates new sequence numbers.

Parameters:
givenNumber -
Returns:
seqNumber the next sequence number that is greater or equal than the given number.

getCurrentSequenceNumber

public int getCurrentSequenceNumber()
Returns:
the current sequence number

getLinkMonitor

public NodeLifeAndLinkMonitor getLinkMonitor()

setServiceName

public void setServiceName(String who)
Assign a name to this service. For some fixed services this may not apply and any new name will just be ignored.

Specified by:
setServiceName in interface IService
Parameters:
who - the name for this service

setEnabled

public void setEnabled(boolean enable)
Enable/disable whether service is started automatically. This may not apply to some services and calls to setEnabled() may be ignored.

Specified by:
setEnabled in interface IService
Parameters:
enable - true if the service should be started automatically on reboot

enableAdvertising

public void enableAdvertising(boolean enable)
Control if an advertising thread will be run.

The AODV Routing Manager normally starts up a special thread to periodically send out a route reply message to advertise this nodes presence to its neighbors. If a SPOT application will be deep sleeping it may want to disable this advertising thread, so the SPOT will not wake up every 30 seconds.

Parameters:
enable - true if advertisements should be sent periodically.

stop

public boolean stop()
Stop the service, and return whether successful. Stops all running threads. Closes any open IO connections.

Specified by:
stop in interface IService
Returns:
true if the service was successfully stopped

start

public boolean start()
Start the service, and return whether successful.

Specified by:
start in interface IService
Returns:
true if the service was successfully started

resume

public boolean resume()
Resume the service, and return whether successful. Picks up from state when service was paused. If there was no particular state associated with this service then resume() can be implemented by calling start().

Specified by:
resume in interface IService
Returns:
true if the service was successfully resumed

pause

public boolean pause()
Pause the service, and return whether successful. Preserve any current state, but do not handle new requests. Any running threads should block or sleep. Any open IO connections may be kept open. If there is no particular state associated with this service then pause() can be implemented by calling stop().

Specified by:
pause in interface IService
Returns:
true if the service was successfully paused

isRunning

public boolean isRunning()
Return whether the service is currently running.

Specified by:
isRunning in interface IService
Returns:
true if the service is currently running

getStatus

public int getStatus()
Return the current status of this service.

Specified by:
getStatus in interface IService
Returns:
the current status of this service, e.g. STOPPED, STARTING, RUNNING, PAUSED, STOPPING, etc.

getServiceName

public String getServiceName()
Return the name of this service.

Specified by:
getServiceName in interface IService
Returns:
the name of this service

getEnabled

public boolean getEnabled()
Return whether service is started automatically on reboot. This may not apply to some services and for those services it will always return false.

Specified by:
getEnabled in interface IService
Returns:
true if the service is started automatically on reboot

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.