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
* 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;
@ -357,6 +357,10 @@ public class TR1001Radio extends Radio implements USARTListener, ByteRadio {
return 1.5;
}
public int getOutputPowerIndicatorMax() {
return 100;
}
public int getCurrentOutputPowerIndicator() {
// TODO Implement output power indicator
return 100;

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* 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;
@ -257,6 +257,10 @@ public class ContikiRadio extends Radio implements ContikiMoteInterface,
return 1.5;
}
public int getOutputPowerIndicatorMax() {
return 100;
}
public int getCurrentOutputPowerIndicator() {
return myMoteMemory.getByteValueOf("simPower");
}

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* 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;
@ -68,7 +68,7 @@ public class ApplicationRadio extends Radio implements PacketRadio {
private byte[] outPacket = null;
private int outPacketDuration = -1;
private double signalStrength = -200;
private double signalStrength = -100;
private int radioChannel = 1;
private double outputPower = 0;
private int outputPowerIndicator = 100;
@ -165,6 +165,10 @@ public class ApplicationRadio extends Radio implements PacketRadio {
return outputPower;
}
public int getOutputPowerIndicatorMax() {
return outputPowerIndicator;
}
public int getCurrentOutputPowerIndicator() {
return outputPowerIndicator;
}
@ -271,12 +275,14 @@ public class ApplicationRadio extends Radio implements PacketRadio {
final Observer observer = new Observer() {
public void update(Observable obs, Object obj) {
if (isTransmitting())
if (isTransmitting()) {
statusLabel.setText("Transmitting");
if (isReceiving())
}
if (isReceiving()) {
statusLabel.setText("Receiving");
else
} else {
statusLabel.setText("Listening");
}
lastEventLabel.setText("Last event (time=" + lastEventTime + "): " + lastEvent);
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
* 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;
@ -116,10 +116,15 @@ public abstract class Radio extends MoteInterface {
public abstract double getCurrentOutputPower();
/**
* @return Current output power indicator (1-100)
* @return Current output power indicator
*/
public abstract int getCurrentOutputPowerIndicator();
/**
* @return Maximum output power indicator
*/
public abstract int getOutputPowerIndicatorMax();
/**
* @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
* 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;
@ -136,6 +136,10 @@ public class DisturberRadio extends Radio implements PacketRadio {
return 1.5;
}
public int getOutputPowerIndicatorMax() {
return 100;
}
public int getCurrentOutputPowerIndicator() {
return 100;
}
@ -192,10 +196,11 @@ public class DisturberRadio extends Radio implements PacketRadio {
final Observer observer = new Observer() {
public void update(Observable obs, Object obj) {
if (isTransmitting())
if (isTransmitting()) {
statusLabel.setText("Transmitting now!");
else
} else {
statusLabel.setText("Disturber resting...");
}
channelLabel.setText("Channel: " + getChannel());
@ -207,8 +212,9 @@ public class DisturberRadio extends Radio implements PacketRadio {
channelPicker.addPropertyChangeListener("value", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
distChannel = ((Number) channelPicker.getValue()).intValue();
if (observer != null)
if (observer != null) {
observer.update(null, null);
}
}
});
@ -252,8 +258,9 @@ public class DisturberRadio extends Radio implements PacketRadio {
if (name.equals("channel")) {
distChannel = Integer.parseInt(element.getText());
} else
} else {
logger.fatal("Read unknown configuration: " + name);
}
}
}