altosdroid: Add TBT initialisation to AltosBluetooth
[fw/altos] / altosdroid / src / org / altusmetrum / AltosDroid / AltosBluetooth.java
index 4c3f979d7c386df38e3260f864ba0bf23124b64c..6b86a1537f68844b694f9f184c5b3c2a510478fa 100644 (file)
@@ -99,6 +99,10 @@ public class AltosBluetooth extends AltosLink {
                                        input = socket.getInputStream();
                                        output = socket.getOutputStream();
 
+                                       // Configure the newly connected device for telemetry
+                                       print("~\nE 0\n");
+                                       set_monitor(false);
+
                                        // Reset the ConnectThread because we're done
                                        AltosBluetooth.this.notify();
                                        connect_thread = null;
@@ -127,13 +131,16 @@ public class AltosBluetooth extends AltosLink {
        }
 
        private void connection_failed() {
+               if (D) Log.i(TAG, "Bluetooth Connection failed!");
        }
        
        public void print(String data) {
                byte[] bytes = data.getBytes();
                try {
+                       if (D) Log.i(TAG, "Entering print();");
                        wait_connected();
                        output.write(bytes);
+                       if (D) Log.i(TAG, "Writing bytes: '" + data + "'");
                } catch (IOException e) {
                        connection_failed();
                } catch (InterruptedException e) {