From 51f210b37fd4330a90aae445d46aef31fc8391e5 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Wed, 2 Dec 2009 16:29:36 +0000 Subject: [PATCH] removed unused and unneeded custom radio data classes --- .../mspmote/interfaces/CC2420RadioByte.java | 50 ----------------- .../mspmote/interfaces/CC2420RadioPacket.java | 53 ------------------- .../CC2420RadioPacketConverter.java | 3 +- .../mspmote/interfaces/SkyByteRadio.java | 26 ++++----- 4 files changed, 15 insertions(+), 117 deletions(-) delete mode 100755 tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioByte.java delete mode 100644 tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioPacket.java diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioByte.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioByte.java deleted file mode 100755 index 5ef4da6ee..000000000 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioByte.java +++ /dev/null @@ -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; - } - -} diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioPacket.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioPacket.java deleted file mode 100644 index 787ad57a2..000000000 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioPacket.java +++ /dev/null @@ -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; - } - -} diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioPacketConverter.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioPacketConverter.java index 02ed9eba0..ef9032a65 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioPacketConverter.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CC2420RadioPacketConverter.java @@ -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. diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyByteRadio.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyByteRadio.java index 29f1d4487..16e56f6b2 100755 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyByteRadio.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyByteRadio.java @@ -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 */