From 25ca251a8983d97542811b67c13c6e67b2c43647 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Mon, 9 Mar 2009 17:14:35 +0000 Subject: [PATCH] quick-fix: the generator assumes that the constructor accepts a mote object, this is the quickest fix currently --- .../sics/cooja/mspmote/interfaces/ESBButton.java | 10 +++++----- .../se/sics/cooja/mspmote/interfaces/ESBLED.java | 8 ++++---- .../se/sics/cooja/mspmote/interfaces/ESBLog.java | 12 ++++++------ .../sics/cooja/mspmote/interfaces/MspClock.java | 6 +++--- .../cooja/mspmote/interfaces/SkyByteRadio.java | 8 ++++---- .../sics/cooja/mspmote/interfaces/SkySerial.java | 16 +++++++++------- .../cooja/mspmote/interfaces/TR1001Radio.java | 8 ++++---- 7 files changed, 35 insertions(+), 33 deletions(-) diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBButton.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBButton.java index 1fc02742a..9cc72919c 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBButton.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBButton.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ESBButton.java,v 1.2 2008/10/28 17:02:58 fros4943 Exp $ + * $Id: ESBButton.java,v 1.3 2009/03/09 17:14:35 fros4943 Exp $ */ package se.sics.cooja.mspmote.interfaces; @@ -50,10 +50,10 @@ import se.sics.cooja.mspmote.ESBMote; public class ESBButton extends Button { private static Logger logger = Logger.getLogger(ESBButton.class); - private ESBMote esbMote; + private ESBMote mote; public ESBButton(Mote mote) { - esbMote = (ESBMote) mote; + this.mote = (ESBMote) mote; } public void clickButton() { @@ -62,13 +62,13 @@ public class ESBButton extends Button { } public void releaseButton() { - esbMote.esbNode.setButton(false); + mote.esbNode.setButton(false); setChanged(); notifyObservers(); } public void pressButton() { - esbMote.esbNode.setButton(true); + mote.esbNode.setButton(true); setChanged(); notifyObservers(); } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBLED.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBLED.java index e7078dd30..023892cc0 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBLED.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBLED.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ESBLED.java,v 1.4 2008/10/28 17:02:58 fros4943 Exp $ + * $Id: ESBLED.java,v 1.5 2009/03/09 17:14:35 fros4943 Exp $ */ package se.sics.cooja.mspmote.interfaces; @@ -50,7 +50,7 @@ import se.sics.mspsim.platform.esb.ESBNode; public class ESBLED extends LED implements PortListener { private static Logger logger = Logger.getLogger(ESBLED.class); - private ESBMote mspMote; + private ESBMote mote; private boolean redOn = false; private boolean greenOn = false; private boolean yellowOn = false; @@ -63,10 +63,10 @@ public class ESBLED extends LED implements PortListener { private static final Color RED = new Color(255, 0, 0); public ESBLED(Mote mote) { - mspMote = (ESBMote) mote; + this.mote = (ESBMote) mote; /* Listen for port writes */ - IOUnit unit = mspMote.getCPU().getIOUnit("Port 2"); + IOUnit unit = this.mote.getCPU().getIOUnit("Port 2"); if (unit instanceof IOPort) { ((IOPort) unit).setPortListener(this); } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBLog.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBLog.java index 92a86d3b6..c2510d039 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBLog.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/ESBLog.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ESBLog.java,v 1.4 2008/12/03 13:13:07 fros4943 Exp $ + * $Id: ESBLog.java,v 1.5 2009/03/09 17:14:35 fros4943 Exp $ */ package se.sics.cooja.mspmote.interfaces; @@ -49,15 +49,15 @@ import se.sics.cooja.mspmote.ESBMote; public class ESBLog extends Log implements USARTListener { private static Logger logger = Logger.getLogger(ESBLog.class); - private Mote myMote; + private ESBMote mote; private String lastLogMessage = ""; private String newMessage = ""; - public ESBLog(ESBMote mote) { - myMote = mote; + public ESBLog(Mote mote) { + this.mote = (ESBMote) mote; /* Listen to port writes */ - IOUnit usart = mote.getCPU().getIOUnit("USART 1"); + IOUnit usart = this.mote.getCPU().getIOUnit("USART 1"); if (usart instanceof USART) { ((USART) usart).setUSARTListener(this); } @@ -125,7 +125,7 @@ public class ESBLog extends Log implements USARTListener { lastLogMessage = newMessage; newMessage = ""; this.setChanged(); - this.notifyObservers(myMote); + this.notifyObservers(mote); } } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspClock.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspClock.java index 9ff4cff83..7f7a5be65 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspClock.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/MspClock.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: MspClock.java,v 1.7 2009/03/09 16:05:11 fros4943 Exp $ + * $Id: MspClock.java,v 1.8 2009/03/09 17:14:35 fros4943 Exp $ */ package se.sics.cooja.mspmote.interfaces; @@ -51,8 +51,8 @@ public class MspClock extends Clock { private MspMote myMote; private MSP430 cpu; - public MspClock(MspMote mote) { - myMote = mote; + public MspClock(Mote mote) { + myMote = (MspMote) mote; cpu = myMote.getCPU(); } 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 473ad0a4c..b749cc301 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.7 2009/02/03 14:34:47 fros4943 Exp $ + * $Id: SkyByteRadio.java,v 1.8 2009/03/09 17:14:35 fros4943 Exp $ */ package se.sics.cooja.mspmote.interfaces; @@ -88,9 +88,9 @@ public class SkyByteRadio extends Radio implements CustomDataRadio { //TODO: HW on/off - public SkyByteRadio(SkyMote mote) { - this.mote = mote; - this.cc2420 = mote.skyNode.radio; + public SkyByteRadio(Mote mote) { + this.mote = (SkyMote) mote; + this.cc2420 = this.mote.skyNode.radio; cc2420.setRFListener(new RFListener() { int len = 0; diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkySerial.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkySerial.java index 2434198d9..374d741e0 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkySerial.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkySerial.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: SkySerial.java,v 1.13 2009/03/09 16:05:11 fros4943 Exp $ + * $Id: SkySerial.java,v 1.14 2009/03/09 17:14:35 fros4943 Exp $ */ package se.sics.cooja.mspmote.interfaces; @@ -58,7 +58,7 @@ import se.sics.cooja.plugins.SLIP; public class SkySerial extends Log implements SerialPort, USARTListener { private static Logger logger = Logger.getLogger(SkySerial.class); - private Mote mote; + private SkyMote mote; private String lastLogMessage = ""; private StringBuilder newMessage = new StringBuilder(); @@ -85,11 +85,11 @@ public class SkySerial extends Log implements SerialPort, USARTListener { private Vector incomingData = new Vector(); - public SkySerial(SkyMote mote) { - this.mote = mote; + public SkySerial(Mote mote) { + this.mote = (SkyMote) mote; /* Listen to port writes */ - IOUnit ioUnit = mote.getCPU().getIOUnit("USART 1"); + IOUnit ioUnit = this.mote.getCPU().getIOUnit("USART 1"); if (ioUnit instanceof USART) { usart = (USART) ioUnit; usart.setUSARTListener(this); @@ -352,12 +352,14 @@ public class SkySerial extends Log implements SerialPort, USARTListener { tosLen = 0; } } - if (tosPos == 7) { + if (tosPos == 7) { tosLen = data; // System.out.println("TOS Payload len: " + tosLen); } if (tosPos > 9 && tosPos < 10 + tosLen) { - if (data < 32) data = 32; + if (data < 32) { + data = 32; + } newMessage.append((char) data); } tosData[tosPos++] = data; diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/TR1001Radio.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/TR1001Radio.java index 2a600f667..4b7a17a5b 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/TR1001Radio.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/TR1001Radio.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: TR1001Radio.java,v 1.10 2009/03/09 16:05:11 fros4943 Exp $ + * $Id: TR1001Radio.java,v 1.11 2009/03/09 17:14:35 fros4943 Exp $ */ package se.sics.cooja.mspmote.interfaces; @@ -116,11 +116,11 @@ public class TR1001Radio extends Radio implements USARTListener, CustomDataRadio * @see Mote * @see se.sics.cooja.MoteInterfaceHandler */ - public TR1001Radio(ESBMote mote) { - this.mote = mote; + public TR1001Radio(Mote mote) { + this.mote = (ESBMote) mote; /* Start listening to CPU's USART */ - IOUnit usart = mote.getCPU().getIOUnit("USART 0"); + IOUnit usart = this.mote.getCPU().getIOUnit("USART 0"); if (usart instanceof USART) { radioUSART = (USART) usart; radioUSART.setUSARTListener(this);