removed LCD class
[des2015.git] / dsl / runtime / src / nl / ru / des / sensors / BTController.java
index 062fa61..0f1ec0f 100644 (file)
@@ -9,7 +9,6 @@ import java.util.Queue;
 import lejos.hardware.Button;
 import lejos.remote.nxt.BTConnector;
 import lejos.remote.nxt.NXTConnection;
-import nl.ru.des.LCDPrinter;
 
 public class BTController{
        public static Queue<String> buf;
@@ -19,11 +18,11 @@ public class BTController{
        private static BTConnector btconnector;
        
        public static void startMaster(final String slave, final MessageHandler sh) {
-               LCDPrinter.print("Start BT... Press any key to commence");
+               System.out.println("Start BT... Press any key to commence");
                Button.waitForAnyEvent();
                btconnector = new BTConnector();
                while(conn == null){
-                       LCDPrinter.print("Connecting to " + slave);
+                       System.out.println("Connecting to " + slave);
                        conn = btconnector.connect(slave, NXTConnection.RAW);
                }
                dataOut = conn.openDataOutputStream();
@@ -50,11 +49,11 @@ public class BTController{
        }
        
        public static void startSlave() {
-               LCDPrinter.print("Start BT... Press any key to commence");
+               System.out.println("Start BT... Press any key to commence");
                Button.waitForAnyEvent();
                btconnector = new BTConnector();                
                while(conn == null){
-                       LCDPrinter.print("Waiting for the master...");
+                       System.out.println("Waiting for the master...");
                        conn = btconnector.waitForConnection(60000, NXTConnection.RAW);
                }
                dataIn = conn.openDataInputStream();
@@ -67,8 +66,9 @@ public class BTController{
                                                try {
                                                        dataOut.write(buf.poll().getBytes());
                                                        dataOut.flush();
-                                               } catch (IOException e) {
+                                               } catch (Exception e) {
                                                        e.printStackTrace();
+                                                       System.exit(0);
                                                }
                                        }
                                        Thread.yield();