|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.spot.peripheral.radio.LowPanPacketDispatcher
public class LowPanPacketDispatcher
Implements ILowPanPacketDispatcher for the Spot environment.
| Field Summary | |
|---|---|
protected int |
channelNumber
|
protected I802_15_4_MAC |
macDevice
|
protected boolean |
macStarted
|
protected short |
panId
|
| Fields inherited from interface com.sun.spot.peripheral.radio.ILowPanPacketDispatcher |
|---|
DEFAULT_PAN_ID, LOWPAN_DATA_OFFSET |
| Constructor Summary | |
|---|---|
LowPanPacketDispatcher(I802_15_4_MAC macDevice)
Do not use. |
|
| Method Summary | |
|---|---|
void |
addProtocol(byte protocolNum,
IProtocolManager protocolMan)
Register a protocol to send and receive radio packets. |
void |
closeBaseStation()
Used in the host to close down the base station - a no-op if called on a Spot |
int |
getChannelNumber()
Answer the current channel number (between 11 and 26). |
long |
getIEEEAddress()
|
static ILowPanPacketDispatcher |
getInstance()
Return the singleton instance of LowPanPacketDispatcher. |
protected byte |
getLowPanProtocol(RadioPacket rp)
|
int |
getOutputPower()
Answer the radio output power in decibels. |
short |
getPanId()
Answer the current pan ID. |
protected int |
getPLMETransmitPower()
|
protected IProtocolManager |
getProtocolFor(byte protNum)
Answer the protocol manager handling the given protocol number |
void |
initBaseStation()
Used in the host to initialize the base station - a no-op if called on a Spot |
protected void |
initUsing(I802_15_4_MAC macDevice)
Initialise on a particular MAC device. |
boolean |
isLoggingConnections()
|
static String |
logicalToPhysical(String ieeeAddressString)
Attempt to lookup a SPOT name in the spot.names file - this works only on the host |
protected void |
processIncomingRP(RadioPacket rp)
Process an incoming RadioPacket. |
void |
removeProtocol(byte protocolNum)
Deregister an existing protocol so that it no longer receives radio packets |
void |
sendPacket(byte protocolNum,
RadioPacket rp)
Send a radio packet on a given protocol. |
protected void |
setAsDaemonThread(Thread dispatcherThread)
|
void |
setChannelNumber(int channel)
Set the current channel number (between 11 and 26). |
static void |
setInstance(ILowPanPacketDispatcher lp)
Set the singleton instance of LowPanPacketDispatcher. |
void |
setLogConnections(boolean logConnections)
Select whether connection addition and removal is being logged to System.out |
protected void |
setLowPanProtocol(byte protocolNum,
RadioPacket rp)
|
void |
setOutputPower(int power)
Set the radio output power in decibels (between -32 and +31). |
void |
setPanId(short pid)
Set the pan ID (should not be -1 or -2, which are reserved in the I802.15.4 standard). |
protected void |
setPLMETransmitPower(int power)
|
void |
startMAC()
Start the MAC layer device, if it's not already started. |
void |
turnOffReceiver()
Turn off the radio receiver |
void |
turnOnReceiver()
Turn on the radio receiver |
void |
turnOnReceiver(int period)
Turn on the radio receiver for a fixed period |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected short panId
protected int channelNumber
protected boolean macStarted
protected I802_15_4_MAC macDevice
| Constructor Detail |
|---|
public LowPanPacketDispatcher(I802_15_4_MAC macDevice)
macDevice - The MAC layer to be used by this dispatcher| Method Detail |
|---|
public void setChannelNumber(int channel)
ILowPanPacketDispatcher
setChannelNumber in interface ILowPanPacketDispatcherchannel - - the new channel numberpublic void setPanId(short pid)
ILowPanPacketDispatcher
setPanId in interface ILowPanPacketDispatcherpid - - the new pan IDpublic void startMAC()
ILowPanPacketDispatcher
startMAC in interface ILowPanPacketDispatcherprotected void setPLMETransmitPower(int power)
protected int getPLMETransmitPower()
public long getIEEEAddress()
public void turnOffReceiver()
ILowPanPacketDispatcher
turnOffReceiver in interface ILowPanPacketDispatcherpublic void turnOnReceiver()
ILowPanPacketDispatcher
turnOnReceiver in interface ILowPanPacketDispatcherpublic void turnOnReceiver(int period)
ILowPanPacketDispatcher
turnOnReceiver in interface ILowPanPacketDispatcherperiod - in millisecondspublic void initBaseStation()
ILowPanPacketDispatcher
public void closeBaseStation()
ILowPanPacketDispatcher
public static String logicalToPhysical(String ieeeAddressString)
ieeeAddressString - the logical address string
protected void setAsDaemonThread(Thread dispatcherThread)
public static ILowPanPacketDispatcher getInstance()
public static void setInstance(ILowPanPacketDispatcher lp)
lp - - the replacement ILowPanPacketDispatcherprotected void initUsing(I802_15_4_MAC macDevice)
macDevice -
public void addProtocol(byte protocolNum,
IProtocolManager protocolMan)
ILowPanPacketDispatcher
addProtocol in interface ILowPanPacketDispatcherprotocolNum - - the unique number to identify the protocol (0..255)protocolMan - - the object that will receive incoming radio packets
associated with the protocolpublic void removeProtocol(byte protocolNum)
ILowPanPacketDispatcher
removeProtocol in interface ILowPanPacketDispatcherprotocolNum - - the unique number to identify the protocol to deregister.
public void sendPacket(byte protocolNum,
RadioPacket rp)
throws NoAckException,
ChannelBusyException
ILowPanPacketDispatcher
...
rp.setMACPayloadAt(ILowPanPacketDispatcher.LOWPAN_DATA_OFFSET, aVal);
...
sendPacket in interface ILowPanPacketDispatcherprotocolNum - - the protocl number associated with the outgoing packetrp - - the radio packet to send
NoAckException
ChannelBusyExceptionpublic int getChannelNumber()
ILowPanPacketDispatcher
getChannelNumber in interface ILowPanPacketDispatcherpublic short getPanId()
ILowPanPacketDispatcher
getPanId in interface ILowPanPacketDispatcherprotected IProtocolManager getProtocolFor(byte protNum)
protNum - -- the protocol number
protected void processIncomingRP(RadioPacket rp)
rp - -- the RadioPacket.
protected void setLowPanProtocol(byte protocolNum,
RadioPacket rp)
protected byte getLowPanProtocol(RadioPacket rp)
public void setOutputPower(int power)
ILowPanPacketDispatcher
setOutputPower in interface ILowPanPacketDispatcherpower - - new power setting in decibels.public int getOutputPower()
ILowPanPacketDispatcher
getOutputPower in interface ILowPanPacketDispatcherpublic boolean isLoggingConnections()
isLoggingConnections in interface ILowPanPacketDispatcherpublic void setLogConnections(boolean logConnections)
ILowPanPacketDispatcher
setLogConnections in interface ILowPanPacketDispatcherlogConnections - true if connnections should be logged
|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||