jist.swans.radio
Class RadioNoise

java.lang.Object
  extended by jist.swans.radio.RadioNoise
All Implemented Interfaces:
JistAPI.Proxiable, JistAPI.Timeless, RadioInterface
Direct Known Subclasses:
RadioNoiseAdditive, RadioNoiseIndep

public abstract class RadioNoise
extends java.lang.Object
implements RadioInterface

RadioNoise is an abstract class which implements some functionality that is common to the independent and additive radio noise simulation models.

Since:
SWANS1.0
Version:
$Id: RadioNoise.java,v 1.28 2004/11/05 03:00:59 barr Exp $
Author:
Rimon Barr <barr+jist@cs.cornell.edu&rt;

Field Summary
protected  FieldInterface fieldEntity
          field entity downcall reference.
protected  MacInterface macEntity
          mac entity upcall reference.
protected  byte mode
          radio mode: IDLE, SENSING, RECEIVING, SENDING, SLEEP.
protected  RadioInfo radioInfo
          radio properties.
protected  RadioInterface self
          self-referencing radio entity reference.
protected  Message signalBuffer
          message being received.
protected  long signalFinish
          end of transmission time.
protected  double signalPower_mW
          transmission signal strength.
protected  int signals
          number of signals being received.
 
Constructor Summary
protected RadioNoise(int id, RadioInfo.RadioInfoShared sharedInfo)
          Create a new radio.
 
Method Summary
 void endTransmit()
          End message transmission.
 RadioInterface getProxy()
          Return self-referencing radio entity reference.
 RadioInfo getRadioInfo()
          Return radio properties.
protected  void lockSignal(Message msg, double power_mW, long duration)
          Lock onto current packet signal.
 void setFieldEntity(FieldInterface fieldEntity)
          Set upcall field entity reference.
 void setMacEntity(MacInterface macEntity)
          Set downcall mac entity reference.
 void setMode(byte mode)
          Set radio mode.
 void setSleepMode(boolean sleep)
          Turn radio off (sleep) or on.
 void transmit(Message msg, long delay, long duration)
          Start transmitting message.
protected  void unlockSignal()
          Unlock from current packet signal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jist.swans.radio.RadioInterface
endReceive, receive
 

Field Detail

radioInfo

protected RadioInfo radioInfo
radio properties.


mode

protected byte mode
radio mode: IDLE, SENSING, RECEIVING, SENDING, SLEEP.


signalBuffer

protected Message signalBuffer
message being received.


signalFinish

protected long signalFinish
end of transmission time.


signalPower_mW

protected double signalPower_mW
transmission signal strength.


signals

protected int signals
number of signals being received.


fieldEntity

protected FieldInterface fieldEntity
field entity downcall reference.


self

protected RadioInterface self
self-referencing radio entity reference.


macEntity

protected MacInterface macEntity
mac entity upcall reference.

Constructor Detail

RadioNoise

protected RadioNoise(int id,
                     RadioInfo.RadioInfoShared sharedInfo)
Create a new radio.

Parameters:
id - radio identifier
sharedInfo - shared radio properties
Method Detail

getProxy

public RadioInterface getProxy()
Return self-referencing radio entity reference.

Returns:
self-referencing radio entity reference

setFieldEntity

public void setFieldEntity(FieldInterface fieldEntity)
Set upcall field entity reference.

Parameters:
fieldEntity - upcall field entity reference

setMacEntity

public void setMacEntity(MacInterface macEntity)
Set downcall mac entity reference.

Parameters:
macEntity - downcall mac entity reference

getRadioInfo

public RadioInfo getRadioInfo()
Return radio properties.

Returns:
radio properties

setMode

public void setMode(byte mode)
Set radio mode. Also notifies mac entity.

Parameters:
mode - radio mode

setSleepMode

public void setSleepMode(boolean sleep)
Turn radio off (sleep) or on.

Specified by:
setSleepMode in interface RadioInterface
Parameters:
sleep - whether to turn off radio

lockSignal

protected void lockSignal(Message msg,
                          double power_mW,
                          long duration)
Lock onto current packet signal.

Parameters:
msg - packet currently on the air
power_mW - signal power (units: mW)
duration - time to EOT (units: simtime)

unlockSignal

protected void unlockSignal()
Unlock from current packet signal.


transmit

public void transmit(Message msg,
                     long delay,
                     long duration)
Start transmitting message. Puts radio into transmission mode and contacts other radios that receive the signal. Called from mac entity.

Specified by:
transmit in interface RadioInterface
Parameters:
msg - message object to transmit
delay - time to the wire
duration - time on the wire

endTransmit

public void endTransmit()
End message transmission. Putting the radio back into idle (or possibly receiving) mode. Called from mac entity.

Specified by:
endTransmit in interface RadioInterface