From b9f338ac8ac193654b1e015e10a608f343c58130 Mon Sep 17 00:00:00 2001 From: sallai Date: Fri, 16 May 2008 19:28:39 +0000 Subject: [PATCH] added iris as an alias to 57600bps baud rate --- .../sdk/java/net/tinyos/packet/BaudRate.java | 1 + .../sdk/java/net/tinyos/tools/ListenRaw.java | 29 +++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/support/sdk/java/net/tinyos/packet/BaudRate.java b/support/sdk/java/net/tinyos/packet/BaudRate.java index ce825e2e..0217961c 100644 --- a/support/sdk/java/net/tinyos/packet/BaudRate.java +++ b/support/sdk/java/net/tinyos/packet/BaudRate.java @@ -20,5 +20,6 @@ class BaudRate { Platform.add(Platform.x, "micaz", 57600); Platform.add(Platform.x, "eyesIFX", 57600); Platform.add(Platform.x, "intelmote2", 115200); + Platform.add(Platform.x, "iris", 57600); } } diff --git a/support/sdk/java/net/tinyos/tools/ListenRaw.java b/support/sdk/java/net/tinyos/tools/ListenRaw.java index 01cf8b4c..a8a4953c 100644 --- a/support/sdk/java/net/tinyos/tools/ListenRaw.java +++ b/support/sdk/java/net/tinyos/tools/ListenRaw.java @@ -1,19 +1,19 @@ // $Id$ /* tab:4 - * "Copyright (c) 2000-2003 The Regents of the University of California. + * "Copyright (c) 2000-2003 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice, the following * two paragraphs and the author appear in all copies of this software. - * + * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS @@ -23,9 +23,9 @@ * Copyright (c) 2002-2003 Intel Corporation * All rights reserved. * - * This file is distributed under the terms in the attached INTEL-LICENSE + * This file is distributed under the terms in the attached INTEL-LICENSE * file. If you do not find these files, copies can be found by writing to - * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, + * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, * 94704. Attention: Intel License Inquiry. */ /* Authors: Mike Chen, Philip Levis @@ -57,6 +57,7 @@ public class ListenRaw { private static final int PORT_SPEED_MICA2DOT = 19200; private static final int PORT_SPEED_MICA = 19200; private static final int PORT_SPEED_RENE = 19200; + private static final int PORT_SPEED_IRIS = 57600; private static final int LENGTH_OFFSET = 4; private int packetLength; private int portSpeed; @@ -77,14 +78,14 @@ public class ListenRaw { port = new TOSSerial(portName); in = port.getInputStream(); out = port.getOutputStream(); - + //port.setFlowControlMode(SerialPort.FLOWCONTROL_NONE); // These are the mote UART parameters port.setSerialPortParams(portSpeed, 8, SerialPort.STOPBITS_1, false); printPortStatus(); System.out.println(); } - + private void printPortStatus() { System.out.println(" baud rate: " + port.getBaudRate()); System.out.println(" data bits: " + port.getDataBits()); @@ -93,10 +94,10 @@ public class ListenRaw { } public void read() throws IOException { - int i; + int i; int count = 0; byte[] packet = new byte[MAX_MSG_SIZE]; - + while ((i = in.read()) != -1) { if (i == 0x7e) { System.out.println(); @@ -116,6 +117,7 @@ public class ListenRaw { System.err.println(" -mica2dot: Mica2Dot ("+PORT_SPEED_MICA2DOT+" bps)"); System.err.println(" -mica: Mica ("+PORT_SPEED_MICA+" bps)"); System.err.println(" -rene: Rene ("+PORT_SPEED_RENE+" bps)"); + System.err.println(" -iris: Iris ("+PORT_SPEED_IRIS+" bps) [default]"); System.exit(-1); } @@ -126,7 +128,7 @@ public class ListenRaw { if ((args.length < 1) || (args.length > 3)) { printUsage(); } - + for (int i = 0; i < args.length; i++) { if (args[i].equals("-h") || args[i].equals("--help")) { printUsage(); @@ -149,12 +151,15 @@ public class ListenRaw { if (args[i].equals("-rene")) { speed = PORT_SPEED_RENE; } + if (args[i].equals("-iris")) { + speed = PORT_SPEED_IRIS; + } } if (args[args.length - 1].charAt(0) == '-') { return; // No port specified } - + ListenRaw reader = new ListenRaw(args[args.length - 1], speed); try { reader.open(); @@ -162,7 +167,7 @@ public class ListenRaw { catch (Exception e) { e.printStackTrace(); } - + try { reader.read(); } -- 2.39.2