SunSPOT API V3.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).
 String getDriverName()
          An identifying name for the driver (e.g.
 long getIEEEAddress()
           
 int getOutputPower()
          Answer the radio output power in decibels.
 short getPanId()
          Answer the current pan ID.
 boolean isRadioReceiverOn()
           
 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 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).
 void shutDown()
          Notify the driver that the VM is about to exit.
 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

getDriverName

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

Specified by:
getDriverName 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.

Drivers are torn down in the inverse order to that in which they registered, so that in general user drivers will be torn down before any underlying system 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.

shutDown

public void shutDown()
Description copied from interface: IDriver
Notify the driver that the VM is about to exit.

Specified by:
shutDown in interface IDriver

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.

Drivers are set up in the order that they registered, so that in general user drivers will be set up after any underlying system drivers.

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

SunSPOT API V3.0


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