|
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.LowPan
public class LowPan
Packet processing layer based on the low pan draft. Provides link layer fragmentation and mesh routing in cooperation with a routing manager.
Field Summary |
---|
Fields inherited from interface com.sun.spot.peripheral.radio.ILowPan |
---|
DEFAULT_HOPS, MAC_PAYLOAD_OFFSET, MAX_MAC_PAYLOAD_OFFSET |
Constructor Summary | |
---|---|
protected |
LowPan(long ourAddress,
IRoutingManager aodvManager,
IRadioPacketDispatcher radioPacketDispatcher)
protected constructor for the instantiation of the singleton |
Method Summary | |
---|---|
void |
deregisterDataEventListener(IDataEventListener listener)
Undo a previous call of registerDataEventListener() |
void |
deregisterProtocol(byte protocolNum)
Deregister a protocol. |
void |
deregisterProtocolFamily(byte protocolFamily)
Deregister a protocol family. |
void |
deregisterRouteEventListener(IRouteEventListener listener)
Undo a previous call of registerRouteEventListener() |
static ILowPan |
getInstance()
Get the instance of this singleton. |
IService |
getNetManager()
returns a handle to the netmanagement object |
IRoutingManager |
getRoutingManager()
returns a handle to the routing manager object |
IRoutingPolicyManager |
getRoutingPolicyManager()
returns a handle to the RoutingPolicyManager object |
LowPanStats |
getStatistics()
return a copy of the lowpan statistics object |
void |
receive(RadioPacket packet)
This method is called by the packet dispatcher this low pan layer is registered with. |
void |
registerDataEventListener(IDataEventListener dataListener)
Register to be notified as soon as the LowPan module forwards data. |
void |
registerMHEventListener(IMHEventListener mhListener)
Register to be notified when certain multihop routing events occur. |
void |
registerProtocol(byte protocolNum,
IProtocolManager protocolMan)
Register a protocol manager to send and receive packets |
void |
registerProtocolFamily(byte protocolFamily,
IProtocolManager protocolMan)
Register a protocol manager to send and receive packets |
void |
registerRouteEventListener(IRouteEventListener routeListener)
Register to be notified when certain routing events occur. |
void |
routeFound(RouteInfo info,
Object uniqueKey)
This method is called by the routing manager as soon as a route is available or if no route has been found within the defined period. |
long |
send(byte protocolFamily,
byte protocolNum,
long toAddress,
byte[] buffer,
int startOffset,
int endOffset)
Send a byte buffer on a given protocol. |
boolean |
send(byte protocolFamily,
byte protocolNum,
long toAddress,
byte[] buffer,
int startOffset,
int endOffset,
boolean failIfNotSingleHop)
Send a byte buffer on a given protocol. |
long |
sendBroadcast(byte protocolNum,
byte[] buffer,
int startOffset,
int endOffset,
int hops)
send a LowPan packet using 802.15.4 broadcast packets |
void |
sendWithoutMeshingOrFragmentation(byte protocolNum,
long toAddress,
byte[] buffer,
int startOffset,
int endOffset)
Sends a packet over a single hop. |
void |
setOurAddress(long addr)
set the IEEE Address for which we process packets |
IRoutingManager |
setRoutingManager(IRoutingManager newRoutingManager)
Replace the routing manager with a different implemenation |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected LowPan(long ourAddress, IRoutingManager aodvManager, IRadioPacketDispatcher radioPacketDispatcher)
ourAddress
- MAC address we generate packets from/answer foraodvManager
- the routing manager used for mesh routingradioPacketDispatcher
- The underlying object that transmits and received 802.15.4 radio packetsMethod Detail |
---|
public static ILowPan getInstance()
public IRoutingManager setRoutingManager(IRoutingManager newRoutingManager)
setRoutingManager
in interface ILowPan
newRoutingManager
- a new routing manager
public void registerProtocolFamily(byte protocolFamily, IProtocolManager protocolMan)
registerProtocolFamily
in interface ILowPan
protocolFamily
- protocol family this protocol is in (ie IPv6, SunSPOT, etc)protocolMan
- the protocol manager to be registeredpublic void registerProtocol(byte protocolNum, IProtocolManager protocolMan)
registerProtocol
in interface ILowPan
protocolNum
- number of protocol to be handledprotocolMan
- the protocol manager to be registeredpublic void deregisterProtocol(byte protocolNum)
deregisterProtocol
in interface ILowPan
protocolNum
- identifier for the protocolpublic void deregisterProtocolFamily(byte protocolFamily)
deregisterProtocolFamily
in interface ILowPan
protocolFamily
- identifier for the protocolpublic void registerDataEventListener(IDataEventListener dataListener)
registerDataEventListener
in interface ILowPan
dataListener
- the class that wants to be called backpublic void registerRouteEventListener(IRouteEventListener routeListener)
registerRouteEventListener
in interface ILowPan
routeListener
- the class that wants to be called backpublic void registerMHEventListener(IMHEventListener mhListener)
registerMHEventListener
in interface ILowPan
mhListener
- the class that wants to be called backpublic void deregisterDataEventListener(IDataEventListener listener)
deregisterDataEventListener
in interface ILowPan
listener
- the class that wants to be deregisteredpublic void deregisterRouteEventListener(IRouteEventListener listener)
listener
- the class that wants to be deregisteredpublic void routeFound(RouteInfo info, Object uniqueKey)
routeFound
in interface RouteEventClient
info
- object containg routing informationuniqueKey
- a key that uniquely identifies the routepublic void receive(RadioPacket packet) throws ChannelBusyException, NoRouteException
receive
in interface ILowPan
packet
- packet that was received by the underlying radio
ChannelBusyException
- the radio was busy/in-use
NoRouteException
- a mesh route could not be found to the next hop for the received packetpublic IRoutingManager getRoutingManager()
getRoutingManager
in interface ILowPan
public IService getNetManager()
public IRoutingPolicyManager getRoutingPolicyManager()
public long send(byte protocolFamily, byte protocolNum, long toAddress, byte[] buffer, int startOffset, int endOffset) throws ChannelBusyException, NoRouteException
ILowPan
send
in interface ILowPan
protocolFamily
- the protocol family associated with the outgoing packetprotocolNum
- the protocol number associated with the outgoing packettoAddress
- the destinationbuffer
- byte array that holds the data to be sentstartOffset
- offset within the byte array at which data should be readendOffset
- offset within the byte array after which data
should not be read
ChannelBusyException
- the radio channel could not be accessed
NoRouteException
- a route to the destination could not be foundpublic boolean send(byte protocolFamily, byte protocolNum, long toAddress, byte[] buffer, int startOffset, int endOffset, boolean failIfNotSingleHop) throws ChannelBusyException, NoRouteException
ILowPan
send
in interface ILowPan
protocolFamily
- the protocol family associated with the outgoing packetprotocolNum
- the protocol number associated with the outgoing packettoAddress
- the destinationbuffer
- byte array that holds the data to be sentstartOffset
- offset within the byte array at which data should be readendOffset
- offset within the byte array after which data
should not be readfailIfNotSingleHop
- if true this method should not send if not single hop.
ChannelBusyException
- the radio channel could not be accessed
NoRouteException
- a route to the destination could not be foundpublic void sendWithoutMeshingOrFragmentation(byte protocolNum, long toAddress, byte[] buffer, int startOffset, int endOffset) throws NoAckException, ChannelBusyException
sendWithoutMeshingOrFragmentation
in interface ILowPan
protocolNum
- SPOT protocol numbertoAddress
- destination address for this packetbuffer
- the data buffer being sentstartOffset
- start index for data to be sentendOffset
- end index of data from buffer to be sent
NoAckException
- receiving end did not generate the 802.15.4 layer ACK for this packet
ChannelBusyException
- radio was busy/in-usepublic long sendBroadcast(byte protocolNum, byte[] buffer, int startOffset, int endOffset, int hops) throws ChannelBusyException
sendBroadcast
in interface ILowPan
protocolNum
- The SPOT prootocol number of the packetbuffer
- data buffer to sendstartOffset
- start of data buffer to sendendOffset
- end index of data buffer to sendhops
- maximum number of hops this LowPan packet should be passed within a mesh routed environment
ChannelBusyException
- radio channel was busy/in-usepublic void setOurAddress(long addr)
setOurAddress
in interface ILowPan
addr
- our IEEE Address as a longpublic LowPanStats getStatistics()
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |