From 53b947df484159f5934898ba6c0aa69a9c869007 Mon Sep 17 00:00:00 2001 From: Ido Hadanny Date: Thu, 22 Sep 2011 21:30:13 +0300 Subject: added stuff --- .../hackingroomba/roombacomm/net/DumpMethods.java | 70 +++++++++++ .../roombacomm/net/RoombaCommTCPServer.java | 94 +++++++++++++++ .../hackingroomba/roombacomm/net/SimpleTest.java | 131 +++++++++++++++++++++ .../roombacomm/net/TextHttpServer.java | 109 +++++++++++++++++ 4 files changed, 404 insertions(+) create mode 100644 roombacomm-client/src/com/hackingroomba/roombacomm/net/DumpMethods.java create mode 100644 roombacomm-client/src/com/hackingroomba/roombacomm/net/RoombaCommTCPServer.java create mode 100644 roombacomm-client/src/com/hackingroomba/roombacomm/net/SimpleTest.java create mode 100644 roombacomm-client/src/com/hackingroomba/roombacomm/net/TextHttpServer.java (limited to 'roombacomm-client/src/com/hackingroomba/roombacomm/net') diff --git a/roombacomm-client/src/com/hackingroomba/roombacomm/net/DumpMethods.java b/roombacomm-client/src/com/hackingroomba/roombacomm/net/DumpMethods.java new file mode 100644 index 0000000..962629e --- /dev/null +++ b/roombacomm-client/src/com/hackingroomba/roombacomm/net/DumpMethods.java @@ -0,0 +1,70 @@ + +package com.hackingroomba.roombacomm.net; + +import java.lang.reflect.*; + +import com.hackingroomba.roombacomm.*; + + +public class DumpMethods { + + RoombaCommSerial rcs; + + public static void main(String[] args) { + new DumpMethods(args); + } + + public DumpMethods(String[] args) { + rcs = new RoombaCommSerial(); + + if( args.length == 0 ) { + dumpMethods(rcs); + return; + } + + String method_name = args[0]; + + /* + for( int i=1; i + * Run it with something like:
+ *   java roombacomm.SimpleTest /dev/cu.KeySerial1
+ *  
+ * + */ +public class SimpleTest { + + static String usage = + "Usage: \n"+ + " roombacomm.net.SimpleTest [options]\n" + + "where [options] can be one or more of:\n"+ + " -debug -- turn on debug output\n"+ + //" -hwhandshake -- use hardware-handshaking, for Windows Bluetooth\n"+ + //" -flush -- flush on sends(), normally not needed\n"+ + "\n"; + static boolean debug = false; + static boolean hwhandshake = false; + static boolean flush = false; + + public static void main(String[] args) { + if( args.length == 0 ) { + System.out.println( usage ); + System.exit(0); + } + + String portname = args[0]; // e.g. "/dev/cu.KeySerial1" + + for( int i=1; i < args.length; i++ ) { + if( args[i].endsWith("debug") ) + debug = true; + //else if( args[i].endsWith("hwhandshake") ) + // hwhandshake = true; + //else if( args[i].endsWith("flush") ) + // flush = true; + } + + RoombaComm roombacomm = new RoombaCommTCPClient(); + + roombacomm.debug = debug; + //roombacomm.waitForDSR = hwhandshake; + //roombacomm.flushOutput = flush; + + String portlist[] = roombacomm.listPorts(); + System.out.println("Available ports:"); + for(int i=0;i index1) + return requestString.substring(index1 + 1, index2); + } + return null; + } + + +} -- cgit v1.3.1