summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Beattie <mike@ethernal.org>2012-08-26 23:37:58 +1200
committerMike Beattie <mike@ethernal.org>2012-08-26 23:37:58 +1200
commitf8211fee3c8a5de6925eadca2679441801ac793e (patch)
treecfbc2a1ede16e7c4e14ea945c6c6b121805e09b7
parent8fdde3e74c6dce35f90f4575ce6914516fc56aba (diff)
altosdroid: Send device name and connected state back to TelemetryService
Signed-off-by: Mike Beattie <mike@ethernal.org>
-rw-r--r--altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java
index cc039206..278c6a53 100644
--- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java
+++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java
@@ -26,7 +26,9 @@ import java.util.UUID;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
+import android.os.Bundle;
import android.os.Handler;
+import android.os.Message;
import android.util.Log;
import org.altusmetrum.AltosLib.*;
@@ -112,6 +114,14 @@ public class AltosBluetooth extends AltosLink {
// 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();