|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.sim.radio.SimpleAir
Very simple implementation of radio air. It assumes a lossless environment where all radios are able to communicate with each other. This simple air is blind to the frequencies used in transmission (i.e. it assumes that all frequencies are really the same).
This class should provide the proper scheduling policy with respect to threads that more complicated radio implementations can use the time scheduling policy and only overload the delivery policy.
Nested Class Summary | |
protected class |
SimpleAir.MeetEvent
|
Field Summary | |
protected Channel |
radioChannel
|
protected java.util.HashSet |
radios
|
protected IntervalSynchronizer |
synchronizer
|
Constructor Summary | |
SimpleAir()
|
Method Summary | |
void |
addRadio(Radio r)
The addRadio() method adds a new radio to this radio model. |
Synchronizer |
getSynchronizer()
The getSynchronizer() method gets the synchronizer for this air
implementation. |
byte |
readChannel(Radio r)
The readChannel() method reads the value of the channel at the current
time so that the last 8 bits transmitted (where the bits are 0 if there are no
transmissions) are returned. |
void |
removeRadio(Radio r)
The removeRadio() method removes a radio from this radio model. |
int |
sampleRSSI(Radio r)
The sampleRSSI() method is called by a radio when it wants to
sample the RSSI value of the air around it at the current time. |
void |
transmit(Radio r,
Radio.Transmission f)
The transmit() method is called by a radio when it begins to transmit
a packet over the air. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final java.util.HashSet radios
protected final Channel radioChannel
protected final IntervalSynchronizer synchronizer
Constructor Detail |
public SimpleAir()
Method Detail |
public void addRadio(Radio r)
addRadio()
method adds a new radio to this radio model.
addRadio
in interface RadioAir
r
- the radio to add to this air implementationpublic void removeRadio(Radio r)
removeRadio()
method removes a radio from this radio model.
removeRadio
in interface RadioAir
r
- the radio to remove from this air implementationpublic void transmit(Radio r, Radio.Transmission f)
transmit()
method is called by a radio when it begins to transmit
a packet over the air. The radio packet should be delivered to those radios in
range which are listening, according to the radio model.
transmit
in interface RadioAir
r
- the radio transmitting this packetf
- the radio packet transmitted into the airpublic int sampleRSSI(Radio r)
sampleRSSI()
method is called by a radio when it wants to
sample the RSSI value of the air around it at the current time. The air may
need to block (i.e. wait for neighbors) because this thread may be ahead
of other threads in global time. The underlying air implementation should use
a Synchronizer
for this purpose.
sampleRSSI
in interface RadioAir
r
- the radio sampling the RSSI value
public byte readChannel(Radio r)
readChannel()
method reads the value of the channel at the current
time so that the last 8 bits transmitted (where the bits are 0 if there are no
transmissions) are returned.
readChannel
in interface RadioAir
r
- the radio sampling the channel
public Synchronizer getSynchronizer()
getSynchronizer()
method gets the synchronizer for this air
implementation.
getSynchronizer
in interface RadioAir
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |