altosdroid: create connected() method
authorMike Beattie <mike@ethernal.org>
Tue, 28 Aug 2012 05:26:09 +0000 (17:26 +1200)
committerMike Beattie <mike@ethernal.org>
Tue, 28 Aug 2012 05:26:09 +0000 (17:26 +1200)
Signed-off-by: Mike Beattie <mike@ethernal.org>
altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java

index 88ba805cd44fbb1fb2f5ca65c285e847eb014a36..a1b1915a9fefd4b08d9cf248238ecc7e166fd28c 100644 (file)
@@ -100,8 +100,7 @@ public class TelemetryService extends Service {
                                break;
                        case MSG_CONNECTED:
                                if (D) Log.d(TAG, "Connected to device");
-                               s.sendMessageToClients(Message.obtain(null, AltosDroid.MSG_DEVNAME, s.device.getName()));
-                               s.setState(STATE_CONNECTED);
+                               s.connected();
                                s.mAltosBluetooth.add_monitor(s.telem);
                                break;
                        case MSG_CONNECT_FAILED:
@@ -158,6 +157,12 @@ public class TelemetryService extends Service {
                sendMessageToClients(Message.obtain(null, AltosDroid.MSG_STATE_CHANGE, state, -1));
        }
 
+       private void connected() {
+               sendMessageToClients(Message.obtain(null, AltosDroid.MSG_DEVNAME, device.getName()));
+               setState(STATE_CONNECTED);
+       }
+
+
        @Override
        public void onCreate() {
                // Create a reference to the NotificationManager so that we can update our notifcation text later