using new radio packet format
This commit is contained in:
parent
2b90590698
commit
4fc082db35
|
@ -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.3 2008/03/17 09:50:27 fros4943 Exp $
|
||||
* $Id: ApplicationRadio.java,v 1.4 2008/03/18 13:03:24 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.interfaces;
|
||||
|
@ -42,18 +42,18 @@ import se.sics.cooja.*;
|
|||
|
||||
/**
|
||||
* Application radio. May for example be used by Java-based mote to implement
|
||||
* radio functionality. Support radio channels and output power functionality.
|
||||
* radio functionality. Supports radio channels and output power functionality.
|
||||
* The mote should observe the radio for incoming radio packet data.
|
||||
*
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
public class ApplicationRadio extends Radio implements PacketRadio {
|
||||
public class ApplicationRadio extends Radio {
|
||||
private Mote myMote;
|
||||
|
||||
private static Logger logger = Logger.getLogger(ApplicationRadio.class);
|
||||
|
||||
private static byte[] packetFromMote = null;
|
||||
private static byte[] packetToMote = null;
|
||||
private RadioPacket packetFromMote = null;
|
||||
private RadioPacket packetToMote = null;
|
||||
|
||||
private boolean isTransmitting = false;
|
||||
private boolean isReceiving = false;
|
||||
|
@ -65,7 +65,7 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||
private int lastEventTime = 0;
|
||||
|
||||
private boolean outPacketExists = false;
|
||||
private byte[] outPacket = null;
|
||||
private RadioPacket outPacket = null;
|
||||
private int outPacketDuration = -1;
|
||||
|
||||
private double signalStrength = -100;
|
||||
|
@ -78,16 +78,16 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||
}
|
||||
|
||||
/* Packet radio support */
|
||||
public byte[] getLastPacketTransmitted() {
|
||||
public RadioPacket getLastPacketTransmitted() {
|
||||
return packetFromMote;
|
||||
}
|
||||
|
||||
public byte[] getLastPacketReceived() {
|
||||
public RadioPacket getLastPacketReceived() {
|
||||
return packetToMote;
|
||||
}
|
||||
|
||||
public void setReceivedPacket(byte[] data) {
|
||||
packetToMote = data;
|
||||
public void setReceivedPacket(RadioPacket packet) {
|
||||
packetToMote = packet;
|
||||
}
|
||||
|
||||
/* General radio support */
|
||||
|
@ -189,7 +189,7 @@ public class ApplicationRadio extends Radio implements PacketRadio {
|
|||
* @param packet Packet data
|
||||
* @param duration Duration to transmit
|
||||
*/
|
||||
public void startTransmittingPacket(byte[] packet, int duration) {
|
||||
public void startTransmittingPacket(RadioPacket packet, int duration) {
|
||||
outPacketExists = true;
|
||||
outPacketDuration = duration;
|
||||
outPacket = packet;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: RadioLogger.java,v 1.11 2007/11/20 04:17:11 fros4943 Exp $
|
||||
* $Id: RadioLogger.java,v 1.12 2008/03/18 13:06:19 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.plugins;
|
||||
|
@ -45,7 +45,6 @@ import org.apache.log4j.Logger;
|
|||
import org.jdom.Element;
|
||||
|
||||
import se.sics.cooja.*;
|
||||
import se.sics.cooja.interfaces.PacketRadio;
|
||||
import se.sics.cooja.interfaces.Radio;
|
||||
|
||||
/**
|
||||
|
@ -252,11 +251,7 @@ public class RadioLogger extends VisPlugin {
|
|||
data[DATAPOS_TIME] = new Integer(simulation.getSimulationTime());
|
||||
data[DATAPOS_CONNECTION] = newConnection;
|
||||
|
||||
if (newConnection.getSource() instanceof PacketRadio) {
|
||||
data[DATAPOS_DATA] = ((PacketRadio) newConnection.getSource()).getLastPacketTransmitted();
|
||||
} else {
|
||||
data[DATAPOS_DATA] = null;
|
||||
}
|
||||
data[DATAPOS_DATA] = newConnection.getSource().getLastPacketTransmitted().getPacketData();
|
||||
|
||||
rowData.add(data);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue