|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.spot.peripheral.radio.shrp.SingleHopManager
public class SingleHopManager
The single hop routing modules makes all nodes look like they are 1 hop away. If a route is invalidated 3 times, we throw a noRouteException, meaning a node is probably not actually 1 hop away. Since A RouteInfo object is never freed we must create one the first time it is requested. We then store that reference in a Hashtable. The next time it is requested, we returned the caches RouteInfo object. The intention is that this will minimize garbage collection, as well as serve as a sample for writing simple routing managers.
Field Summary |
---|
Fields inherited from interface com.sun.spot.service.IService |
---|
PAUSED, PAUSING, RESUMING, RUNNING, STARTING, STOPPED, STOPPING |
Constructor Summary | |
---|---|
SingleHopManager()
Creates a new instance of SingleHopManager The SingleHopManager can be used by the LowPan layer to limit communications to nodes within a single radio hop away. |
Method Summary | |
---|---|
void |
deregisterEventListener(IMHEventListener listener)
deregisters a listener for routing messages. |
boolean |
findRoute(long address,
RouteEventClient eventClient,
Object uniqueKey)
lookup a route to this address. |
boolean |
getEnabled()
Return whether service is started automatically on reboot. |
RouteInfo |
getRouteInfo(long address)
retrieve routing information for a destination address. |
String |
getServiceName()
Return the name of this service. |
int |
getStatus()
Return the current status of this service. |
void |
initialize(long ourAddress,
ILowPan lowPanLayer)
setup this routing manager for use. |
boolean |
invalidateRoute(long originator,
long destination)
Nodes are always 1 hop away. |
boolean |
isRunning()
Return whether the service is currently running. |
boolean |
pause()
Pause the service, and return whether successful. |
void |
registerEventListener(IMHEventListener listener)
registers a listener for routing messages. |
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 |
Constructor Detail |
---|
public SingleHopManager()
Method Detail |
---|
public boolean findRoute(long address, RouteEventClient eventClient, Object uniqueKey)
findRoute
in interface IRoutingManager
address
- the destination address we are looking foreventClient
- client to be called back with the routing informationuniqueKey
- a key that uniquely identifies this request/client
public void registerEventListener(IMHEventListener listener)
registerEventListener
in interface IRoutingManager
listener
- event listener for callbackspublic void deregisterEventListener(IMHEventListener listener)
deregisterEventListener
in interface IRoutingManager
listener
- the listener to removepublic boolean invalidateRoute(long originator, long destination)
invalidateRoute
in interface IRoutingManager
originator
- node that requested the routedestination
- route destination address
public void initialize(long ourAddress, ILowPan lowPanLayer)
initialize
in interface IRoutingManager
ourAddress
- address used by this LowPan layerlowPanLayer
- a reference to the lowpan layerpublic RouteInfo getRouteInfo(long address)
getRouteInfo
in interface IRoutingManager
address
- destination address of route
public void setServiceName(String who)
IService
setServiceName
in interface IService
who
- the name for this servicepublic void setEnabled(boolean enable)
IService
setEnabled
in interface IService
enable
- true if the service should be started automatically on rebootpublic boolean stop()
IService
stop
in interface IService
public boolean start()
IService
start
in interface IService
public boolean resume()
IService
resume
in interface IService
public boolean pause()
IService
pause
in interface IService
public boolean isRunning()
IService
isRunning
in interface IService
public int getStatus()
IService
getStatus
in interface IService
public String getServiceName()
IService
getServiceName
in interface IService
public boolean getEnabled()
IService
getEnabled
in interface IService
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |