|
SunSPOT API V4.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.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. |
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 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 RouteTable getRoutingTable()
getRoutingTable in interface IRoutingManager
public boolean findRoute(long address,
RouteEventClient eventClient,
Object uniqueKey)
findRoute in interface IRoutingManageraddress - 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 IRoutingManagerlistener - event listener for callbackspublic void deregisterEventListener(IMHEventListener listener)
deregisterEventListener in interface IRoutingManagerlistener - the listener to remove
public boolean invalidateRoute(long originator,
long destination)
invalidateRoute in interface IRoutingManageroriginator - node that requested the routedestination - route destination address
public void initialize(long ourAddress,
ILowPan lowPanLayer)
initialize in interface IRoutingManagerourAddress - address used by this LowPan layerlowPanLayer - a reference to the lowpan layerpublic RouteInfo getRouteInfo(long address)
getRouteInfo in interface IRoutingManageraddress - destination address of route
public void setServiceName(String who)
IService
setServiceName in interface IServicewho - the name for this servicepublic void setEnabled(boolean enable)
IService
setEnabled in interface IServiceenable - true if the service should be started automatically on rebootpublic boolean stop()
IService
stop in interface IServicepublic boolean start()
IService
start in interface IServicepublic boolean resume()
IService
resume in interface IServicepublic boolean pause()
IService
pause in interface IServicepublic boolean isRunning()
IService
isRunning in interface IServicepublic int getStatus()
IService
getStatus in interface IServicepublic String getServiceName()
IService
getServiceName in interface IServicepublic boolean getEnabled()
IService
getEnabled in interface IService
|
SunSPOT API V4.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||