From 308ecfed2a7ee1643ceee0bfb25e9246554b67df Mon Sep 17 00:00:00 2001 From: fros4943 Date: Fri, 5 Mar 2010 14:59:43 +0000 Subject: [PATCH] simple patch to allow application motes to receive serial data --- .../se/sics/cooja/interfaces/ApplicationSerialPort.java | 7 ++++--- .../se/sics/cooja/motes/AbstractApplicationMote.java | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/interfaces/ApplicationSerialPort.java b/tools/cooja/java/se/sics/cooja/interfaces/ApplicationSerialPort.java index 6d431d06a..33524f39e 100644 --- a/tools/cooja/java/se/sics/cooja/interfaces/ApplicationSerialPort.java +++ b/tools/cooja/java/se/sics/cooja/interfaces/ApplicationSerialPort.java @@ -2,6 +2,7 @@ package se.sics.cooja.interfaces; import se.sics.cooja.Mote; import se.sics.cooja.dialogs.SerialUI; +import se.sics.cooja.motes.AbstractApplicationMote; public class ApplicationSerialPort extends SerialUI { private Mote mote; @@ -26,12 +27,12 @@ public class ApplicationSerialPort extends SerialUI { } public void writeArray(byte[] s) { - /* Not implemented */ + ((AbstractApplicationMote) getMote()).writeArray(s); } public void writeByte(byte b) { - /* Not implemented */ + ((AbstractApplicationMote)getMote()).writeByte(b); } public void writeString(String s) { - /* Not implemented */ + ((AbstractApplicationMote)getMote()).writeString(s); } } diff --git a/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMote.java b/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMote.java index 8773d51bc..6af72ce09 100644 --- a/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMote.java +++ b/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMote.java @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: AbstractApplicationMote.java,v 1.9 2010/02/03 15:11:48 fros4943 Exp $ + * $Id: AbstractApplicationMote.java,v 1.10 2010/03/05 14:59:43 fros4943 Exp $ */ package se.sics.cooja.motes; @@ -188,4 +188,11 @@ public abstract class AbstractApplicationMote extends AbstractWakeupMote impleme return "AppMote " + getID(); } + /* These methods should be overriden to allow application motes receiving serial data */ + public void writeArray(byte[] s) { + } + public void writeByte(byte b) { + } + public void writeString(String s) { + } }