SunSPOT API V3.0


com.sun.spot.peripheral.radio
Interface ILowPan

All Known Implementing Classes:
LowPan

public interface ILowPan

Interface that specifies the minimum functionality offered by a layer that implements the LowPan specification

Version:
0.1
Author:
Allen Ajit George

Field Summary
static byte DEFAULT_HOPS
          default number of hops a routed packet should make
static byte MAC_PAYLOAD_OFFSET
          Minimum length of the LowPan header
static byte MAX_MAC_PAYLOAD_OFFSET
          normal length of a MESHED LowPan Packet, not counting broadcast or fragmentation
 
Method Summary
 void deregisterDataEventListener(IDataEventListener listener)
          Deregisters an application etc. that is called back when data is forwarded
 void deregisterProtocol(byte protocolNum)
          Deregisters the protocol manager that handles the specifies protocol manager
 void deregisterProtocolFamily(byte protocolFamily)
          Deregisters the protocol manager that handles the specifies protocol manager
 IRoutingManager getRoutingManager()
          Get the routing manager
 void receive(RadioPacket packet)
          Method called by INewpacketDispatcher when a packet is received
 void registerDataEventListener(IDataEventListener listener)
          Registers an application etc. that is notified when this node is used to forward a data packet
 void registerMHEventListener(IMHEventListener listener)
          Registers an application etc. that is notified when this node initiates/receives supported route events
 void registerProtocol(byte protocolNum, IProtocolManager protocolMan)
          Register protocol managers that send/receive data encoded using the specified protocol number, within the specified family.
 void registerProtocolFamily(byte protocolFamily, IProtocolManager protocolMan)
          Register protocol managers that send/receive data encoded for all protocols in a given family.
 void registerRouteEventListener(IRouteEventListener listener)
          Registers an application etc. that is notified when this node initiates/receives supported route events
 long send(byte protocolFamily, byte protocolNum, long toAddress, byte[] payload, int startOffset, int endOffset)
          Send a byte buffer on a given protocol.
 boolean send(byte protocolFamily, byte protocolNum, long toAddress, byte[] payload, 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)
          Broadcast a byte buffer on a given protocol, without any attempt at meshing (can be fragmented)
 void sendWithoutMeshingOrFragmentation(byte protocolNum, long toAddress, byte[] buffer, int startOffset, int endOffset)
          Send a byte buffer on a given protocol, without any attempt at meshing or fragmentation
 void setOurAddress(long addr)
          Method called by RadioPacketDispatcher on a host.
 IRoutingManager setRoutingManager(IRoutingManager newRoutingManager)
          Replace the routing manager with a different implemenation
 

Field Detail

MAC_PAYLOAD_OFFSET

static final byte MAC_PAYLOAD_OFFSET
Minimum length of the LowPan header

See Also:
Constant Field Values

DEFAULT_HOPS

static final byte DEFAULT_HOPS
default number of hops a routed packet should make

See Also:
Constant Field Values

MAX_MAC_PAYLOAD_OFFSET

static final byte MAX_MAC_PAYLOAD_OFFSET
normal length of a MESHED LowPan Packet, not counting broadcast or fragmentation

See Also:
Constant Field Values
Method Detail

registerProtocolFamily

void registerProtocolFamily(byte protocolFamily,
                            IProtocolManager protocolMan)
Register protocol managers that send/receive data encoded for all protocols in a given family. Protocol Family numbers map to 6lowpan protocol dispatch numbers

Parameters:
protocolFamily - mily to which this protocol belongs. This should map to a 6lowpan protocol dispatch such as IPv6, etc.
protocolMan - protocol manager that will handle messages encoded using this protocol number

registerProtocol

void registerProtocol(byte protocolNum,
                      IProtocolManager protocolMan)
Register protocol managers that send/receive data encoded using the specified protocol number, within the specified family.

Parameters:
protocolNum - unique number to identify the protocol (0...255).
protocolMan - protocol manager that will handle messages encoded using this protocol number

deregisterProtocolFamily

void deregisterProtocolFamily(byte protocolFamily)
Deregisters the protocol manager that handles the specifies protocol manager

Parameters:
protocolFamily - family to which this protocol belongs. This should map to a 6lowpan protocol dispatch such as IPv6, etc.

deregisterProtocol

void deregisterProtocol(byte protocolNum)
Deregisters the protocol manager that handles the specifies protocol manager

Parameters:
protocolNum - unique number to identify the protocol (0...255).

registerDataEventListener

void registerDataEventListener(IDataEventListener listener)
Registers an application etc. that is notified when this node is used to forward a data packet

Parameters:
listener - object that is notified when data is forwarded

registerRouteEventListener

void registerRouteEventListener(IRouteEventListener listener)
Registers an application etc. that is notified when this node initiates/receives supported route events

Parameters:
listener - object that is notified when route events occur

registerMHEventListener

void registerMHEventListener(IMHEventListener listener)
Registers an application etc. that is notified when this node initiates/receives supported route events

Parameters:
listener - object that is notified when route events occur

deregisterDataEventListener

void deregisterDataEventListener(IDataEventListener listener)
Deregisters an application etc. that is called back when data is forwarded

Parameters:
listener - object that is notified when data is forwarded

send

boolean send(byte protocolFamily,
             byte protocolNum,
             long toAddress,
             byte[] payload,
             int startOffset,
             int endOffset,
             boolean failIfNotSingleHop)
             throws ChannelBusyException,
                    NoRouteException
Send a byte buffer on a given protocol. The caller simply supplied a byte payload

Parameters:
protocolFamily - the protocol family associated with the outgoing packet
protocolNum - the protocol number associated with the outgoing packet
toAddress - the destination
payload - byte array that holds the data to be sent
startOffset - offset within the byte array at which data should be read
endOffset - offset within the byte array after which data should not be read
failIfNotSingleHop - if true this method should not send if not single hop.
Returns:
true if the buffer was sent
Throws:
ChannelBusyException - the radio channel could not be accessed
NoRouteException - a route to the destination could not be found

send

long send(byte protocolFamily,
          byte protocolNum,
          long toAddress,
          byte[] payload,
          int startOffset,
          int endOffset)
          throws ChannelBusyException,
                 NoRouteException
Send a byte buffer on a given protocol. The caller simply supplied a byte payload

Parameters:
protocolFamily - the protocol family associated with the outgoing packet
protocolNum - the protocol number associated with the outgoing packet
toAddress - the destination
payload - byte array that holds the data to be sent
startOffset - offset within the byte array at which data should be read
endOffset - offset within the byte array after which data should not be read
Returns:
the time at which the data was sent
Throws:
ChannelBusyException - the radio channel could not be accessed
NoRouteException - a route to the destination could not be found

sendWithoutMeshingOrFragmentation

void sendWithoutMeshingOrFragmentation(byte protocolNum,
                                       long toAddress,
                                       byte[] buffer,
                                       int startOffset,
                                       int endOffset)
                                       throws NoAckException,
                                              ChannelBusyException
Send a byte buffer on a given protocol, without any attempt at meshing or fragmentation

Parameters:
protocolNum - higher level protocol number (for port based protocol manager)
toAddress - address of the remote device for radio packet
buffer - data buffer to be sent
startOffset - index of first byte of data to be sent from the buffer
endOffset - index of the last byte of data to be sent
Throws:
NoAckException - Ack was expected but not received
ChannelBusyException - radio channel was busy when send was attempted

sendBroadcast

long sendBroadcast(byte protocolNum,
                   byte[] buffer,
                   int startOffset,
                   int endOffset,
                   int hops)
                   throws ChannelBusyException
Broadcast a byte buffer on a given protocol, without any attempt at meshing (can be fragmented)

Parameters:
protocolNum - higher level protocol number (for port based protocol manager)
buffer - data buffer to be sent
startOffset - index of first byte of data to be sent from the buffer
endOffset - index of the last byte of data to be sent
hops - number of mesh hops this broadcast should take
Returns:
the time at which the data was sent
Throws:
ChannelBusyException - radio channel was busy when send attempted

receive

void receive(RadioPacket packet)
             throws ChannelBusyException,
                    NoRouteException
Method called by INewpacketDispatcher when a packet is received

Parameters:
packet - packet received over the radio
Throws:
ChannelBusyException - channel was busy when access was attempted
NoRouteException - No route could be found to the destination

setOurAddress

void setOurAddress(long addr)
Method called by RadioPacketDispatcher on a host. The low pan needs to use the basestations ieee address.

Parameters:
addr - 64-bit value representing our IEEE address

getRoutingManager

IRoutingManager getRoutingManager()
Get the routing manager

Returns:
the routing manager

setRoutingManager

IRoutingManager setRoutingManager(IRoutingManager newRoutingManager)
Replace the routing manager with a different implemenation

Parameters:
newRoutingManager - a new routing manager
Returns:
the old routing manager

SunSPOT API V3.0


Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.