added output power indicator max value

This commit is contained in:
fros4943 2008-03-17 09:50:27 +00:00
parent 7cf49fb57a
commit 223ded4595
5 changed files with 76 additions and 50 deletions

View File

@ -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;

View File

@ -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");
} }

View File

@ -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;
@ -68,7 +68,7 @@ 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;
@ -165,6 +165,10 @@ 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;
} }
@ -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): "

View File

@ -24,7 +24,7 @@
* (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;
@ -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
*/ */

View File

@ -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;
@ -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;
} }
@ -192,10 +196,11 @@ public class DisturberRadio 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 now!"); statusLabel.setText("Transmitting now!");
else } else {
statusLabel.setText("Disturber resting..."); statusLabel.setText("Disturber resting...");
}
channelLabel.setText("Channel: " + getChannel()); channelLabel.setText("Channel: " + getChannel());
@ -207,9 +212,10 @@ 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);
} }
}
}); });
observer.update(null, null); observer.update(null, null);
@ -252,10 +258,11 @@ 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;