removed unused and unneeded custom radio data classes

This commit is contained in:
fros4943 2009-12-02 16:29:36 +00:00
parent 2f9ccfa26d
commit 51f210b37f
4 changed files with 15 additions and 117 deletions

View File

@ -1,50 +0,0 @@
/*
* Copyright (c) 2008, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND 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 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: CC2420RadioByte.java,v 1.1 2008/10/09 11:12:29 joxe Exp $
*/
package se.sics.cooja.mspmote.interfaces;
import se.sics.cooja.RadioPacket;
public class CC2420RadioByte implements RadioPacket {
private byte[] data = new byte[1];
public CC2420RadioByte(byte data) {
this.data[0] = data;
}
public CC2420RadioByte(int intData) {
this.data[0] = (byte) intData;
}
public byte[] getPacketData() {
return data;
}
}

View File

@ -1,53 +0,0 @@
/*
* Copyright (c) 2008, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND 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 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: CC2420RadioPacket.java,v 1.2 2008/09/17 12:09:03 fros4943 Exp $
*/
package se.sics.cooja.mspmote.interfaces;
import se.sics.cooja.RadioPacket;
public class CC2420RadioPacket implements RadioPacket {
private byte[] data;
public CC2420RadioPacket(byte[] data) {
this.data = data;
}
public CC2420RadioPacket(int[] intData) {
this.data = new byte[intData.length];
for (int i=0; i < intData.length; i++) {
this.data[i] = (byte) intData[i];
}
}
public byte[] getPacketData() {
return data;
}
}

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: CC2420RadioPacketConverter.java,v 1.10 2009/05/26 13:33:35 fros4943 Exp $
* $Id: CC2420RadioPacketConverter.java,v 1.11 2009/12/02 16:29:36 fros4943 Exp $
*/
package se.sics.cooja.mspmote.interfaces;
@ -35,7 +35,6 @@ import org.apache.log4j.Logger;
import se.sics.cooja.ConvertedRadioPacket;
import se.sics.cooja.RadioPacket;
import se.sics.cooja.util.StringUtils;
/**
* Converts radio packets between X-MAC/CC24240/Sky and COOJA.

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: SkyByteRadio.java,v 1.17 2009/11/25 15:18:11 fros4943 Exp $
* $Id: SkyByteRadio.java,v 1.18 2009/12/02 16:29:36 fros4943 Exp $
*/
package se.sics.cooja.mspmote.interfaces;
@ -75,9 +75,9 @@ public class SkyByteRadio extends Radio implements CustomDataRadio {
private boolean isReceiving = false;
private CC2420RadioByte lastOutgoingByte = null;
private byte lastOutgoingByte;
private CC2420RadioByte lastIncomingByte = null;
private byte lastIncomingByte;
private RadioPacket lastOutgoingPacket = null;
@ -102,7 +102,7 @@ public class SkyByteRadio extends Radio implements CustomDataRadio {
}
/* send this byte to all nodes */
lastOutgoingByte = new CC2420RadioByte(data);
lastOutgoingByte = data;
lastEventTime = SkyByteRadio.this.mote.getSimulation().getSimulationTime();
lastEvent = RadioEvent.CUSTOM_DATA_TRANSMITTED;
setChanged();
@ -244,15 +244,17 @@ public class SkyByteRadio extends Radio implements CustomDataRadio {
}
public void receiveCustomData(Object data) {
if (data instanceof CC2420RadioByte) {
lastIncomingByte = (CC2420RadioByte) data;
if (isInterfered()) {
cc2420.receivedByte((byte)0xFF);
} else {
cc2420.receivedByte(lastIncomingByte.getPacketData()[0]);
}
mote.requestImmediateWakeup();
if (!(data instanceof Byte)) {
logger.fatal("Bad custom data: " + data);
return;
}
lastIncomingByte = (Byte) data;
if (isInterfered()) {
cc2420.receivedByte((byte)0xFF);
} else {
cc2420.receivedByte(lastIncomingByte);
}
mote.requestImmediateWakeup();
}
/* General radio support */