diff --git a/apps/mspsim/build.xml b/apps/mspsim/build.xml
index 654e25ecaf..5518b16dce 100644
--- a/apps/mspsim/build.xml
+++ b/apps/mspsim/build.xml
@@ -69,10 +69,6 @@ Could not find the MSPSim build file. Did you run "git submodule update --i
-
-
-
-
diff --git a/apps/mspsim/exp5438.png b/apps/mspsim/exp5438.png
deleted file mode 100644
index e7ff64fdfe..0000000000
Binary files a/apps/mspsim/exp5438.png and /dev/null differ
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/Exp5438Mote.java b/apps/mspsim/src/org/contikios/cooja/mspmote/Exp5438Mote.java
deleted file mode 100644
index 380c109069..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/Exp5438Mote.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2011, 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.
- */
-
-package org.contikios.cooja.mspmote;
-
-import java.io.File;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-
-import org.contikios.cooja.Simulation;
-import se.sics.mspsim.platform.GenericNode;
-import se.sics.mspsim.platform.ti.Exp1101Node;
-import se.sics.mspsim.platform.ti.Exp1120Node;
-import se.sics.mspsim.platform.ti.Exp5438Node;
-import se.sics.mspsim.platform.ti.Trxeb1120Node;
-import se.sics.mspsim.platform.ti.Trxeb2520Node;
-
-/**
- * @author Fredrik Osterlind
- */
-public class Exp5438Mote extends MspMote {
- private static final Logger logger = LogManager.getLogger(Exp5438Mote.class);
-
- public GenericNode exp5438Node = null;
- private String desc = "";
-
- public Exp5438Mote(MspMoteType moteType, Simulation sim) {
- super(moteType, sim);
- }
-
- protected boolean initEmulator(File fileELF) {
- /* Hack: Try to figure out what type of Mspsim-node we should be used by checking file extension */
- String filename = fileELF.getName();
- if (filename.endsWith(".exp1101")) {
- exp5438Node = new Exp1101Node();
- desc = "Exp5438+CC1101";
- } else if (filename.endsWith(".exp1120")) {
- exp5438Node = new Exp1120Node();
- desc = "Exp5438+CC1120";
- } else if (filename.endsWith(".trxeb2520")) {
- exp5438Node = new Trxeb2520Node();
- desc = "Trxeb2520";
- } else if (filename.endsWith(".trxeb1120")) {
- exp5438Node = new Trxeb1120Node(false);
- desc = "Trxeb1120";
- } else if (filename.endsWith(".eth1120")) {
- exp5438Node = new Trxeb1120Node(true);
- desc = "Eth1120";
- } else if (filename.endsWith(".exp2420") || filename.endsWith(".exp5438")) {
- exp5438Node = new Exp5438Node();
- desc = "Exp5438+CC2420";
- } else {
- throw new IllegalStateException("unknown file extension, cannot figure out what Mspsim node type to use: " + filename);
- }
-
- try {
- registry = exp5438Node.getRegistry();
- prepareMote(fileELF, exp5438Node);
- } catch (Exception e) {
- logger.fatal("Error when creating Exp5438 mote: ", e);
- return false;
- }
- return true;
- }
-
- public void idUpdated(int newID) {
- }
-
- public String toString() {
- return desc + " " + getID();
- }
-
-}
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/Exp5438MoteType.java b/apps/mspsim/src/org/contikios/cooja/mspmote/Exp5438MoteType.java
deleted file mode 100644
index 59bd2a3aef..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/Exp5438MoteType.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (c) 2011, 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.
- */
-
-package org.contikios.cooja.mspmote;
-
-import java.awt.Container;
-import java.awt.Image;
-import java.awt.MediaTracker;
-import java.awt.Toolkit;
-import java.io.File;
-import java.net.URL;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-import org.contikios.cooja.AbstractionLevelDescription;
-import org.contikios.cooja.ClassDescription;
-import org.contikios.cooja.Cooja;
-import org.contikios.cooja.MoteInterface;
-import org.contikios.cooja.MoteType;
-import org.contikios.cooja.Simulation;
-import org.contikios.cooja.dialogs.CompileContiki;
-import org.contikios.cooja.dialogs.MessageList;
-import org.contikios.cooja.dialogs.MessageListText;
-import org.contikios.cooja.dialogs.MessageListUI;
-import org.contikios.cooja.dialogs.MessageContainer;
-import org.contikios.cooja.interfaces.IPAddress;
-import org.contikios.cooja.interfaces.Mote2MoteRelations;
-import org.contikios.cooja.interfaces.MoteAttributes;
-import org.contikios.cooja.interfaces.Position;
-import org.contikios.cooja.interfaces.RimeAddress;
-import org.contikios.cooja.mspmote.interfaces.CC1101Radio;
-import org.contikios.cooja.mspmote.interfaces.CC1120Radio;
-import org.contikios.cooja.mspmote.interfaces.Exp5438LED;
-import org.contikios.cooja.mspmote.interfaces.Msp802154Radio;
-import org.contikios.cooja.mspmote.interfaces.MspClock;
-import org.contikios.cooja.mspmote.interfaces.MspDebugOutput;
-import org.contikios.cooja.mspmote.interfaces.MspMoteID;
-import org.contikios.cooja.mspmote.interfaces.UsciA1Serial;
-
-@ClassDescription("EXP430F5438 mote")
-@AbstractionLevelDescription("Emulated level")
-public class Exp5438MoteType extends MspMoteType {
- private static final Logger logger = LogManager.getLogger(Exp5438MoteType.class);
-
- protected MspMote createMote(Simulation simulation) {
- return new Exp5438Mote(this, simulation);
- }
-
- public boolean configureAndInit(Container parentContainer, Simulation simulation, boolean visAvailable)
- throws MoteTypeCreationException {
-
- /* If visualized, show compile dialog and let user configure */
- if (visAvailable && !simulation.isQuickSetup()) {
-
- /* Create unique identifier */
- if (getIdentifier() == null) {
- int counter = 0;
- boolean identifierOK = false;
- while (!identifierOK) {
- identifierOK = true;
-
- counter++;
- setIdentifier("exp5438#" + counter);
-
- for (MoteType existingMoteType : simulation.getMoteTypes()) {
- if (existingMoteType == this) {
- continue;
- }
- if (existingMoteType.getIdentifier().equals(getIdentifier())) {
- identifierOK = false;
- break;
- }
- }
- }
- }
-
- /* Create initial description */
- if (getDescription() == null) {
- setDescription("Exp5438 Mote Type " + getIdentifier());
- }
-
- return MspCompileDialog.showDialog(parentContainer, simulation, this, "exp5438");
- }
-
- /* Not visualized: Compile Contiki immediately */
- if (getIdentifier() == null) {
- throw new MoteTypeCreationException("No identifier");
- }
-
- final MessageList compilationOutput = MessageContainer.createMessageList(visAvailable);
-
- if (getCompileCommands() != null) {
- /* Handle multiple compilation commands one by one */
- String[] arr = getCompileCommands().split("\n");
- for (String cmd: arr) {
- if (cmd.trim().isEmpty()) {
- continue;
- }
-
- try {
- CompileContiki.compile(
- cmd,
- null,
- null /* Do not observe output firmware file */,
- getContikiSourceFile().getParentFile(),
- null,
- null,
- compilationOutput,
- true
- );
- } catch (Exception e) {
- MoteTypeCreationException newException =
- new MoteTypeCreationException("Mote type creation failed: " + e.getMessage());
- newException = (MoteTypeCreationException) newException.initCause(e);
- newException.setCompilationOutput(compilationOutput);
-
- /* Print last 10 compilation errors to console */
- MessageContainer[] messages = compilationOutput.getMessages();
- for (int i=messages.length-10; i < messages.length; i++) {
- if (i < 0) {
- continue;
- }
- logger.fatal(">> " + messages[i]);
- }
-
- logger.fatal("Compilation error: " + e.getMessage());
- throw newException;
- }
- }
- }
-
- if (getContikiFirmwareFile() == null ||
- !getContikiFirmwareFile().exists()) {
- throw new MoteTypeCreationException("Contiki firmware file does not exist: " + getContikiFirmwareFile());
- }
- return true;
- }
-
- public Icon getMoteTypeIcon() {
- Toolkit toolkit = Toolkit.getDefaultToolkit();
- URL imageURL = this.getClass().getClassLoader().getResource("exp5438.png");
- Image image = toolkit.getImage(imageURL);
- MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer());
- tracker.addImage(image, 1);
- try {
- tracker.waitForAll();
- } catch (InterruptedException ex) {
- }
- if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) {
- image = image.getScaledInstance((200*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 200, Image.SCALE_DEFAULT);
- return new ImageIcon(image);
- }
-
- return null;
- }
-
- public Class extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
- return new Class[] {
- Position.class,
- RimeAddress.class,
- IPAddress.class,
- Mote2MoteRelations.class,
- MoteAttributes.class,
- MspClock.class,
- MspMoteID.class,
- Msp802154Radio.class,
- UsciA1Serial.class,
- Exp5438LED.class,
- /*Exp5438LCD.class,*/ /* TODO */
- MspDebugOutput.class
- };
- }
- public Class extends MoteInterface>[] getAllMoteInterfaceClasses() {
- return new Class[] {
- Position.class,
- RimeAddress.class,
- IPAddress.class,
- Mote2MoteRelations.class,
- MoteAttributes.class,
- MspClock.class,
- MspMoteID.class,
- Msp802154Radio.class,
- CC1101Radio.class,
- CC1120Radio.class,
- UsciA1Serial.class,
- Exp5438LED.class,
- /*Exp5438LCD.class,*/ /* TODO */
- MspDebugOutput.class
- };
- }
-
- public File getExpectedFirmwareFile(File source) {
- File parentDir = source.getParentFile();
- String sourceNoExtension = source.getName().substring(0, source.getName().length()-2);
-
- return new File(parentDir, sourceNoExtension + ".exp5438");
- }
-
- protected String getTargetName() {
- return "exp5438";
- }
-
-}
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC1101Radio.java b/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC1101Radio.java
deleted file mode 100644
index e6ae749ab9..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC1101Radio.java
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * Copyright (c) 2012, Thingsquare.
- * 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.
- *
- */
-
-package org.contikios.cooja.mspmote.interfaces;
-
-import java.util.Collection;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-import org.jdom.Element;
-
-import org.contikios.cooja.ClassDescription;
-import org.contikios.cooja.Mote;
-import org.contikios.cooja.RadioPacket;
-import org.contikios.cooja.Simulation;
-import org.contikios.cooja.interfaces.CustomDataRadio;
-import org.contikios.cooja.interfaces.Position;
-import org.contikios.cooja.interfaces.Radio;
-import org.contikios.cooja.mspmote.MspMote;
-import org.contikios.cooja.mspmote.MspMoteTimeEvent;
-import se.sics.mspsim.chip.CC1101;
-import se.sics.mspsim.chip.CC1101.ReceiverListener;
-import se.sics.mspsim.chip.ChannelListener;
-import se.sics.mspsim.chip.RFListener;
-import se.sics.mspsim.chip.Radio802154;
-
-/**
- * @author Fredrik Osterlind
- */
-@ClassDescription("TI CC1101")
-public class CC1101Radio extends Radio implements CustomDataRadio {
- private static final Logger logger = LogManager.getLogger(CC1101Radio.class);
-
- /**
- * Cross-level:
- * Inter-byte delay for delivering cross-level packet bytes.
- */
- public static final long DELAY_BETWEEN_BYTES =
- (long) (1000.0*Simulation.MILLISECOND/(250000.0/8.0)); /* us. Corresponds to 250kbit/s */
-
- private RadioEvent lastEvent = RadioEvent.UNKNOWN;
-
- private final MspMote mote;
- private final CC1101 cc1101;
-
- private boolean isInterfered = false;
- private boolean isTransmitting = false;
- private boolean isReceiving = false;
-
- private byte lastOutgoingByte;
- private byte lastIncomingByte;
-
- private RadioPacket lastOutgoingPacket = null;
- private RadioPacket lastIncomingPacket = null;
-
- public CC1101Radio(Mote m) {
- this.mote = (MspMote)m;
- Radio802154 r = this.mote.getCPU().getChip(Radio802154.class);
- if (r == null || !(r instanceof CC1101)) {
- throw new IllegalStateException("Mote is not equipped with an CC1101 radio");
- }
- this.cc1101 = (CC1101) r;
-
- cc1101.addRFListener(new RFListener() {
- int len = 0;
- int expLen = 0;
- byte[] buffer = new byte[256 + 15];
- private boolean gotSynchbyte = false;
- public void receivedByte(byte data) {
- if (!isTransmitting()) {
- /* Start transmission */
- lastEvent = RadioEvent.TRANSMISSION_STARTED;
- isTransmitting = true;
- len = 0;
- gotSynchbyte = false;
- /*logger.debug("----- CC1101 TRANSMISSION STARTED -----");*/
- setChanged();
- notifyObservers();
- }
- if (len >= buffer.length) {
- /* Bad size packet, too large */
- logger.debug("Error: bad size: " + len + ", dropping outgoing byte: " + data);
- return;
- }
-
- /* send this byte to all nodes */
- lastOutgoingByte = data;
- lastEvent = RadioEvent.CUSTOM_DATA_TRANSMITTED;
- setChanged();
- notifyObservers();
-
- /* Await synch byte */
- if (!gotSynchbyte) {
- if (lastOutgoingByte == CC1101.SYNCH_BYTE_LAST) {
- gotSynchbyte = true;
- }
- return;
- }
-
- final int HEADERLEN = 1; /* 1x Length byte */
- final int FOOTERLEN = 2; /* TODO Fix CRC in Mspsim's CC1101.java */
- if (len == 0) {
- expLen = (0xff&data) + HEADERLEN + FOOTERLEN;
- }
- buffer[len++] = data;
-
- if (len == expLen) {
- /*logger.debug("----- CC1101 CUSTOM DATA TRANSMITTED -----");*/
-
- final byte[] buf = new byte[expLen];
- System.arraycopy(buffer, 0, buf, 0, expLen);
- lastOutgoingPacket = new RadioPacket() {
- public byte[] getPacketData() {
- return buf;
- }
- };
-
- lastEvent = RadioEvent.PACKET_TRANSMITTED;
- /*logger.debug("----- CC1101 PACKET TRANSMITTED -----");*/
- setChanged();
- notifyObservers();
-
- /*logger.debug("----- CC1101 TRANSMISSION FINISHED -----");*/
- isTransmitting = false;
- lastEvent = RadioEvent.TRANSMISSION_FINISHED;
- setChanged();
- notifyObservers();
- len = 0;
- }
- }
- });
-
- cc1101.setReceiverListener(new ReceiverListener() {
- public void newState(boolean on) {
- if (cc1101.isReadyToReceive()) {
- lastEvent = RadioEvent.HW_ON;
- setChanged();
- notifyObservers();
- } else {
- radioOff();
- }
- }
- });
-
- cc1101.addChannelListener(new ChannelListener() {
- public void channelChanged(int channel) {
- /* XXX Currently assumes zero channel switch time */
- lastEvent = RadioEvent.UNKNOWN;
- setChanged();
- notifyObservers();
- }
- });
- }
-
- private void radioOff() {
- /* Radio was turned off during transmission.
- * May for example happen if watchdog triggers */
- if (isTransmitting()) {
- logger.warn("Turning off radio while transmitting, ending packet prematurely");
-
- /* Simulate end of packet */
- lastOutgoingPacket = new RadioPacket() {
- public byte[] getPacketData() {
- return new byte[0];
- }
- };
-
- lastEvent = RadioEvent.PACKET_TRANSMITTED;
- /*logger.debug("----- CC1101 PACKET TRANSMITTED -----");*/
- setChanged();
- notifyObservers();
-
- /* Register that transmission ended in radio medium */
- /*logger.debug("----- CC1101 TRANSMISSION FINISHED -----");*/
- isTransmitting = false;
- lastEvent = RadioEvent.TRANSMISSION_FINISHED;
- setChanged();
- notifyObservers();
- }
-
- lastEvent = RadioEvent.HW_OFF;
- setChanged();
- notifyObservers();
- }
-
- /* Packet radio support */
- public RadioPacket getLastPacketTransmitted() {
- return lastOutgoingPacket;
- }
-
- public RadioPacket getLastPacketReceived() {
- return lastIncomingPacket;
- }
-
- public void setReceivedPacket(RadioPacket packet) {
- lastIncomingPacket = packet;
-
- /* TODO XXX Need support in CC1101.java */
- /*if (!radio.isReadyToReceive()) {
- logger.warn("Radio receiver not ready, dropping packet data");
- return;
- }*/
-
- /* Delivering packet bytes with delays */
- byte[] packetData = packet.getPacketData();
- long deliveryTime = getMote().getSimulation().getSimulationTime();
- for (byte b: packetData) {
- if (isInterfered()) {
- b = (byte) 0xFF;
- }
-
- final byte byteToDeliver = b;
- getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote) {
- public void execute(long t) {
- super.execute(t);
- cc1101.receivedByte(byteToDeliver);
- mote.requestImmediateWakeup();
- }
- }, deliveryTime);
- deliveryTime += DELAY_BETWEEN_BYTES;
- }
- }
-
- /* Custom data radio support */
- public Object getLastCustomDataTransmitted() {
- return lastOutgoingByte;
- }
-
- public Object getLastCustomDataReceived() {
- return lastIncomingByte;
- }
-
- public void receiveCustomData(Object data) {
- if (!(data instanceof Byte)) {
- logger.fatal("Bad custom data: " + data);
- return;
- }
- lastIncomingByte = (Byte) data;
-
- final byte inputByte;
- if (isInterfered()) {
- inputByte = (byte)0xFF;
- } else {
- inputByte = lastIncomingByte;
- }
- mote.getSimulation().scheduleEvent(new MspMoteTimeEvent(mote) {
- public void execute(long t) {
- super.execute(t);
- cc1101.receivedByte(inputByte);
- mote.requestImmediateWakeup();
- }
- }, mote.getSimulation().getSimulationTime());
-
- }
-
- /* General radio support */
- public boolean isTransmitting() {
- return isTransmitting;
- }
-
- public boolean isReceiving() {
- return isReceiving;
- }
-
- public boolean isInterfered() {
- return isInterfered;
- }
-
- public int getChannel() {
- return cc1101.getActiveChannel();
- }
-
- public int getFrequency() {
- return cc1101.getActiveFrequency();
- }
-
- public void signalReceptionStart() {
- isReceiving = true;
-
- lastEvent = RadioEvent.RECEPTION_STARTED;
- /*logger.debug("----- CC1101 RECEPTION STARTED -----");*/
- setChanged();
- notifyObservers();
- }
-
- public void signalReceptionEnd() {
- /* Deliver packet data */
- isReceiving = false;
- isInterfered = false;
-
- lastEvent = RadioEvent.RECEPTION_FINISHED;
- /*logger.debug("----- CC1101 RECEPTION FINISHED -----");*/
- setChanged();
- notifyObservers();
- }
-
- public RadioEvent getLastEvent() {
- return lastEvent;
- }
-
- public void interfereAnyReception() {
- isInterfered = true;
- isReceiving = false;
- lastIncomingPacket = null;
-
- lastEvent = RadioEvent.RECEPTION_INTERFERED;
- /*logger.debug("----- CC1101 RECEPTION INTERFERED -----");*/
- setChanged();
- notifyObservers();
- }
-
- public double getCurrentOutputPower() {
- /* TODO XXX Need support in CC1101.java */
- return 1;
- }
- public int getCurrentOutputPowerIndicator() {
- /* TODO XXX Need support in CC1101.java */
- return 10;
- }
- public int getOutputPowerIndicatorMax() {
- /* TODO XXX Need support in CC1101.java */
- return 10;
- }
-
-
- /**
- * Last 8 received signal strengths
- */
- double currentSignalStrength = 0;
- private double[] rssiLast = new double[8];
- private int rssiLastCounter = 0;
-
- public double getCurrentSignalStrength() {
- return currentSignalStrength;
- }
-
- public void setCurrentSignalStrength(final double signalStrength) {
- if (signalStrength == currentSignalStrength) {
- return; /* ignored */
- }
- currentSignalStrength = signalStrength;
- if (rssiLastCounter == 0) {
- getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote) {
- public void execute(long t) {
- super.execute(t);
-
- /* Update average */
- System.arraycopy(rssiLast, 1, rssiLast, 0, 7);
- rssiLast[7] = currentSignalStrength;
- double avg = 0;
- for (double v: rssiLast) {
- avg += v;
- }
- avg /= rssiLast.length;
-
- cc1101.setRSSI((int) avg);
-
- rssiLastCounter--;
- if (rssiLastCounter > 0) {
- mote.getSimulation().scheduleEvent(this, t+DELAY_BETWEEN_BYTES/2);
- }
- }
- }, mote.getSimulation().getSimulationTime());
- }
- rssiLastCounter = 8;
- }
-
- public Mote getMote() {
- return mote;
- }
-
- public Position getPosition() {
- return mote.getInterfaces().getPosition();
- }
-
- public Collection getConfigXML() {
- return null;
- }
-
- public void setConfigXML(Collection configXML, boolean visAvailable) {
- }
-
- public boolean isRadioOn() {
- return cc1101.isReadyToReceive();
- }
-
- public boolean canReceiveFrom(CustomDataRadio radio) {
- if (radio.getClass().equals(this.getClass())) {
- return true;
- }
- if (radio.getClass().equals(CC430Radio.class)) {
- return true;
- }
- return false;
- }
-}
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC1120Radio.java b/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC1120Radio.java
deleted file mode 100644
index 45fefd0129..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC1120Radio.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Copyright (c) 2012, Thingsquare.
- * 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.
- *
- */
-
-package org.contikios.cooja.mspmote.interfaces;
-
-import java.util.Collection;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-import org.jdom.Element;
-
-import org.contikios.cooja.ClassDescription;
-import org.contikios.cooja.Mote;
-import org.contikios.cooja.RadioPacket;
-import org.contikios.cooja.Simulation;
-import org.contikios.cooja.interfaces.CustomDataRadio;
-import org.contikios.cooja.interfaces.Position;
-import org.contikios.cooja.interfaces.Radio;
-import org.contikios.cooja.mspmote.MspMote;
-import org.contikios.cooja.mspmote.MspMoteTimeEvent;
-import se.sics.mspsim.chip.CC1120;
-import se.sics.mspsim.chip.CC1120.ReceiverListener;
-import se.sics.mspsim.chip.ChannelListener;
-import se.sics.mspsim.chip.RFListener;
-import se.sics.mspsim.chip.Radio802154;
-
-/**
- * @author Fredrik Osterlind
- */
-@ClassDescription("TI CC1120")
-public class CC1120Radio extends Radio implements CustomDataRadio {
- private static final Logger logger = LogManager.getLogger(CC1120Radio.class);
-
- /**
- * Cross-level:
- * Inter-byte delay for delivering cross-level packet bytes.
- */
- /* TODO XXX Fix me as well as symbol duration in CC1120.java */
- public static final long DELAY_BETWEEN_BYTES =
- (long) (1000.0*Simulation.MILLISECOND/(200000.0/8.0)); /* us. Corresponds to 200kbit/s */
-
- private RadioEvent lastEvent = RadioEvent.UNKNOWN;
-
- private final MspMote mote;
- private final CC1120 cc1120;
-
- private boolean isInterfered = false;
- private boolean isTransmitting = false;
- private boolean isReceiving = false;
-
- private byte lastOutgoingByte;
- private byte lastIncomingByte;
-
- private RadioPacket lastOutgoingPacket = null;
- private RadioPacket lastIncomingPacket = null;
-
- public CC1120Radio(Mote m) {
- this.mote = (MspMote)m;
- Radio802154 r = this.mote.getCPU().getChip(Radio802154.class);
- if (r == null || !(r instanceof CC1120)) {
- throw new IllegalStateException("Mote is not equipped with an CC1120 radio");
- }
- this.cc1120 = (CC1120) r;
-
- cc1120.addRFListener(new RFListener() {
- int len = 0;
- int expLen = 0;
- byte[] buffer = new byte[256 + 15];
- private boolean gotSynchbyte = false;
- public void receivedByte(byte data) {
- if (!isTransmitting()) {
- /* Start transmission */
- lastEvent = RadioEvent.TRANSMISSION_STARTED;
- isTransmitting = true;
- len = 0;
- gotSynchbyte = false;
- /*logger.debug("----- CCC1120 TRANSMISSION STARTED -----");*/
- setChanged();
- notifyObservers();
- }
- if (len >= buffer.length) {
- /* Bad size packet, too large */
- logger.debug("Error: bad size: " + len + ", dropping outgoing byte: " + data);
- return;
- }
-
- /* send this byte to all nodes */
- lastOutgoingByte = data;
- lastEvent = RadioEvent.CUSTOM_DATA_TRANSMITTED;
- setChanged();
- notifyObservers();
-
- /* Await synch byte */
- if (!gotSynchbyte) {
- if (lastOutgoingByte == CC1120.SYNCH_BYTE_LAST) {
- gotSynchbyte = true;
- }
- return;
- }
-
- final int HEADERLEN = 1; /* 1x Length byte */
- final int FOOTERLEN = 2; /* TODO Fix CRC in Mspsim's CCC1120.java */
- if (len == 0) {
- expLen = (0xff&data) + HEADERLEN + FOOTERLEN;
- }
- buffer[len++] = data;
-
- if (len == expLen) {
- /*logger.debug("----- CCC1120 CUSTOM DATA TRANSMITTED -----");*/
-
- final byte[] buf = new byte[expLen];
- System.arraycopy(buffer, 0, buf, 0, expLen);
- lastOutgoingPacket = new RadioPacket() {
- public byte[] getPacketData() {
- return buf;
- }
- };
-
- lastEvent = RadioEvent.PACKET_TRANSMITTED;
- /*logger.debug("----- CCC1120 PACKET TRANSMITTED -----");*/
- setChanged();
- notifyObservers();
-
- /*logger.debug("----- CCC1120 TRANSMISSION FINISHED -----");*/
- isTransmitting = false;
- lastEvent = RadioEvent.TRANSMISSION_FINISHED;
- setChanged();
- notifyObservers();
- len = 0;
- }
- }
- });
-
- cc1120.setReceiverListener(new ReceiverListener() {
- public void newState(boolean on) {
- if (cc1120.isReadyToReceive()) {
- lastEvent = RadioEvent.HW_ON;
- setChanged();
- notifyObservers();
- } else {
- radioOff();
- }
- }
- });
-
- cc1120.addChannelListener(new ChannelListener() {
- public void channelChanged(int channel) {
- /* XXX Currently assumes zero channel switch time */
- lastEvent = RadioEvent.UNKNOWN;
- setChanged();
- notifyObservers();
- }
- });
- }
-
- private void radioOff() {
- /* Radio was turned off during transmission.
- * May for example happen if watchdog triggers */
- if (isTransmitting()) {
- logger.warn("Turning off radio while transmitting, ending packet prematurely");
-
- /* Simulate end of packet */
- lastOutgoingPacket = new RadioPacket() {
- public byte[] getPacketData() {
- return new byte[0];
- }
- };
-
- lastEvent = RadioEvent.PACKET_TRANSMITTED;
- /*logger.debug("----- CCC1120 PACKET TRANSMITTED -----");*/
- setChanged();
- notifyObservers();
-
- /* Register that transmission ended in radio medium */
- /*logger.debug("----- CCC1120 TRANSMISSION FINISHED -----");*/
- isTransmitting = false;
- lastEvent = RadioEvent.TRANSMISSION_FINISHED;
- setChanged();
- notifyObservers();
- }
-
- lastEvent = RadioEvent.HW_OFF;
- setChanged();
- notifyObservers();
- }
-
- /* Packet radio support */
- public RadioPacket getLastPacketTransmitted() {
- return lastOutgoingPacket;
- }
-
- public RadioPacket getLastPacketReceived() {
- return lastIncomingPacket;
- }
-
- public void setReceivedPacket(RadioPacket packet) {
- lastIncomingPacket = packet;
-
- /* TODO XXX Need support in CCC1120.java */
- /*if (!radio.isReadyToReceive()) {
- logger.warn("Radio receiver not ready, dropping packet data");
- return;
- }*/
-
- /* Delivering packet bytes with delays */
- byte[] packetData = packet.getPacketData();
- long deliveryTime = getMote().getSimulation().getSimulationTime();
- for (byte b: packetData) {
- if (isInterfered()) {
- b = (byte) 0xFF;
- }
-
- final byte byteToDeliver = b;
- getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote) {
- public void execute(long t) {
- super.execute(t);
- cc1120.receivedByte(byteToDeliver);
- mote.requestImmediateWakeup();
- }
- }, deliveryTime);
- deliveryTime += DELAY_BETWEEN_BYTES;
- }
- }
-
- /* Custom data radio support */
- public Object getLastCustomDataTransmitted() {
- return lastOutgoingByte;
- }
-
- public Object getLastCustomDataReceived() {
- return lastIncomingByte;
- }
-
- public void receiveCustomData(Object data) {
- if (!(data instanceof Byte)) {
- logger.fatal("Bad custom data: " + data);
- return;
- }
- lastIncomingByte = (Byte) data;
-
- final byte inputByte;
- if (isInterfered()) {
- inputByte = (byte)0xFF;
- } else {
- inputByte = lastIncomingByte;
- }
- mote.getSimulation().scheduleEvent(new MspMoteTimeEvent(mote) {
- public void execute(long t) {
- super.execute(t);
- cc1120.receivedByte(inputByte);
- mote.requestImmediateWakeup();
- }
- }, mote.getSimulation().getSimulationTime());
-
- }
-
- /* General radio support */
- public boolean isTransmitting() {
- return isTransmitting;
- }
-
- public boolean isReceiving() {
- return isReceiving;
- }
-
- public boolean isInterfered() {
- return isInterfered;
- }
-
- public int getChannel() {
- return cc1120.getActiveChannel()+1000;
- }
-
- public int getFrequency() {
- return cc1120.getActiveFrequency();
- }
-
- public void signalReceptionStart() {
- isReceiving = true;
-
- lastEvent = RadioEvent.RECEPTION_STARTED;
- /*logger.debug("----- CCC1120 RECEPTION STARTED -----");*/
- setChanged();
- notifyObservers();
- }
-
- public void signalReceptionEnd() {
- /* Deliver packet data */
- isReceiving = false;
- isInterfered = false;
-
- lastEvent = RadioEvent.RECEPTION_FINISHED;
- /*logger.debug("----- CCC1120 RECEPTION FINISHED -----");*/
- setChanged();
- notifyObservers();
- }
-
- public RadioEvent getLastEvent() {
- return lastEvent;
- }
-
- public void interfereAnyReception() {
- isInterfered = true;
- isReceiving = false;
- lastIncomingPacket = null;
-
- lastEvent = RadioEvent.RECEPTION_INTERFERED;
- /*logger.debug("----- CCC1120 RECEPTION INTERFERED -----");*/
- setChanged();
- notifyObservers();
- }
-
- public double getCurrentOutputPower() {
- /* TODO XXX Need support in CCC1120.java */
- return 1;
- }
- public int getCurrentOutputPowerIndicator() {
- /* TODO XXX Need support in CCC1120.java */
- return 10;
- }
- public int getOutputPowerIndicatorMax() {
- /* TODO XXX Need support in CCC1120.java */
- return 10;
- }
-
-
- /**
- * Last 8 received signal strengths
- */
- double currentSignalStrength = 0;
- private double[] rssiLast = new double[8];
- private int rssiLastCounter = 0;
-
- public double getCurrentSignalStrength() {
- return currentSignalStrength;
- }
-
- public void setCurrentSignalStrength(final double signalStrength) {
- if (signalStrength == currentSignalStrength) {
- return; /* ignored */
- }
- currentSignalStrength = signalStrength;
- if (rssiLastCounter == 0) {
- getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote) {
- public void execute(long t) {
- super.execute(t);
-
- /* Update average */
- System.arraycopy(rssiLast, 1, rssiLast, 0, 7);
- rssiLast[7] = currentSignalStrength;
- double avg = 0;
- for (double v: rssiLast) {
- avg += v;
- }
- avg /= rssiLast.length;
-
- cc1120.setRSSI((int) avg);
-
- rssiLastCounter--;
- if (rssiLastCounter > 0) {
- mote.getSimulation().scheduleEvent(this, t+DELAY_BETWEEN_BYTES/2);
- }
- }
- }, mote.getSimulation().getSimulationTime());
- }
- rssiLastCounter = 8;
- }
-
- public Mote getMote() {
- return mote;
- }
-
- public Position getPosition() {
- return mote.getInterfaces().getPosition();
- }
-
- public Collection getConfigXML() {
- return null;
- }
-
- public void setConfigXML(Collection configXML, boolean visAvailable) {
- }
-
- public boolean isRadioOn() {
- return cc1120.isReadyToReceive();
- }
-
- public boolean canReceiveFrom(CustomDataRadio radio) {
- if (radio.getClass().equals(this.getClass())) {
- return true;
- }
- return false;
- }
-
-}
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC2520Radio.java b/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC2520Radio.java
deleted file mode 100644
index f3e55d6ffb..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC2520Radio.java
+++ /dev/null
@@ -1,379 +0,0 @@
-
-package org.contikios.cooja.mspmote.interfaces;
-
-import java.util.Collection;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-import org.jdom.Element;
-
-import org.contikios.cooja.ClassDescription;
-import org.contikios.cooja.Mote;
-import org.contikios.cooja.RadioPacket;
-import org.contikios.cooja.Simulation;
-import org.contikios.cooja.interfaces.CustomDataRadio;
-import org.contikios.cooja.interfaces.Position;
-import org.contikios.cooja.interfaces.Radio;
-import org.contikios.cooja.mspmote.MspMote;
-import org.contikios.cooja.mspmote.MspMoteTimeEvent;
-import org.contikios.cooja.mspmote.interfaces.CC2420RadioPacketConverter;
-import se.sics.mspsim.chip.CC2520;
-import se.sics.mspsim.chip.ChannelListener;
-import se.sics.mspsim.chip.RFListener;
-import se.sics.mspsim.core.Chip;
-import se.sics.mspsim.core.OperatingModeListener;
-
-/**
- * MSPSim CC2520 radio to COOJA wrapper.
- *
- * @author Fredrik Osterlind
- */
-@ClassDescription("IEEE CC2520 Radio")
-public class CC2520Radio extends Radio implements CustomDataRadio {
- private static final Logger logger = LogManager.getLogger(CC2520Radio.class);
-
- /**
- * Cross-level:
- * Inter-byte delay for delivering cross-level packet bytes.
- */
- public static final long DELAY_BETWEEN_BYTES =
- (long) (1000.0*Simulation.MILLISECOND/(250000.0/8.0)); /* us. Corresponds to 250kbit/s */
-
- private RadioEvent lastEvent = RadioEvent.UNKNOWN;
-
- private final MspMote mote;
- private final CC2520 radio;
-
- private boolean isInterfered = false;
- private boolean isTransmitting = false;
- private boolean isReceiving = false;
-
- private byte lastOutgoingByte;
- private byte lastIncomingByte;
-
- private RadioPacket lastOutgoingPacket = null;
- private RadioPacket lastIncomingPacket = null;
-
- public CC2520Radio(Mote m) {
- this.mote = (MspMote)m;
- this.radio = this.mote.getCPU().getChip(CC2520.class);
- if (radio == null) {
- throw new IllegalStateException("Mote is not equipped with an IEEE CC2520 radio");
- }
-
- radio.addRFListener(new RFListener() {
- int len = 0;
- int expLen = 0;
- byte[] buffer = new byte[127 + 15];
- public void receivedByte(byte data) {
- if (!isTransmitting()) {
- lastEvent = RadioEvent.TRANSMISSION_STARTED;
- isTransmitting = true;
- len = 0;
- /*logger.debug("----- CC2520 TRANSMISSION STARTED -----");*/
- setChanged();
- notifyObservers();
- }
-
- if (len >= buffer.length) {
- /* Bad size packet, too large */
- logger.debug("Error: bad size: " + len + ", dropping outgoing byte: " + data);
- return;
- }
-
- /* send this byte to all nodes */
- lastOutgoingByte = data;
- lastEvent = RadioEvent.CUSTOM_DATA_TRANSMITTED;
- setChanged();
- notifyObservers();
-
- buffer[len++] = data;
-
- if (len == 6) {
-// System.out.println("## CC2520 Packet of length: " + data + " expected...");
- expLen = data + 6;
- }
-
- if (len == expLen) {
- /*logger.debug("----- CC2520 CUSTOM DATA TRANSMITTED -----");*/
- len -= 4; /* preamble */
- len -= 1; /* synch */
- len -= radio.getFooterLength(); /* footer */
- final byte[] packetdata = new byte[len];
- System.arraycopy(buffer, 4+1, packetdata, 0, len);
- lastOutgoingPacket = new RadioPacket() {
- public byte[] getPacketData() {
- return packetdata;
- }
- };
-
- /*logger.debug("----- CC2520 PACKET TRANSMITTED -----");*/
- setChanged();
- notifyObservers();
-
- /*logger.debug("----- CC2520 TRANSMISSION FINISHED -----");*/
- isTransmitting = false;
- lastEvent = RadioEvent.TRANSMISSION_FINISHED;
- setChanged();
- notifyObservers();
- len = 0;
- }
- }
- });
-
- radio.addOperatingModeListener(new OperatingModeListener() {
- public void modeChanged(Chip source, int mode) {
- if (radio.isReadyToReceive()) {
- lastEvent = RadioEvent.HW_ON;
- setChanged();
- notifyObservers();
- } else {
- radioOff();
- }
- }
- });
-
- radio.addChannelListener(new ChannelListener() {
- public void channelChanged(int channel) {
- /* XXX Currently assumes zero channel switch time */
- lastEvent = RadioEvent.UNKNOWN;
- setChanged();
- notifyObservers();
- }
- });
- }
-
- private void radioOff() {
- /* Radio was turned off during transmission.
- * May for example happen if watchdog triggers */
- if (isTransmitting()) {
- logger.warn("Turning off radio while transmitting, ending packet prematurely");
-
- /* Simulate end of packet */
- lastOutgoingPacket = new RadioPacket() {
- public byte[] getPacketData() {
- return new byte[0];
- }
- };
-
- lastEvent = RadioEvent.PACKET_TRANSMITTED;
- /*logger.debug("----- CC2520 PACKET TRANSMITTED -----");*/
- setChanged();
- notifyObservers();
-
- /* Register that transmission ended in radio medium */
- /*logger.debug("----- CC2520 TRANSMISSION FINISHED -----");*/
- isTransmitting = false;
- lastEvent = RadioEvent.TRANSMISSION_FINISHED;
- setChanged();
- notifyObservers();
- }
-
- lastEvent = RadioEvent.HW_OFF;
- setChanged();
- notifyObservers();
- }
-
- /* Packet radio support */
- public RadioPacket getLastPacketTransmitted() {
- return lastOutgoingPacket;
- }
-
- public RadioPacket getLastPacketReceived() {
- return lastIncomingPacket;
- }
-
- public void setReceivedPacket(RadioPacket packet) {
- logger.fatal("TODO Implement me!");
- }
-
- /* Custom data radio support */
- public Object getLastCustomDataTransmitted() {
- return lastOutgoingByte;
- }
-
- public Object getLastCustomDataReceived() {
- return lastIncomingByte;
- }
-
- public void receiveCustomData(Object data) {
- if (!(data instanceof Byte)) {
- logger.fatal("Bad custom data: " + data);
- return;
- }
- lastIncomingByte = (Byte) data;
-
- final byte inputByte;
- if (isInterfered()) {
- inputByte = (byte)0xFF;
- } else {
- inputByte = lastIncomingByte;
- }
- mote.getSimulation().scheduleEvent(new MspMoteTimeEvent(mote) {
- public void execute(long t) {
- super.execute(t);
- radio.receivedByte(inputByte);
- mote.requestImmediateWakeup();
- }
- }, mote.getSimulation().getSimulationTime());
-
- }
-
- /* General radio support */
- public boolean isTransmitting() {
- return isTransmitting;
- }
-
- public boolean isReceiving() {
- return isReceiving;
- }
-
- public boolean isInterfered() {
- return isInterfered;
- }
-
- public int getChannel() {
- return radio.getActiveChannel();
- }
-
- public int getFrequency() {
- return radio.getActiveFrequency();
- }
-
- public void signalReceptionStart() {
- isReceiving = true;
-
- lastEvent = RadioEvent.RECEPTION_STARTED;
- /*logger.debug("----- CC2520 RECEPTION STARTED -----");*/
- setChanged();
- notifyObservers();
- }
-
- public void signalReceptionEnd() {
- /* Deliver packet data */
- isReceiving = false;
- isInterfered = false;
-
- lastEvent = RadioEvent.RECEPTION_FINISHED;
- /*logger.debug("----- CC2520 RECEPTION FINISHED -----");*/
- setChanged();
- notifyObservers();
- }
-
- public RadioEvent getLastEvent() {
- return lastEvent;
- }
-
- public void interfereAnyReception() {
- isInterfered = true;
- isReceiving = false;
- lastIncomingPacket = null;
-
- lastEvent = RadioEvent.RECEPTION_INTERFERED;
- /*logger.debug("----- CC2520 RECEPTION INTERFERED -----");*/
- setChanged();
- notifyObservers();
- }
-
- public double getCurrentOutputPower() {
- return radio.getOutputPower();
- }
-
- public int getCurrentOutputPowerIndicator() {
- return 100;
-// return radio.getOutputPowerIndicator();
- }
-
- public int getOutputPowerIndicatorMax() {
- return 100;
-// return 31;
- }
-
- double currentSignalStrength = 0;
-
- /**
- * Last 8 received signal strengths
- */
- private double[] rssiLast = new double[8];
- private int rssiLastCounter = 0;
-
- public double getCurrentSignalStrength() {
- return currentSignalStrength;
- }
-
- public void setCurrentSignalStrength(final double signalStrength) {
- if (signalStrength == currentSignalStrength) {
- return; /* ignored */
- }
- currentSignalStrength = signalStrength;
- if (rssiLastCounter == 0) {
- getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote) {
- public void execute(long t) {
- super.execute(t);
-
- /* Update average */
- System.arraycopy(rssiLast, 1, rssiLast, 0, 7);
- rssiLast[7] = currentSignalStrength;
- double avg = 0;
- for (double v: rssiLast) {
- avg += v;
- }
- avg /= rssiLast.length;
-
- radio.setRSSI((int) avg);
-
- rssiLastCounter--;
- if (rssiLastCounter > 0) {
- mote.getSimulation().scheduleEvent(this, t+DELAY_BETWEEN_BYTES/2);
- }
- }
- }, mote.getSimulation().getSimulationTime());
- }
- rssiLastCounter = 8;
- }
-
-
- public void setLQI(int lqi){
- radio.setLQI(lqi);
- }
-
- public int getLQI(){
- return radio.getLQI();
- }
-
-
- public Mote getMote() {
- return mote;
- }
-
- public Position getPosition() {
- return mote.getInterfaces().getPosition();
- }
-
- public Collection getConfigXML() {
- return null;
- }
-
- public void setConfigXML(Collection configXML, boolean visAvailable) {
- }
-
- public boolean isRadioOn() {
- if (radio.isReadyToReceive()) {
- return true;
- }
- if (radio.getMode() == CC2520.MODE_POWER_OFF) {
- return false;
- }
- if (radio.getMode() == CC2520.MODE_TXRX_OFF) {
- return false;
- }
- return true;
- }
-
- public boolean canReceiveFrom(CustomDataRadio radio) {
- if (radio.getClass().equals(this.getClass())) {
- return true;
- }
- return false;
- }
-}
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC430Radio.java b/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC430Radio.java
deleted file mode 100644
index 9acbd142e6..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CC430Radio.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2012, Thingsquare.
- * 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.
- *
- */
-
-package org.contikios.cooja.mspmote.interfaces;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-
-import org.contikios.cooja.ClassDescription;
-import org.contikios.cooja.Mote;
-import org.contikios.cooja.interfaces.CustomDataRadio;
-
-/**
- * @author Fredrik Osterlind
- */
-@ClassDescription("TI CC1101 (CC430)")
-public class CC430Radio extends CC1101Radio implements CustomDataRadio {
- private static final Logger logger = LogManager.getLogger(CC1101Radio.class);
-
- public CC430Radio(Mote m) {
- super(m);
- }
-
-}
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CoojaExternalFlash.java b/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CoojaExternalFlash.java
deleted file mode 100644
index d59714230d..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/CoojaExternalFlash.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- */
-
-package org.contikios.cooja.mspmote.interfaces;
-
-import java.io.IOException;
-import org.contikios.coffee.CoffeeConfiguration;
-import org.contikios.coffee.CoffeeImage;
-import se.sics.mspsim.chip.MemoryStorage;
-
-public class CoojaExternalFlash extends MemoryStorage implements CoffeeImage {
-
- private final String target;
- private CoffeeConfiguration coffeeConfiguration;
-
- public CoojaExternalFlash(String target) {
- this.target = target;
- }
-
- /**
- * XXX Coffee specific: uses start offset
- * @see org.contikios.coffee.CoffeeImage#erase(int, int)
- */
- public void erase(int size, int offset) throws IOException {
- byte[] buffer = new byte[size];
- write(getConfiguration().startOffset + offset, buffer);
- }
-
- /**
- * XXX Coffee specific: uses start offset
- * @see org.contikios.coffee.CoffeeImage#getConfiguration()
- */
- public CoffeeConfiguration getConfiguration() {
- if (coffeeConfiguration == null) {
- try {
- coffeeConfiguration = new CoffeeConfiguration(target + ".properties");
- } catch (Exception e) {
- // Failed to retrieve coffee configuration
- throw new IllegalStateException("no Coffee configuration available for platform " + target);
- }
- }
- return coffeeConfiguration;
- }
-
- /**
- * XXX Coffee specific: uses start offset
- * @see org.contikios.coffee.CoffeeImage#read(byte[], int, int)
- */
- public void read(byte[] bytes, int size, int offset) throws IOException {
- read(getConfiguration().startOffset + offset, bytes, 0, size);
- }
-
- /**
- * XXX Coffee specific: uses start offset
- * @see org.contikios.coffee.CoffeeImage#write(byte[], int, int)
- */
- public void write(byte[] bytes, int size, int offset) throws IOException {
- read(getConfiguration().startOffset + offset, bytes, 0, size);
- }
-
-}
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/Exp5438LED.java b/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/Exp5438LED.java
deleted file mode 100644
index 61ee5a9f52..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/Exp5438LED.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2011, 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.
- */
-
-package org.contikios.cooja.mspmote.interfaces;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.util.Collection;
-import java.util.Observable;
-import java.util.Observer;
-
-import javax.swing.JPanel;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-import org.jdom.Element;
-
-import org.contikios.cooja.ClassDescription;
-import org.contikios.cooja.Mote;
-import org.contikios.cooja.interfaces.LED;
-import org.contikios.cooja.mspmote.Exp5438Mote;
-import se.sics.mspsim.core.IOPort;
-import se.sics.mspsim.core.IOUnit;
-import se.sics.mspsim.core.PortListener;
-import se.sics.mspsim.platform.ti.Exp5438Node;
-
-/**
- * @author Fredrik Osterlind
- */
-@ClassDescription("Exp5438 LEDs")
-public class Exp5438LED extends LED {
- private static final Logger logger = LogManager.getLogger(Exp5438LED.class);
-
- private Exp5438Mote mspMote;
-
- private boolean redOn = false;
- private boolean yellowOn = false;
-
- private static final Color RED = new Color(255, 0, 0);
- private static final Color DARK_RED = new Color(100, 0, 0);
- private static final Color YELLOW = new Color(255, 255, 0);
- private static final Color DARK_YELLOW = new Color(184,134,11);
-
- public Exp5438LED(Mote mote) {
- mspMote = (Exp5438Mote) mote;
-
- IOUnit unit = mspMote.getCPU().getIOUnit("P1");
- if (unit instanceof IOPort) {
- ((IOPort) unit).addPortListener(new PortListener() {
- public void portWrite(IOPort source, int data) {
- redOn = (data & Exp5438Node.LEDS_CONF_RED) != 0;
- yellowOn = (data & Exp5438Node.LEDS_CONF_YELLOW) != 0;
- setChanged();
- notifyObservers();
- }
- });
- }
- }
-
- public boolean isAnyOn() {
- return redOn || yellowOn;
- }
-
- public boolean isGreenOn() {
- return false; /* does not exist */
- }
-
- public boolean isRedOn() {
- return redOn;
- }
-
- public boolean isYellowOn() {
- return yellowOn;
- }
-
- public JPanel getInterfaceVisualizer() {
- final JPanel panel = new JPanel() {
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
-
- int x = 20;
- int y = 25;
- int d = 25;
-
- if (isRedOn()) {
- g.setColor(RED);
- g.fillOval(x, y, d, d);
- g.setColor(Color.BLACK);
- g.drawOval(x, y, d, d);
- } else {
- g.setColor(DARK_RED);
- g.fillOval(x + 5, y + 5, d-10, d-10);
- }
-
- x += 40;
-
- if (isYellowOn()) {
- g.setColor(YELLOW);
- g.fillOval(x, y, d, d);
- g.setColor(Color.BLACK);
- g.drawOval(x, y, d, d);
- } else {
- g.setColor(DARK_YELLOW);
- g.fillOval(x + 5, y + 5, d-10, d-10);
- }
- }
- };
-
- Observer observer;
- this.addObserver(observer = new Observer() {
- public void update(Observable obs, Object obj) {
- panel.repaint();
- }
- });
-
- // Saving observer reference for releaseInterfaceVisualizer
- panel.putClientProperty("intf_obs", observer);
-
- panel.setMinimumSize(new Dimension(140, 60));
- panel.setPreferredSize(new Dimension(140, 60));
-
- return panel;
- }
-
- public void releaseInterfaceVisualizer(JPanel panel) {
- Observer observer = (Observer) panel.getClientProperty("intf_obs");
- if (observer == null) {
- logger.fatal("Error when releasing panel, observer is null");
- return;
- }
-
- this.deleteObserver(observer);
- }
-
-
- public Collection getConfigXML() {
- return null;
- }
-
- public void setConfigXML(Collection configXML, boolean visAvailable) {
- }
-
-}
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/GCRCoder.java b/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/GCRCoder.java
deleted file mode 100644
index 733446cc0b..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/GCRCoder.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- */
-
-package org.contikios.cooja.mspmote.interfaces;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-
-/**
- * Ported from contiki-2.x/core/lib/gcr.[ch].
- *
- * @author Fredrik Osterlind
- */
-public class GCRCoder {
- private static final Logger logger = LogManager.getLogger(GCRCoder.class);
-
- /*
- * GCR conversion table - used for converting ordinary byte to 10-bits (or 4
- * bits to 5)
- */
- static final int[] GCR_encode = new int[] { 0x0a, 0x0b, 0x12, 0x13, 0x0e,
- 0x0f, 0x16, 0x17, 0x09, 0x19, 0x1a, 0x1b, 0x0d, 0x1d, 0x1e, 0x15 };
-
- /* 5 bits > 4 bits (0xff => invalid) */
- static final int[] GCR_decode = new int[] { 0xff, 0xff, 0xff, 0xff, // 0 -
- // 3invalid...
- 0xff, 0xff, 0xff, 0xff, // 4 - 7 invalid...
- 0xff, 0x08, 0x00, 0x01, // 8 invalid... 9 = 8, a = 0, b = 1
- 0xff, 0x0c, 0x04, 0x05, // c invalid... d = c, e = 4, f = 5
-
- 0xff, 0xff, 0x02, 0x03, // 10-11 invalid...
- 0xff, 0x0f, 0x06, 0x07, // 14 invalid...
- 0xff, 0x09, 0x0a, 0x0b, // 18 invalid...
- 0xff, 0x0d, 0x0e, 0xff, // 1c, 1f invalid...
- };
-
- private int gcr_bits = 0;
-
- private int gcr_val = 0;
-
- public GCRCoder() {
- }
-
- /* Call before starting encoding or decoding */
- public void gcr_init() {
- gcr_val = 0;
- gcr_bits = 0;
- }
-
- /* Use this to check if encoding / decoding is complete for now */
- public boolean gcr_finished() {
- return gcr_bits == 0;
- }
-
- /* Encode one character - and store in bits - get encoded with get_encoded */
- void gcr_encode(int raw_data) {
- gcr_val |= ((GCR_encode[raw_data >> 4] << 5) | GCR_encode[raw_data & 0xf]) << gcr_bits;
- gcr_bits += 10;
- }
-
- /* Gets the current char of the encoded stream */
- boolean gcr_get_encoded(int[] raw_data, int current_pos) {
- if (gcr_bits >= 8) {
- raw_data[current_pos] = (gcr_val & 0xff);
- gcr_val = gcr_val >> 8;
- gcr_bits = gcr_bits - 8;
- return true;
- }
- return false;
- }
-
- /* Decode one char - result can be get from get_decoded */
- void gcr_decode(int gcr_data) {
- gcr_val |= gcr_data << gcr_bits;
- gcr_bits += 8;
- }
-
- /* check if the current decoded stream is correct */
- boolean gcr_valid() {
- if (gcr_bits >= 10) {
- int val = gcr_val & 0x3ff;
- if ((GCR_decode[val >> 5] << 4) == 0xff
- || (GCR_decode[val & 0x1f]) == 0xff) {
- return false;
- }
- }
- return true;
- }
-
- /* gets the decoded stream - if any char is available */
- boolean gcr_get_decoded(int[] raw_data, int current_pos) {
- if (gcr_bits >= 10) {
- int val = gcr_val & 0x3ff;
- raw_data[current_pos] = ((GCR_decode[val >> 5] << 4) | (GCR_decode[val & 0x1f]));
- gcr_val = gcr_val >> 10;
- gcr_bits = gcr_bits - 10;
- return true;
- }
- return false;
- }
-
- /**
- * Decodes given data. If decoding fails null is returned.
- *
- * WARNING! Decoding encoded data may differ from original data due to
- * appended zeroes during encoding.
- *
- * @param data
- * Data
- * @param dataLength
- * Data length to decode
- * @return Decoded data or null
- */
- public byte[] gcrDecode(byte[] data, int dataLength) {
- // Reset GCR (de)coder
- gcr_init();
-
- // Length of decoded data
- int convertedLength = 0;
-
- // Temporary decoded data storage
- int[] convertedInts = new int[dataLength]; // Maximum length
-
- for (int i = 0; i < dataLength; i++) {
-
- // Try decode byte
- gcr_decode(0xff & data[i]);
- if (!gcr_valid()) {
- logger.fatal("GCR decoding failed, dropping packet");
- return null;
- }
-
- // If new byte decoded, store it
- if (gcr_get_decoded(convertedInts, convertedLength)) {
- convertedLength++;
- }
- }
-
- // Convert to byte array
- byte[] convertedBytes = new byte[convertedLength];
- for (int i = 0; i < convertedLength; i++) {
- convertedBytes[i] = (byte) (0xff & convertedInts[i]);
- }
-
- return convertedBytes;
- }
-
- /**
- * Encodes given data. If encoding fails null is returned.
- *
- * WARNING! May append data by extra zeroes if needed by GCR.
- *
- * @param data
- * Data
- * @param dataLength
- * Data length to decode
- * @return Encoded data or null
- */
- public byte[] gcrEncode(byte[] data, int dataLength) {
- // Reset GCR (en)coder
- gcr_init();
-
- // Length of decoded data
- int convertedLength = 0;
-
- // Temporary encoded data storage
- int[] convertedInts = new int[dataLength * 2]; // Maximum length
-
- for (int i = 0; i < dataLength; i++) {
-
- // Try encode byte
- gcr_encode(0xff & data[i]);
-
- // Store encoded bytes
- while (gcr_get_encoded(convertedInts, convertedLength)) {
- convertedLength++;
- }
- }
-
- // Append extra 0 if GCR not finished
- if (!gcr_finished()) {
- gcr_encode(0);
-
- while (gcr_get_encoded(convertedInts, convertedLength)) {
- convertedLength++;
- }
- }
-
- // Convert to byte array
- byte[] convertedBytes = new byte[convertedLength];
- for (int i = 0; i < convertedLength; i++) {
- convertedBytes[i] = (byte) (0xff & convertedInts[i]);
- }
-
- return convertedBytes;
- }
-
-}
\ No newline at end of file
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/Msp802154BitErrorRadio.java b/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/Msp802154BitErrorRadio.java
deleted file mode 100644
index ca87cb980b..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/Msp802154BitErrorRadio.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Copyright (c) 2014, Uppsala University
- * 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.
- *
- */
-
-package org.contikios.cooja.mspmote.interfaces;
-
-import java.util.Random;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-
-import org.contikios.cooja.ClassDescription;
-import org.contikios.cooja.Mote;
-import org.contikios.cooja.Simulation;
-import org.contikios.cooja.radiomediums.AbstractRadioMedium;
-
-import org.contikios.cooja.mspmote.MspMoteTimeEvent;
-import org.contikios.cooja.mspmote.interfaces.Msp802154Radio;
-
-
-/**
- * Extension of MSPSim 802.15.4 radio wrapper with bit-level errors.
- *
- * Only errors due to signal fading are supported (as opposed to errors to interference).
- * Interesting modelling effects can obtained if this is used together with a dynamic
- * channel fading model.
- *
- * @author Atis Elsts
- */
-@ClassDescription("IEEE 802.15.4 Bit Error Radio")
-public class Msp802154BitErrorRadio extends Msp802154Radio {
- private static final Logger logger = LogManager.getLogger(Msp802154Radio.class);
-
- private static final double NOISE_FLOOR = AbstractRadioMedium.SS_WEAK;
- private static final double GOOD_SIGNAL = NOISE_FLOOR + 15.0;
-
- private Random random = null;
-
- public Msp802154BitErrorRadio(Mote m) {
- super(m);
-
- random = getMote().getSimulation().getRandomGenerator();
- }
-
- /* The MSK-transformed symbol-to-codeword table.
- * It's used for mapping between symbols and codeword by some popular
- * 802.15.4 radios such as CC2420 and CC2520. */
- private static final int[] mskEncodeTable = {
- 1618456172,
- 1309113062,
- 1826650030,
- 1724778362,
- 778887287,
- 2061946375,
- 2007919840,
- 125494990,
- 529027475,
- 838370585,
- 320833617,
- 422705285,
- 1368596360,
- 85537272,
- 139563807,
- 2021988657
- };
-
- /* Calculates the Hamming distance between two words */
- private int hammingDistance(int x1, int x2) {
- return Integer.bitCount(x1 ^ x2);
- }
-
- /* Send a symbol over the air with a specific bit error rate */
- private int transceiveSymbolWithErrors(int txSymbol, double bitErrorRate) {
- /* First, transmit (encode and randomly corrupt) it */
- int chipSequence = mskEncodeTable[txSymbol];
- /* Note: loop until 31, not until 32 here, as the highest bit in the codeword
- * is irrelevant for MSK encoded data, and therefore should not come into
- * the Hamming distance calculations. */
- for (int i = 0; i < 31; ++i) {
- double p = random.nextDouble();
- if (p < bitErrorRate) {
- chipSequence ^= (1 << i);
- }
- }
-
- /* Now receive (decode) it */
- int bestRxSymbol = 0;
- int bestHammingDistance = 32;
- for (byte i = 0; i < 16; ++i) {
- /* Resolve ties in a specific order:
- * s7, s6, ... , s0, s15, s14 , ..., s8 */
- int rxSymbol = i < 8 ? 7 - i : 15 - i + 8;
-
- int hd = hammingDistance(chipSequence, mskEncodeTable[rxSymbol]);
- if (hd < bestHammingDistance) {
- bestRxSymbol = rxSymbol;
- bestHammingDistance = hd;
- if (hd == 0) {
- break;
- }
- }
- }
- return bestRxSymbol;
- }
-
- /* This is the probability that a bit will received incorrectly, for
- * -95.0, -94.9, -94.8, ..., -80.0 dBm signal levels.
- * It is modelled as Additive White Gaussian Noise (AWGN) channel
- * with constellation size = 4, and log2(4) = 2 bits per over-the-air symbol.
- * (See "Digital Communications" by Proakis, page 311)
- *
- * The table was generated with the following Python code:
- *
- * noise_floor = -95.0
- * good_signal = noise_floor + 15.0
- *
- * # chips per second / carrier frequency
- * # In this case:
- * # 250 kbps * symbols_per_bit / 5 MHz 802.15.4 channel bandwidth
- * spectral_efficiency = 250000 * (32 / 4) / 5000000.
- *
- * def snr_from_rssi(signal):
- * return signal - noise_floor
- *
- * def combinations(n, k):
- * return math.factorial(n) / (math.factorial(k) * math.factorial(n - k))
- *
- * def chip_error_rate(signal):
- * M_sk = 4 # constellation size
- * K_b = 2 # bits per symbol
- * snr = snr_from_rssi(signal) * spectral_efficiency # signal-noise ratio
- * result = 0.0
- * for k in range(1, M_sk):
- * result += ((-1)**(k + 1) / (k + 1.0)) * combinations(M_sk - 1, k) * math.exp(- (k / (k + 1.0)) * K_b * snr)
- * return result * (M_sk / 2) / (M_sk - 1)
- *
- * for signal in range(int(noise_floor), int(good_signal + 1)):
- * for decimal_part in range(10):
- * s = signal + decimal_part / 10.0
- * print("{}: {:.16}".format(s, chip_error_rate(s)))
- */
- private static final double[] bitErrorRateTable = {
- 0.5000000000000000,
- 0.4857075690874351,
- 0.4717195981917559,
- 0.4580362793082289,
- 0.4446572346573086,
- 0.4315815642818357,
- 0.4188078906959320,
- 0.4063344007440545,
- 0.3941588848209507,
- 0.3822787735959348,
- 0.3706911723779558,
- 0.3593928932511307,
- 0.3483804851041035,
- 0.3376502616704103,
- 0.3271983276911817,
- 0.3170206033059785,
- 0.3071128467721474,
- 0.2974706756080624,
- 0.2880895862507204,
- 0.2789649723135144,
- 0.2700921415256470,
- 0.2614663314303489,
- 0.2530827239151328,
- 0.2449364586434322,
- 0.2370226454533358,
- 0.2293363757856961,
- 0.2218727332005190,
- 0.2146268030374602,
- 0.2075936812732179,
- 0.2007684826257659,
- 0.1941463479526962,
- 0.1877224509883067,
- 0.1814920044616803,
- 0.1754502656356323,
- 0.1695925413041991,
- 0.1639141922842669,
- 0.1584106374348990,
- 0.1530773572360710,
- 0.1479098969566969,
- 0.1429038694401250,
- 0.1380549575336883,
- 0.1333589161873203,
- 0.1288115742448300,
- 0.1244088359500270,
- 0.1201466821885792,
- 0.1160211714852698,
- 0.1120284407751141,
- 0.1081647059657158,
- 0.1044262623071727,
- 0.1008094845848469,
- 0.0973108271493890,
- 0.0939268237974889,
- 0.0906540875160106,
- 0.0874893101013543,
- 0.0844292616651377,
- 0.0814707900365929,
- 0.0786108200713800,
- 0.0758463528759084,
- 0.0731744649556428,
- 0.0705923072953072,
- 0.0680971043783837,
- 0.0656861531527741,
- 0.0633568219490458,
- 0.0611065493572223,
- 0.0589328430676567,
- 0.0568332786811473,
- 0.0548054984930601,
- 0.0528472102558939,
- 0.0509561859243809,
- 0.0491302603869077,
- 0.0473673301867607,
- 0.0456653522364111,
- 0.0440223425278144,
- 0.0424363748414465,
- 0.0409055794565784,
- 0.0394281418650815,
- 0.0380023014908522,
- 0.0366263504167641,
- 0.0352986321208818,
- 0.0340175402235017,
- 0.0327815172464461,
- 0.0315890533858807,
- 0.0304386852998058,
- 0.0293289949112408,
- 0.0282586082280085,
- 0.0272261941799208,
- 0.0262304634740650,
- 0.0252701674687994,
- 0.0243440970669807,
- 0.0234510816288642,
- 0.0225899879050480,
- 0.0217597189897583,
- 0.0209592132947168,
- 0.0201874435437662,
- 0.0194434157883799,
- 0.0187261684441326,
- 0.0180347713481601,
- 0.0173683248375987,
- 0.0167259588489542,
- 0.0161068320383143,
- 0.0155101309222909,
- 0.0149350690395443,
- 0.0143808861327198,
- 0.0138468473506013,
- 0.0133322424702643,
- 0.0128363851389939,
- 0.0123586121357148,
- 0.0118982826516654,
- 0.0114547775900349,
- 0.0110274988842702,
- 0.0106158688347500,
- 0.0102193294635131,
- 0.0098373418867231,
- 0.0094693857045423,
- 0.0091149584080853,
- 0.0087735748031163,
- 0.0084447664501541,
- 0.0081280811206428,
- 0.0078230822688482,
- 0.0075293485191375,
- 0.0072464731683002,
- 0.0069740637025694,
- 0.0067117413290037,
- 0.0064591405208906,
- 0.0062159085768378,
- 0.0059817051932169,
- 0.0057562020496316,
- 0.0055390824070828,
- 0.0053300407185094,
- 0.0051287822513842,
- 0.0049350227220528,
- 0.0047484879415055,
- 0.0045689134722762,
- 0.0043960442961698,
- 0.0042296344925230,
- 0.0040694469267080,
- 0.0039152529485966,
- 0.0037668321007033,
- 0.0036239718357372,
- 0.0034864672432910,
- 0.0033541207854084,
- 0.0032267420407699,
- 0.0031041474572487,
- 0.0029861601125883,
- 0.0028726094829638,
- 0.0027633312191911,
- 0.0026581669303560,
- 0.0025569639746388,
- 0.0024595752571165,
- 0.0023658590343307,
- 0.0022756787254125
- };
-
- private double getBitErrorRate(double signal) {
- if (signal <= NOISE_FLOOR) {
- return 0.5;
- } else if (signal >= GOOD_SIGNAL) {
- return 0.0;
- } else {
- long position = Math.round((signal - NOISE_FLOOR) * 10.0);
- return bitErrorRateTable[(int)position];
- }
- }
-
- public void receiveCustomData(Object data) {
- if (!(data instanceof Byte)) {
- logger.fatal("Bad custom data: " + data);
- return;
- }
- lastIncomingByte = (Byte) data;
-
- final byte inputByte;
- if (isInterfered()) {
- inputByte = (byte)0xFF;
- } else {
- double bitErrorRate = getBitErrorRate(currentSignalStrength);
- if (bitErrorRate == 0.0) {
- inputByte = lastIncomingByte;
- } else if (bitErrorRate >= 0.5) {
- inputByte = (byte) 0xFF;
- } else {
- /* convert to an unsigned int in order to prettify subsequent operations with bits */
- int incomingByteAsInt = lastIncomingByte;
- if (incomingByteAsInt < 0) incomingByteAsInt += 256;
-
- /* a byte consists of 2 symbols; independently transceive each of them */
- int firstSymbol = transceiveSymbolWithErrors(incomingByteAsInt >> 4, bitErrorRate);
- int secondSymbol = transceiveSymbolWithErrors(incomingByteAsInt & 0xf, bitErrorRate);
-
- inputByte = (byte)((firstSymbol << 4) + secondSymbol);
- }
- }
-
- mote.getSimulation().scheduleEvent(new MspMoteTimeEvent(mote) {
- public void execute(long t) {
- super.execute(t);
- radio.receivedByte(inputByte);
- mote.requestImmediateWakeup();
- }
- }, mote.getSimulation().getSimulationTime());
-
- }
-}
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/TrxebLEDs.java b/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/TrxebLEDs.java
deleted file mode 100644
index 543d7c1c46..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/TrxebLEDs.java
+++ /dev/null
@@ -1,174 +0,0 @@
-package org.contikios.cooja.mspmote.interfaces;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.util.Collection;
-import java.util.Observable;
-import java.util.Observer;
-
-import javax.swing.JPanel;
-
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-import org.jdom.Element;
-
-import org.contikios.cooja.ClassDescription;
-import org.contikios.cooja.Mote;
-import org.contikios.cooja.interfaces.LED;
-import org.contikios.cooja.mspmote.Exp5438Mote;
-import se.sics.mspsim.core.IOPort;
-import se.sics.mspsim.core.IOUnit;
-import se.sics.mspsim.core.PortListener;
-
-/**
- * @author Fredrik Osterlind
- */
-@ClassDescription("Trxeb LEDs")
-public class TrxebLEDs extends LED {
- private static final Logger logger = LogManager.getLogger(TrxebLEDs.class);
-
- private Exp5438Mote mspMote;
-
- private boolean redOn = false;
- private boolean yellowOn = false;
- private boolean greenOn = false;
- private boolean blueOn = false;
-
- private static final Color RED = new Color(255, 0, 0);
- private static final Color DARK_RED = new Color(100, 0, 0);
- private static final Color YELLOW = new Color(255, 255, 0);
- private static final Color DARK_YELLOW = new Color(184,134,11);
- private static final Color GREEN = new Color(0, 255, 0);
- private static final Color DARK_GREEN = new Color(0, 100, 0);
- private static final Color BLUE = new Color(0, 0, 255);
- private static final Color DARK_BLUE = new Color(0, 0, 100);
-
- public TrxebLEDs(Mote mote) {
- mspMote = (Exp5438Mote) mote;
-
- IOUnit unit = mspMote.getCPU().getIOUnit("P4");
- if (unit instanceof IOPort) {
- ((IOPort) unit).addPortListener(new PortListener() {
- public void portWrite(IOPort source, int data) {
- redOn = (data & (1<<0)) == 0;
- yellowOn = (data & (1<<1)) == 0;
- greenOn = (data & (1<<2)) == 0;
- blueOn = (data & (1<<3)) == 0;
- setChanged();
- notifyObservers();
- }
- });
- }
- }
-
- public boolean isAnyOn() {
- return redOn || yellowOn || greenOn || blueOn;
- }
-
- public boolean isGreenOn() {
- return greenOn;
- }
-
- public boolean isRedOn() {
- return redOn;
- }
-
- public boolean isYellowOn() {
- return yellowOn;
- }
-
- public boolean isBlueOn() {
- return blueOn;
- }
-
- public JPanel getInterfaceVisualizer() {
- final JPanel panel = new JPanel() {
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
-
- int x = 20;
- int y = 25;
- int d = 25;
-
- if (isRedOn()) {
- g.setColor(RED);
- g.fillOval(x, y, d, d);
- g.setColor(Color.BLACK);
- g.drawOval(x, y, d, d);
- } else {
- g.setColor(DARK_RED);
- g.fillOval(x + 5, y + 5, d-10, d-10);
- }
-
- x += 40;
-
- if (isYellowOn()) {
- g.setColor(YELLOW);
- g.fillOval(x, y, d, d);
- g.setColor(Color.BLACK);
- g.drawOval(x, y, d, d);
- } else {
- g.setColor(DARK_YELLOW);
- g.fillOval(x + 5, y + 5, d-10, d-10);
- }
-
- x += 40;
-
- if (isGreenOn()) {
- g.setColor(GREEN);
- g.fillOval(x, y, d, d);
- g.setColor(Color.BLACK);
- g.drawOval(x, y, d, d);
- } else {
- g.setColor(DARK_GREEN);
- g.fillOval(x + 5, y + 5, d-10, d-10);
- }
-
- x += 40;
-
- if (isBlueOn()) {
- g.setColor(BLUE);
- g.fillOval(x, y, d, d);
- g.setColor(Color.BLACK);
- g.drawOval(x, y, d, d);
- } else {
- g.setColor(DARK_BLUE);
- g.fillOval(x + 5, y + 5, d-10, d-10);
- }
- }
- };
-
- Observer observer;
- this.addObserver(observer = new Observer() {
- public void update(Observable obs, Object obj) {
- panel.repaint();
- }
- });
-
- // Saving observer reference for releaseInterfaceVisualizer
- panel.putClientProperty("intf_obs", observer);
- panel.setMinimumSize(new Dimension(140, 60));
- panel.setPreferredSize(new Dimension(140, 60));
- return panel;
- }
-
- public void releaseInterfaceVisualizer(JPanel panel) {
- Observer observer = (Observer) panel.getClientProperty("intf_obs");
- if (observer == null) {
- logger.fatal("Error when releasing panel, observer is null");
- return;
- }
-
- this.deleteObserver(observer);
- }
-
-
- public Collection getConfigXML() {
- return null;
- }
-
- public void setConfigXML(Collection configXML, boolean visAvailable) {
- }
-
-}
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/UsciA0Serial.java b/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/UsciA0Serial.java
deleted file mode 100644
index 4e7ceee04c..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/UsciA0Serial.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2011, 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.
- */
-
-package org.contikios.cooja.mspmote.interfaces;
-
-import org.contikios.cooja.ClassDescription;
-import org.contikios.cooja.Mote;
-
-/**
- * @author Fredrik Osterlind
- */
-@ClassDescription("Serial port")
-public class UsciA0Serial extends MspSerial {
- public UsciA0Serial(Mote mote) {
- super(mote);
- }
- public String ioConfigString() {
- return "USCI A0";
- }
-}
diff --git a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/UsciA1Serial.java b/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/UsciA1Serial.java
deleted file mode 100644
index 15e224d6ea..0000000000
--- a/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/UsciA1Serial.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2011, 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.
- */
-
-package org.contikios.cooja.mspmote.interfaces;
-
-import org.contikios.cooja.ClassDescription;
-import org.contikios.cooja.Mote;
-
-/**
- * @author Fredrik Osterlind
- */
-@ClassDescription("Serial port")
-public class UsciA1Serial extends MspSerial {
- public UsciA1Serial(Mote mote) {
- super(mote);
- }
- public String ioConfigString() {
- return "USCI A1";
- }
-}