- // Reset the ConnectThread because we're done
- AltosBluetooth.this.notify();
- connect_thread = null;
- if (D) Log.i(TAG, "Completed connect");
- }
- } catch (Exception e) {
- if (D) Log.e(TAG, "Failed to finish connection", e);
- e.printStackTrace();
+ // Reset the ConnectThread because we're done
+ connect_thread = null;
+
+ // Send the device name back to the Telemetry Service
+ name = device.getName();
+ Message msg = handler.obtainMessage(TelemetryService.MSG_CONNECTED);
+ Bundle b = new Bundle();
+ b.putString(TelemetryService.KEY_DEVNAME, name);
+ msg.setData(b);
+ handler.sendMessage(msg);
+
+ // Notify other waiting threads, now that we're connected
+ AltosBluetooth.this.notifyAll();
+
+ if (D) Log.i(TAG, "ConnectThread: Connect completed");