mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-08-11 21:28:58 +00:00
added output power indicator max value
This commit is contained in:
parent
7cf49fb57a
commit
223ded4595
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: TR1001Radio.java,v 1.1 2008/02/07 14:55:35 fros4943 Exp $
|
* $Id: TR1001Radio.java,v 1.2 2008/03/17 09:52:03 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.mspmote.interfaces;
|
package se.sics.cooja.mspmote.interfaces;
|
||||||
@ -357,6 +357,10 @@ public class TR1001Radio extends Radio implements USARTListener, ByteRadio {
|
|||||||
return 1.5;
|
return 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getOutputPowerIndicatorMax() {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
public int getCurrentOutputPowerIndicator() {
|
public int getCurrentOutputPowerIndicator() {
|
||||||
// TODO Implement output power indicator
|
// TODO Implement output power indicator
|
||||||
return 100;
|
return 100;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ContikiRadio.java,v 1.17 2008/02/23 10:10:42 fros4943 Exp $
|
* $Id: ContikiRadio.java,v 1.18 2008/03/17 09:50:27 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.contikimote.interfaces;
|
package se.sics.cooja.contikimote.interfaces;
|
||||||
@ -257,6 +257,10 @@ public class ContikiRadio extends Radio implements ContikiMoteInterface,
|
|||||||
return 1.5;
|
return 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getOutputPowerIndicatorMax() {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
public int getCurrentOutputPowerIndicator() {
|
public int getCurrentOutputPowerIndicator() {
|
||||||
return myMoteMemory.getByteValueOf("simPower");
|
return myMoteMemory.getByteValueOf("simPower");
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ApplicationRadio.java,v 1.2 2007/05/30 10:52:57 fros4943 Exp $
|
* $Id: ApplicationRadio.java,v 1.3 2008/03/17 09:50:27 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.interfaces;
|
package se.sics.cooja.interfaces;
|
||||||
@ -44,7 +44,7 @@ import se.sics.cooja.*;
|
|||||||
* Application radio. May for example be used by Java-based mote to implement
|
* Application radio. May for example be used by Java-based mote to implement
|
||||||
* radio functionality. Support radio channels and output power functionality.
|
* radio functionality. Support radio channels and output power functionality.
|
||||||
* The mote should observe the radio for incoming radio packet data.
|
* The mote should observe the radio for incoming radio packet data.
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind
|
* @author Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
public class ApplicationRadio extends Radio implements PacketRadio {
|
public class ApplicationRadio extends Radio implements PacketRadio {
|
||||||
@ -68,15 +68,15 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||||||
private byte[] outPacket = null;
|
private byte[] outPacket = null;
|
||||||
private int outPacketDuration = -1;
|
private int outPacketDuration = -1;
|
||||||
|
|
||||||
private double signalStrength = -200;
|
private double signalStrength = -100;
|
||||||
private int radioChannel = 1;
|
private int radioChannel = 1;
|
||||||
private double outputPower = 0;
|
private double outputPower = 0;
|
||||||
private int outputPowerIndicator = 100;
|
private int outputPowerIndicator = 100;
|
||||||
|
|
||||||
public ApplicationRadio(Mote mote) {
|
public ApplicationRadio(Mote mote) {
|
||||||
this.myMote = mote;
|
this.myMote = mote;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Packet radio support */
|
/* Packet radio support */
|
||||||
public byte[] getLastPacketTransmitted() {
|
public byte[] getLastPacketTransmitted() {
|
||||||
return packetFromMote;
|
return packetFromMote;
|
||||||
@ -141,7 +141,7 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||||||
public Position getPosition() {
|
public Position getPosition() {
|
||||||
return myMote.getInterfaces().getPosition();
|
return myMote.getInterfaces().getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RadioEvent getLastEvent() {
|
public RadioEvent getLastEvent() {
|
||||||
return lastEvent;
|
return lastEvent;
|
||||||
}
|
}
|
||||||
@ -165,10 +165,14 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||||||
return outputPower;
|
return outputPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getOutputPowerIndicatorMax() {
|
||||||
|
return outputPowerIndicator;
|
||||||
|
}
|
||||||
|
|
||||||
public int getCurrentOutputPowerIndicator() {
|
public int getCurrentOutputPowerIndicator() {
|
||||||
return outputPowerIndicator;
|
return outputPowerIndicator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getCurrentSignalStrength() {
|
public double getCurrentSignalStrength() {
|
||||||
return signalStrength;
|
return signalStrength;
|
||||||
}
|
}
|
||||||
@ -178,10 +182,10 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Application radio support */
|
/* Application radio support */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start transmitting given packet.
|
* Start transmitting given packet.
|
||||||
*
|
*
|
||||||
* @param packet Packet data
|
* @param packet Packet data
|
||||||
* @param duration Duration to transmit
|
* @param duration Duration to transmit
|
||||||
*/
|
*/
|
||||||
@ -190,14 +194,14 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||||||
outPacketDuration = duration;
|
outPacketDuration = duration;
|
||||||
outPacket = packet;
|
outPacket = packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param i New output power indicator
|
* @param i New output power indicator
|
||||||
*/
|
*/
|
||||||
public void setOutputPowerIndicator(int i) {
|
public void setOutputPowerIndicator(int i) {
|
||||||
outputPowerIndicator = i;
|
outputPowerIndicator = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param p New output power
|
* @param p New output power
|
||||||
*/
|
*/
|
||||||
@ -211,7 +215,7 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||||||
public void setChannel(int channel) {
|
public void setChannel(int channel) {
|
||||||
radioChannel = channel;
|
radioChannel = channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doActionsBeforeTick() {
|
public void doActionsBeforeTick() {
|
||||||
int currentTime = myMote.getSimulation().getSimulationTime();
|
int currentTime = myMote.getSimulation().getSimulationTime();
|
||||||
|
|
||||||
@ -230,7 +234,7 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||||||
this.setChanged();
|
this.setChanged();
|
||||||
this.notifyObservers();
|
this.notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTransmitting && currentTime >= transmissionEndTime) {
|
if (isTransmitting && currentTime >= transmissionEndTime) {
|
||||||
isTransmitting = false;
|
isTransmitting = false;
|
||||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||||
@ -261,7 +265,7 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||||||
panel.add(Box.createVerticalStrut(3));
|
panel.add(Box.createVerticalStrut(3));
|
||||||
panel.add(channelLabel);
|
panel.add(channelLabel);
|
||||||
panel.add(Box.createVerticalGlue());
|
panel.add(Box.createVerticalGlue());
|
||||||
|
|
||||||
updateButton.addActionListener(new ActionListener() {
|
updateButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
ssLabel.setText("Signal strength (not auto-updated): "
|
ssLabel.setText("Signal strength (not auto-updated): "
|
||||||
@ -271,12 +275,14 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||||||
|
|
||||||
final Observer observer = new Observer() {
|
final Observer observer = new Observer() {
|
||||||
public void update(Observable obs, Object obj) {
|
public void update(Observable obs, Object obj) {
|
||||||
if (isTransmitting())
|
if (isTransmitting()) {
|
||||||
statusLabel.setText("Transmitting");
|
statusLabel.setText("Transmitting");
|
||||||
if (isReceiving())
|
}
|
||||||
|
if (isReceiving()) {
|
||||||
statusLabel.setText("Receiving");
|
statusLabel.setText("Receiving");
|
||||||
else
|
} else {
|
||||||
statusLabel.setText("Listening");
|
statusLabel.setText("Listening");
|
||||||
|
}
|
||||||
|
|
||||||
lastEventLabel.setText("Last event (time=" + lastEventTime + "): " + lastEvent);
|
lastEventLabel.setText("Last event (time=" + lastEventTime + "): " + lastEvent);
|
||||||
ssLabel.setText("Signal strength (not auto-updated): "
|
ssLabel.setText("Signal strength (not auto-updated): "
|
||||||
@ -313,7 +319,7 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||||||
|
|
||||||
public void setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
public void setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mote getMote() {
|
public Mote getMote() {
|
||||||
return myMote;
|
return myMote;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Swedish Institute of Computer Science. All rights
|
* Copyright (c) 2006, Swedish Institute of Computer Science. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
@ -12,7 +12,7 @@
|
|||||||
* Institute nor the names of its contributors may be used to endorse or promote
|
* Institute nor the names of its contributors may be used to endorse or promote
|
||||||
* products derived from this software without specific prior written
|
* products derived from this software without specific prior written
|
||||||
* permission.
|
* permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
@ -23,8 +23,8 @@
|
|||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: Radio.java,v 1.7 2007/05/30 10:52:57 fros4943 Exp $
|
* $Id: Radio.java,v 1.8 2008/03/17 09:50:27 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.interfaces;
|
package se.sics.cooja.interfaces;
|
||||||
@ -33,15 +33,15 @@ import se.sics.cooja.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A Radio represents a mote radio transceiver.
|
* A Radio represents a mote radio transceiver.
|
||||||
*
|
*
|
||||||
* A radio can support different abstraction levels such as transmitting and
|
* A radio can support different abstraction levels such as transmitting and
|
||||||
* receiving on a byte or packet-basis. In order to support communication
|
* receiving on a byte or packet-basis. In order to support communication
|
||||||
* between different levels the general rule in COOJA is that all radios at a
|
* between different levels the general rule in COOJA is that all radios at a
|
||||||
* lower abstraction level must also implement all higher levels.
|
* lower abstraction level must also implement all higher levels.
|
||||||
*
|
*
|
||||||
* @see PacketRadio
|
* @see PacketRadio
|
||||||
* @see ByteRadio
|
* @see ByteRadio
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind
|
* @author Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Packet Radio")
|
@ClassDescription("Packet Radio")
|
||||||
@ -57,7 +57,7 @@ public abstract class Radio extends MoteInterface {
|
|||||||
/**
|
/**
|
||||||
* Signal that a new reception just begun. This method should normally be
|
* Signal that a new reception just begun. This method should normally be
|
||||||
* called from the radio medium.
|
* called from the radio medium.
|
||||||
*
|
*
|
||||||
* @see #signalReceptionEnd()
|
* @see #signalReceptionEnd()
|
||||||
*/
|
*/
|
||||||
public abstract void signalReceptionStart();
|
public abstract void signalReceptionStart();
|
||||||
@ -65,7 +65,7 @@ public abstract class Radio extends MoteInterface {
|
|||||||
/**
|
/**
|
||||||
* Signal that the current reception was ended. This method should normally be
|
* Signal that the current reception was ended. This method should normally be
|
||||||
* called from the radio medium.
|
* called from the radio medium.
|
||||||
*
|
*
|
||||||
* @see #signalReceptionStart()
|
* @see #signalReceptionStart()
|
||||||
*/
|
*/
|
||||||
public abstract void signalReceptionEnd();
|
public abstract void signalReceptionEnd();
|
||||||
@ -73,7 +73,7 @@ public abstract class Radio extends MoteInterface {
|
|||||||
/**
|
/**
|
||||||
* Returns last event at this radio. This method should be used to learn the
|
* Returns last event at this radio. This method should be used to learn the
|
||||||
* reason when a radio notifies a change to observers.
|
* reason when a radio notifies a change to observers.
|
||||||
*
|
*
|
||||||
* @return Last radio event
|
* @return Last radio event
|
||||||
*/
|
*/
|
||||||
public abstract RadioEvent getLastEvent();
|
public abstract RadioEvent getLastEvent();
|
||||||
@ -81,7 +81,7 @@ public abstract class Radio extends MoteInterface {
|
|||||||
/**
|
/**
|
||||||
* Returns true if this radio is transmitting, or just finished transmitting,
|
* Returns true if this radio is transmitting, or just finished transmitting,
|
||||||
* data.
|
* data.
|
||||||
*
|
*
|
||||||
* @see #isReceiving()
|
* @see #isReceiving()
|
||||||
* @return True if radio is transmitting data
|
* @return True if radio is transmitting data
|
||||||
*/
|
*/
|
||||||
@ -89,7 +89,7 @@ public abstract class Radio extends MoteInterface {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this radio is receiving data.
|
* Returns true if this radio is receiving data.
|
||||||
*
|
*
|
||||||
* @see #isTransmitting()
|
* @see #isTransmitting()
|
||||||
* @return True if radio is receiving data
|
* @return True if radio is receiving data
|
||||||
*/
|
*/
|
||||||
@ -98,7 +98,7 @@ public abstract class Radio extends MoteInterface {
|
|||||||
/**
|
/**
|
||||||
* Returns true if this radio had a connection that was dropped due to
|
* Returns true if this radio had a connection that was dropped due to
|
||||||
* interference.
|
* interference.
|
||||||
*
|
*
|
||||||
* @return True if this radio is interfered
|
* @return True if this radio is interfered
|
||||||
*/
|
*/
|
||||||
public abstract boolean isInterfered();
|
public abstract boolean isInterfered();
|
||||||
@ -116,10 +116,15 @@ public abstract class Radio extends MoteInterface {
|
|||||||
public abstract double getCurrentOutputPower();
|
public abstract double getCurrentOutputPower();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Current output power indicator (1-100)
|
* @return Current output power indicator
|
||||||
*/
|
*/
|
||||||
public abstract int getCurrentOutputPowerIndicator();
|
public abstract int getCurrentOutputPowerIndicator();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Maximum output power indicator
|
||||||
|
*/
|
||||||
|
public abstract int getOutputPowerIndicatorMax();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Current surrounding signal strength
|
* @return Current surrounding signal strength
|
||||||
*/
|
*/
|
||||||
@ -128,7 +133,7 @@ public abstract class Radio extends MoteInterface {
|
|||||||
/**
|
/**
|
||||||
* Sets surrounding signal strength. This method should normally be called by
|
* Sets surrounding signal strength. This method should normally be called by
|
||||||
* the radio medium.
|
* the radio medium.
|
||||||
*
|
*
|
||||||
* @param signalStrength
|
* @param signalStrength
|
||||||
* Current surrounding signal strength
|
* Current surrounding signal strength
|
||||||
*/
|
*/
|
||||||
@ -136,7 +141,7 @@ public abstract class Radio extends MoteInterface {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current radio channel number.
|
* Returns the current radio channel number.
|
||||||
*
|
*
|
||||||
* @return Current channel number
|
* @return Current channel number
|
||||||
*/
|
*/
|
||||||
public abstract int getChannel();
|
public abstract int getChannel();
|
||||||
@ -144,7 +149,7 @@ public abstract class Radio extends MoteInterface {
|
|||||||
/**
|
/**
|
||||||
* Returns the radio position.
|
* Returns the radio position.
|
||||||
* This is typically the position of the mote.
|
* This is typically the position of the mote.
|
||||||
*
|
*
|
||||||
* @return Radio position
|
* @return Radio position
|
||||||
*/
|
*/
|
||||||
public abstract Position getPosition();
|
public abstract Position getPosition();
|
||||||
@ -152,9 +157,9 @@ public abstract class Radio extends MoteInterface {
|
|||||||
/**
|
/**
|
||||||
* This is a convenience function.
|
* This is a convenience function.
|
||||||
* It returns the mote, if any, that holds this radio.
|
* It returns the mote, if any, that holds this radio.
|
||||||
*
|
*
|
||||||
* @return Mote
|
* @return Mote
|
||||||
*/
|
*/
|
||||||
public abstract Mote getMote();
|
public abstract Mote getMote();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: DisturberRadio.java,v 1.4 2007/05/30 10:53:18 fros4943 Exp $
|
* $Id: DisturberRadio.java,v 1.5 2008/03/17 09:50:27 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.motes;
|
package se.sics.cooja.motes;
|
||||||
@ -44,7 +44,7 @@ import se.sics.cooja.interfaces.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This radio periodically transmits data on a configurable channel.
|
* This radio periodically transmits data on a configurable channel.
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind, Thiemo Voigt
|
* @author Fredrik Osterlind, Thiemo Voigt
|
||||||
*/
|
*/
|
||||||
public class DisturberRadio extends Radio implements PacketRadio {
|
public class DisturberRadio extends Radio implements PacketRadio {
|
||||||
@ -69,7 +69,7 @@ public class DisturberRadio extends Radio implements PacketRadio {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an interface to the radio at mote.
|
* Creates an interface to the radio at mote.
|
||||||
*
|
*
|
||||||
* @param mote
|
* @param mote
|
||||||
* Radio's mote.
|
* Radio's mote.
|
||||||
* @see Mote
|
* @see Mote
|
||||||
@ -78,7 +78,7 @@ public class DisturberRadio extends Radio implements PacketRadio {
|
|||||||
public DisturberRadio(Mote mote) {
|
public DisturberRadio(Mote mote) {
|
||||||
this.myMote = mote;
|
this.myMote = mote;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Packet radio support */
|
/* Packet radio support */
|
||||||
public byte[] getLastPacketTransmitted() {
|
public byte[] getLastPacketTransmitted() {
|
||||||
return packetFromMote;
|
return packetFromMote;
|
||||||
@ -118,7 +118,7 @@ public class DisturberRadio extends Radio implements PacketRadio {
|
|||||||
public Position getPosition() {
|
public Position getPosition() {
|
||||||
return myMote.getInterfaces().getPosition();
|
return myMote.getInterfaces().getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RadioEvent getLastEvent() {
|
public RadioEvent getLastEvent() {
|
||||||
return lastEvent;
|
return lastEvent;
|
||||||
}
|
}
|
||||||
@ -136,6 +136,10 @@ public class DisturberRadio extends Radio implements PacketRadio {
|
|||||||
return 1.5;
|
return 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getOutputPowerIndicatorMax() {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
public int getCurrentOutputPowerIndicator() {
|
public int getCurrentOutputPowerIndicator() {
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
@ -185,17 +189,18 @@ public class DisturberRadio extends Radio implements PacketRadio {
|
|||||||
panel.add(channelLabel);
|
panel.add(channelLabel);
|
||||||
panel.add(channelPicker);
|
panel.add(channelPicker);
|
||||||
panel.add(Box.createVerticalGlue());
|
panel.add(Box.createVerticalGlue());
|
||||||
|
|
||||||
channelPicker.setValue(distChannel);
|
channelPicker.setValue(distChannel);
|
||||||
channelPicker.setColumns(3);
|
channelPicker.setColumns(3);
|
||||||
channelPicker.setText(Integer.toString(distChannel));
|
channelPicker.setText(Integer.toString(distChannel));
|
||||||
|
|
||||||
final Observer observer = new Observer() {
|
final Observer observer = new Observer() {
|
||||||
public void update(Observable obs, Object obj) {
|
public void update(Observable obs, Object obj) {
|
||||||
if (isTransmitting())
|
if (isTransmitting()) {
|
||||||
statusLabel.setText("Transmitting now!");
|
statusLabel.setText("Transmitting now!");
|
||||||
else
|
} else {
|
||||||
statusLabel.setText("Disturber resting...");
|
statusLabel.setText("Disturber resting...");
|
||||||
|
}
|
||||||
|
|
||||||
channelLabel.setText("Channel: " + getChannel());
|
channelLabel.setText("Channel: " + getChannel());
|
||||||
|
|
||||||
@ -207,8 +212,9 @@ public class DisturberRadio extends Radio implements PacketRadio {
|
|||||||
channelPicker.addPropertyChangeListener("value", new PropertyChangeListener() {
|
channelPicker.addPropertyChangeListener("value", new PropertyChangeListener() {
|
||||||
public void propertyChange(PropertyChangeEvent e) {
|
public void propertyChange(PropertyChangeEvent e) {
|
||||||
distChannel = ((Number) channelPicker.getValue()).intValue();
|
distChannel = ((Number) channelPicker.getValue()).intValue();
|
||||||
if (observer != null)
|
if (observer != null) {
|
||||||
observer.update(null, null);
|
observer.update(null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -252,11 +258,12 @@ public class DisturberRadio extends Radio implements PacketRadio {
|
|||||||
|
|
||||||
if (name.equals("channel")) {
|
if (name.equals("channel")) {
|
||||||
distChannel = Integer.parseInt(element.getText());
|
distChannel = Integer.parseInt(element.getText());
|
||||||
} else
|
} else {
|
||||||
logger.fatal("Read unknown configuration: " + name);
|
logger.fatal("Read unknown configuration: " + name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mote getMote() {
|
public Mote getMote() {
|
||||||
return myMote;
|
return myMote;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user