SunSPOT API V5.0


com.sun.spot.peripheral.radio
Class RadioPacketDispatcher

java.lang.Object
  extended by com.sun.spot.service.BasicService
      extended by com.sun.spot.peripheral.radio.RadioPacketDispatcher
All Implemented Interfaces:
IRadioPacketDispatcher, IService

public class RadioPacketDispatcher
extends BasicService
implements IRadioPacketDispatcher

Implements IRadioPacketDispatcher for the Spot environment.

Author:
Pete St. Pierre, refactored from original LowPanPacketDispatcher by Jochen Furthmueller.

Field Summary
 
Fields inherited from interface com.sun.spot.service.IService
PAUSED, PAUSING, READY, RESUMING, RUNNING, STARTING, STOPPED, STOPPING
 
Method Summary
 void addPacketQualityListener(IPacketQualityListener packetListener)
          Register to be notified with Link Quality information.
 void deregisterPacketQualityListener(IPacketQualityListener listener)
          Undo a previous call of registerPacketListener()
static IRadioPacketDispatcher getInstance()
          Return the singleton instance of RadioPacketDispatcher.
 String getServiceName()
          Return the name of this service.
 void initialize(ILowPan lowPanLayer)
          Called by LowPan to initialize the dispatcher.
 void registerPacketQualityListener(IPacketQualityListener packetListener)
          Register to be notified with Link Quality information.
 void removePacketQualityListener(IPacketQualityListener listener)
          Undo a previous call of registerPacketListener()
 void sendBroadcast(RadioPacket rp)
          Broadcast a packet.
 void sendPacket(RadioPacket rp)
          Send a packet.
 
Methods inherited from class com.sun.spot.service.BasicService
getEnabled, getStatus, isRunning, pause, resume, setEnabled, setServiceName, start, stop
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static IRadioPacketDispatcher getInstance()
Return the singleton instance of RadioPacketDispatcher.

Returns:
the instance

getServiceName

public String getServiceName()
Description copied from interface: IService
Return the name of this service.

Specified by:
getServiceName in interface IService
Specified by:
getServiceName in class BasicService
Returns:
the name of this service

registerPacketQualityListener

public void registerPacketQualityListener(IPacketQualityListener packetListener)
Register to be notified with Link Quality information.

Specified by:
registerPacketQualityListener in interface IRadioPacketDispatcher
Parameters:
packetListener - the class that wants to be called back

deregisterPacketQualityListener

public void deregisterPacketQualityListener(IPacketQualityListener listener)
Undo a previous call of registerPacketListener()

Specified by:
deregisterPacketQualityListener in interface IRadioPacketDispatcher
Parameters:
listener - the class that wants to be deregistered

addPacketQualityListener

public void addPacketQualityListener(IPacketQualityListener packetListener)
Register to be notified with Link Quality information.

Specified by:
addPacketQualityListener in interface IRadioPacketDispatcher
Parameters:
packetListener - the class that wants to be called back

removePacketQualityListener

public void removePacketQualityListener(IPacketQualityListener listener)
Undo a previous call of registerPacketListener()

Specified by:
removePacketQualityListener in interface IRadioPacketDispatcher
Parameters:
listener - the class that wants to be deregistered

sendBroadcast

public void sendBroadcast(RadioPacket rp)
                   throws NoAckException,
                          ChannelBusyException
Broadcast a packet. Called from sendPacket if destination is a broadcast or unknown

Parameters:
rp -
Throws:
NoAckException
ChannelBusyException

sendPacket

public void sendPacket(RadioPacket rp)
                throws NoAckException,
                       ChannelBusyException
Send a packet. Is called by the low pan layer

Specified by:
sendPacket in interface IRadioPacketDispatcher
Parameters:
rp -
Throws:
NoAckException
ChannelBusyException

initialize

public void initialize(ILowPan lowPanLayer)
Called by LowPan to initialize the dispatcher. Note: This is only called after LowPan is completely started up. This method is there to prevent cycles in the initialization process

Specified by:
initialize in interface IRadioPacketDispatcher
Parameters:
lowPanLayer - reference to the fully started LowPan instance

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.