altosdroid: Move constructor for AltosBluetooth
[fw/altos] / altosdroid / src / org / altusmetrum / AltosDroid / AltosBluetooth.java
index 1f0946799d71549c35e19ffb2a78b24752d385a6..32140b3cbb513b656e476fbbfdef15607f4262b3 100644 (file)
@@ -36,17 +36,22 @@ public class AltosBluetooth extends AltosLink {
        private static final String TAG = "AltosBluetooth";
        private static final boolean D = true;
 
-       /**
-        * This thread runs while attempting to make an outgoing connection
-        * with a device. It runs straight through; the connection either
-        * succeeds or fails.
-        */
-
-       private BluetoothAdapter        adapter;
-       private ConnectThread           connect_thread;
-       private BluetoothSocket         socket;
-       private InputStream             input;
-       private OutputStream            output;
+       private ConnectThread    connect_thread = null;
+
+       private BluetoothAdapter adapter;
+       private BluetoothDevice  device;
+       private BluetoothSocket  socket;
+       private InputStream      input;
+       private OutputStream     output;
+
+       // Constructor
+       public AltosBluetooth(BluetoothDevice in_device) {
+               adapter = BluetoothAdapter.getDefaultAdapter();
+
+
+               connect_thread = new ConnectThread(device);
+               connect_thread.start();
+       }
 
        private class ConnectThread extends Thread {
                private final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
@@ -153,24 +158,11 @@ public class AltosBluetooth extends AltosLink {
                }
        }
 
-       public void flush_output() {
-               super.flush_output();
-               /* any local work needed to flush bluetooth? */
-       }
 
-       public boolean can_cancel_reply() {
-               return false;
-       }
-       public boolean show_reply_timeout() {
-               return true;
-       }
-               
-       public void hide_reply_timeout() {
-       }
+       //public void flush_output() { super.flush_output(); }
 
-       public AltosBluetooth(BluetoothDevice device) {
-               adapter = BluetoothAdapter.getDefaultAdapter();
-               connect_thread = new ConnectThread(device, true);
-               connect_thread.start();
-       }
-}
\ No newline at end of file
+       public boolean can_cancel_reply()   { return false; }
+       public boolean show_reply_timeout() { return true; }
+       public void hide_reply_timeout()    { }
+
+}