quick-fix: the generator assumes that the constructor accepts a mote object, this is the quickest fix currently

This commit is contained in:
fros4943 2009-03-09 17:14:35 +00:00
parent e5a5f7dd5d
commit 25ca251a89
7 changed files with 35 additions and 33 deletions

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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; package se.sics.cooja.mspmote.interfaces;
@ -50,10 +50,10 @@ import se.sics.cooja.mspmote.ESBMote;
public class ESBButton extends Button { public class ESBButton extends Button {
private static Logger logger = Logger.getLogger(ESBButton.class); private static Logger logger = Logger.getLogger(ESBButton.class);
private ESBMote esbMote; private ESBMote mote;
public ESBButton(Mote mote) { public ESBButton(Mote mote) {
esbMote = (ESBMote) mote; this.mote = (ESBMote) mote;
} }
public void clickButton() { public void clickButton() {
@ -62,13 +62,13 @@ public class ESBButton extends Button {
} }
public void releaseButton() { public void releaseButton() {
esbMote.esbNode.setButton(false); mote.esbNode.setButton(false);
setChanged(); setChanged();
notifyObservers(); notifyObservers();
} }
public void pressButton() { public void pressButton() {
esbMote.esbNode.setButton(true); mote.esbNode.setButton(true);
setChanged(); setChanged();
notifyObservers(); notifyObservers();
} }

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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; package se.sics.cooja.mspmote.interfaces;
@ -50,7 +50,7 @@ import se.sics.mspsim.platform.esb.ESBNode;
public class ESBLED extends LED implements PortListener { public class ESBLED extends LED implements PortListener {
private static Logger logger = Logger.getLogger(ESBLED.class); private static Logger logger = Logger.getLogger(ESBLED.class);
private ESBMote mspMote; private ESBMote mote;
private boolean redOn = false; private boolean redOn = false;
private boolean greenOn = false; private boolean greenOn = false;
private boolean yellowOn = 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); private static final Color RED = new Color(255, 0, 0);
public ESBLED(Mote mote) { public ESBLED(Mote mote) {
mspMote = (ESBMote) mote; this.mote = (ESBMote) mote;
/* Listen for port writes */ /* Listen for port writes */
IOUnit unit = mspMote.getCPU().getIOUnit("Port 2"); IOUnit unit = this.mote.getCPU().getIOUnit("Port 2");
if (unit instanceof IOPort) { if (unit instanceof IOPort) {
((IOPort) unit).setPortListener(this); ((IOPort) unit).setPortListener(this);
} }

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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; package se.sics.cooja.mspmote.interfaces;
@ -49,15 +49,15 @@ import se.sics.cooja.mspmote.ESBMote;
public class ESBLog extends Log implements USARTListener { public class ESBLog extends Log implements USARTListener {
private static Logger logger = Logger.getLogger(ESBLog.class); private static Logger logger = Logger.getLogger(ESBLog.class);
private Mote myMote; private ESBMote mote;
private String lastLogMessage = ""; private String lastLogMessage = "";
private String newMessage = ""; private String newMessage = "";
public ESBLog(ESBMote mote) { public ESBLog(Mote mote) {
myMote = mote; this.mote = (ESBMote) mote;
/* Listen to port writes */ /* Listen to port writes */
IOUnit usart = mote.getCPU().getIOUnit("USART 1"); IOUnit usart = this.mote.getCPU().getIOUnit("USART 1");
if (usart instanceof USART) { if (usart instanceof USART) {
((USART) usart).setUSARTListener(this); ((USART) usart).setUSARTListener(this);
} }
@ -125,7 +125,7 @@ public class ESBLog extends Log implements USARTListener {
lastLogMessage = newMessage; lastLogMessage = newMessage;
newMessage = ""; newMessage = "";
this.setChanged(); this.setChanged();
this.notifyObservers(myMote); this.notifyObservers(mote);
} }
} }

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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; package se.sics.cooja.mspmote.interfaces;
@ -51,8 +51,8 @@ public class MspClock extends Clock {
private MspMote myMote; private MspMote myMote;
private MSP430 cpu; private MSP430 cpu;
public MspClock(MspMote mote) { public MspClock(Mote mote) {
myMote = mote; myMote = (MspMote) mote;
cpu = myMote.getCPU(); cpu = myMote.getCPU();
} }

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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; package se.sics.cooja.mspmote.interfaces;
@ -88,9 +88,9 @@ public class SkyByteRadio extends Radio implements CustomDataRadio {
//TODO: HW on/off //TODO: HW on/off
public SkyByteRadio(SkyMote mote) { public SkyByteRadio(Mote mote) {
this.mote = mote; this.mote = (SkyMote) mote;
this.cc2420 = mote.skyNode.radio; this.cc2420 = this.mote.skyNode.radio;
cc2420.setRFListener(new RFListener() { cc2420.setRFListener(new RFListener() {
int len = 0; int len = 0;

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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; package se.sics.cooja.mspmote.interfaces;
@ -58,7 +58,7 @@ import se.sics.cooja.plugins.SLIP;
public class SkySerial extends Log implements SerialPort, USARTListener { public class SkySerial extends Log implements SerialPort, USARTListener {
private static Logger logger = Logger.getLogger(SkySerial.class); private static Logger logger = Logger.getLogger(SkySerial.class);
private Mote mote; private SkyMote mote;
private String lastLogMessage = ""; private String lastLogMessage = "";
private StringBuilder newMessage = new StringBuilder(); private StringBuilder newMessage = new StringBuilder();
@ -85,11 +85,11 @@ public class SkySerial extends Log implements SerialPort, USARTListener {
private Vector<Byte> incomingData = new Vector<Byte>(); private Vector<Byte> incomingData = new Vector<Byte>();
public SkySerial(SkyMote mote) { public SkySerial(Mote mote) {
this.mote = mote; this.mote = (SkyMote) mote;
/* Listen to port writes */ /* Listen to port writes */
IOUnit ioUnit = mote.getCPU().getIOUnit("USART 1"); IOUnit ioUnit = this.mote.getCPU().getIOUnit("USART 1");
if (ioUnit instanceof USART) { if (ioUnit instanceof USART) {
usart = (USART) ioUnit; usart = (USART) ioUnit;
usart.setUSARTListener(this); usart.setUSARTListener(this);
@ -357,7 +357,9 @@ public class SkySerial extends Log implements SerialPort, USARTListener {
// System.out.println("TOS Payload len: " + tosLen); // System.out.println("TOS Payload len: " + tosLen);
} }
if (tosPos > 9 && tosPos < 10 + tosLen) { if (tosPos > 9 && tosPos < 10 + tosLen) {
if (data < 32) data = 32; if (data < 32) {
data = 32;
}
newMessage.append((char) data); newMessage.append((char) data);
} }
tosData[tosPos++] = data; tosData[tosPos++] = data;

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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; package se.sics.cooja.mspmote.interfaces;
@ -116,11 +116,11 @@ public class TR1001Radio extends Radio implements USARTListener, CustomDataRadio
* @see Mote * @see Mote
* @see se.sics.cooja.MoteInterfaceHandler * @see se.sics.cooja.MoteInterfaceHandler
*/ */
public TR1001Radio(ESBMote mote) { public TR1001Radio(Mote mote) {
this.mote = mote; this.mote = (ESBMote) mote;
/* Start listening to CPU's USART */ /* 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) { if (usart instanceof USART) {
radioUSART = (USART) usart; radioUSART = (USART) usart;
radioUSART.setUSARTListener(this); radioUSART.setUSARTListener(this);