SunSPOT API V2.0


com.sun.spot.peripheral.radio
Class RadioPolicyManager

java.lang.Object
  extended by com.sun.spot.peripheral.radio.RadioPolicyManager
All Implemented Interfaces:
IDriver, IRadioPolicyManager

public class RadioPolicyManager
extends Object
implements IRadioPolicyManager, IDriver


Field Summary
 
Fields inherited from interface com.sun.spot.peripheral.radio.IRadioPolicyManager
DEFAULT_PAN_ID
 
Constructor Summary
RadioPolicyManager(I802_15_4_MAC macDevice, int initialChannel, short initialPanId, int initialOutputPower)
           
 
Method Summary
 void closeBaseStation()
          Used in the host to close down the base station - a no-op if called on a Spot
 void deregisterConnection(IConnectionID conn)
          Notify the policy manager that a connection has closed
 int getChannelNumber()
          Answer the current channel number (between 11 and 26).
 long getIEEEAddress()
           
 int getOutputPower()
          Answer the radio output power in decibels.
 short getPanId()
          Answer the current pan ID.
 boolean isLoggingConnections()
           
 boolean isRadioReceiverOn()
           
 String name()
          An identifying name for the driver (e.g.
 void policyHasChanged(IConnectionID conn, RadioPolicy selection)
          Notify the policy manager that a policy has changed
 void registerConnection(IConnectionID conn)
          Notify the policy manager of a new connection
 void setChannelNumber(int channel)
          Set the current channel number (between 11 and 26).
 void setLogConnections(boolean logConnections)
          Select whether connection addition and removal is being logged
 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).
 boolean setRxOn(boolean rxState)
          Attempt to set the radio receiver to on or off
 void setUp()
          Activate or reactivate the driver (after a deep sleep or when another driver refused to deep sleep).
 boolean tearDown()
          Deactivate the driver (usually in preparation for deep sleep).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RadioPolicyManager

public RadioPolicyManager(I802_15_4_MAC macDevice,
                          int initialChannel,
                          short initialPanId,
                          int initialOutputPower)
Method Detail

policyHasChanged

public void policyHasChanged(IConnectionID conn,
                             RadioPolicy selection)
Description copied from interface: IRadioPolicyManager
Notify the policy manager that a policy has changed

Specified by:
policyHasChanged in interface IRadioPolicyManager
Parameters:
conn - the connection owning the policy that has changed
selection - the required radio state

registerConnection

public void registerConnection(IConnectionID conn)
Description copied from interface: IRadioPolicyManager
Notify the policy manager of a new connection

Specified by:
registerConnection in interface IRadioPolicyManager
Parameters:
conn - the connection being registered

deregisterConnection

public void deregisterConnection(IConnectionID conn)
Description copied from interface: IRadioPolicyManager
Notify the policy manager that a connection has closed

Specified by:
deregisterConnection in interface IRadioPolicyManager
Parameters:
conn - the connection being deregistered

isRadioReceiverOn

public boolean isRadioReceiverOn()
Specified by:
isRadioReceiverOn in interface IRadioPolicyManager
Returns:
true if the radio receiver is currently enabled

setRxOn

public boolean setRxOn(boolean rxState)
Description copied from interface: IRadioPolicyManager
Attempt to set the radio receiver to on or off

Specified by:
setRxOn in interface IRadioPolicyManager
Parameters:
rxState - true for rx on, false for rx off
Returns:
true if the radio receiver is in the requested state after this call

name

public String name()
Description copied from interface: IDriver
An identifying name for the driver (e.g. "AIC" for the AIC driver).

Specified by:
name in interface IDriver
Returns:
The driver name

tearDown

public boolean tearDown()
Description copied from interface: IDriver
Deactivate the driver (usually in preparation for deep sleep). The driver should store any important state and release all resources it has claimed from other drivers.

Specified by:
tearDown in interface IDriver
Returns:
True if the driver is able to deactivate, false if it cannot deactivate (e.g. due to being busy with a data transfer). If any driver returns false, no deep sleep occurs and all other drivers will be reactivated.

setUp

public void setUp()
Description copied from interface: IDriver
Activate or reactivate the driver (after a deep sleep or when another driver refused to deep sleep). The driver should claim all the resources it needs from other drivers and reinitialize its hardware. It should also restore any state saved before tearDown.

Specified by:
setUp in interface IDriver

getChannelNumber

public int getChannelNumber()
Description copied from interface: IRadioPolicyManager
Answer the current channel number (between 11 and 26).

Specified by:
getChannelNumber in interface IRadioPolicyManager
Returns:
current channel number

getIEEEAddress

public long getIEEEAddress()
Specified by:
getIEEEAddress in interface IRadioPolicyManager
Returns:
the 64-bit IEEE address of this device

getOutputPower

public int getOutputPower()
Description copied from interface: IRadioPolicyManager
Answer the radio output power in decibels.

Specified by:
getOutputPower in interface IRadioPolicyManager
Returns:
- radio output power

getPanId

public short getPanId()
Description copied from interface: IRadioPolicyManager
Answer the current pan ID.

Specified by:
getPanId in interface IRadioPolicyManager
Returns:
current pan ID

setChannelNumber

public void setChannelNumber(int channel)
Description copied from interface: IRadioPolicyManager
Set the current channel number (between 11 and 26).

Specified by:
setChannelNumber in interface IRadioPolicyManager
Parameters:
channel - - the new channel number

setOutputPower

public void setOutputPower(int power)
Description copied from interface: IRadioPolicyManager
Set the radio output power in decibels (between -32 and +31). NB. The range given is the I802.15.4 standard range. In practice, for the CC2420 radio, this will mean maximum power for all values from 0 to 31 db.

Specified by:
setOutputPower in interface IRadioPolicyManager
Parameters:
power - - new power setting in decibels.

setPanId

public void setPanId(short pid)
Description copied from interface: IRadioPolicyManager
Set the pan ID (should not be -1 or -2, which are reserved in the I802.15.4 standard).

Specified by:
setPanId in interface IRadioPolicyManager
Parameters:
pid - - the new pan ID

closeBaseStation

public void closeBaseStation()
Description copied from interface: IRadioPolicyManager
Used in the host to close down the base station - a no-op if called on a Spot

Specified by:
closeBaseStation in interface IRadioPolicyManager

isLoggingConnections

public boolean isLoggingConnections()
Specified by:
isLoggingConnections in interface IRadioPolicyManager
Returns:
true if connection addition and removal is being logged

setLogConnections

public void setLogConnections(boolean logConnections)
Description copied from interface: IRadioPolicyManager
Select whether connection addition and removal is being logged

Specified by:
setLogConnections in interface IRadioPolicyManager
Parameters:
logConnections - true if connnections should be logged

SunSPOT API V2.0


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