SunSPOT API V3.0


com.sun.spot.peripheral.radio
Class RadiogramProtocolManager

java.lang.Object
  extended by com.sun.spot.peripheral.radio.RadioProtocolManager
      extended by com.sun.spot.peripheral.radio.RadiogramProtocolManager
All Implemented Interfaces:
IProtocolManager, IRadiogramProtocolManager, IRadioProtocolManager

public class RadiogramProtocolManager
extends RadioProtocolManager
implements IProtocolManager, IRadiogramProtocolManager


Field Summary
static String PROTOCOL_NAME
           
static byte PROTOCOL_NUMBER
           
 
Fields inherited from interface com.sun.spot.peripheral.radio.IRadiogramProtocolManager
BROADCAST, DATA_OFFSET, SERVER
 
Fields inherited from interface com.sun.spot.peripheral.radio.IRadioProtocolManager
FIRST_USER_PORT, INPUT, OUTPUT, PORT_OFFSET
 
Constructor Summary
RadiogramProtocolManager()
          Construct an instance to manage the given protocol number.
 
Method Summary
 ConnectionID addBroadcastConnection(byte portNo)
          Register a broadcast connection
 ConnectionID addServerConnection(byte portNo)
          Register a server connection
static IRadiogramProtocolManager getInstance()
           
 String getName()
           
static void main(String[] args)
           
 void processIncomingData(byte[] payload, LowPanHeaderInfo headerInfo)
          Called whenever data is received that is addressed to this IProtocolManager.
 long send(ConnectionID cid, long toAddress, byte[] payload, int length)
          Send a byte array using a ConnectionID.
 
Methods inherited from class com.sun.spot.peripheral.radio.RadioProtocolManager
addConnection, addInputConnection, addOutputConnection, closeConnection, getConnectionState, packetsAvailable, receivePacket, receivePacket
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.spot.peripheral.radio.IRadioProtocolManager
addInputConnection, addOutputConnection, closeConnection, packetsAvailable, receivePacket, receivePacket
 

Field Detail

PROTOCOL_NUMBER

public static final byte PROTOCOL_NUMBER
See Also:
Constant Field Values

PROTOCOL_NAME

public static final String PROTOCOL_NAME
See Also:
Constant Field Values
Constructor Detail

RadiogramProtocolManager

public RadiogramProtocolManager()
Construct an instance to manage the given protocol number.

Method Detail

main

public static void main(String[] args)

getInstance

public static IRadiogramProtocolManager getInstance()

send

public long send(ConnectionID cid,
                 long toAddress,
                 byte[] payload,
                 int length)
          throws NoAckException,
                 ChannelBusyException,
                 NoRouteException
Description copied from interface: IRadioProtocolManager
Send a byte array using a ConnectionID. The client code should leave IPortBasedProtocolManager.DATA_OFFSET bytes free at the front of their payload as these will be overwritten.

Specified by:
send in interface IRadioProtocolManager
Parameters:
cid - the ConnectionID to send the packet over.
payload - the data
length - number of bytes to send, starting with index 0
Returns:
the time at which the data was sent
Throws:
NoAckException
ChannelBusyException
NoRouteException

processIncomingData

public void processIncomingData(byte[] payload,
                                LowPanHeaderInfo headerInfo)
Description copied from interface: IProtocolManager
Called whenever data is received that is addressed to this IProtocolManager. IProtocolManagers should do as little processing as possible inside this method, to avoid blocking other INewProtocolManagers from receiving their packets. Typically an IProtocolManager will queue received packets for later dispatch to applications.

Specified by:
processIncomingData in interface IProtocolManager

getName

public String getName()
Specified by:
getName in class RadioProtocolManager

addServerConnection

public ConnectionID addServerConnection(byte portNo)
Description copied from interface: IRadiogramProtocolManager
Register a server connection

Specified by:
addServerConnection in interface IRadiogramProtocolManager
Parameters:
portNo - - port number to communicate over
Returns:
resultant ConnectionID

addBroadcastConnection

public ConnectionID addBroadcastConnection(byte portNo)
Description copied from interface: IRadiogramProtocolManager
Register a broadcast connection

Specified by:
addBroadcastConnection in interface IRadiogramProtocolManager
Parameters:
portNo - - port number to communicate over
Returns:
resultant ConnectionID

SunSPOT API V3.0


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