summaryrefslogtreecommitdiff
path: root/altosdroid
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-07-11 19:54:36 -0700
committerKeith Packard <keithp@keithp.com>2015-07-11 19:54:36 -0700
commit84021b8e0ab9262262345ce47671c3c0c6c43566 (patch)
tree105dcec28bd4b1d84e8f2b613d5928120465ee9f /altosdroid
parentbdc953e26ac2dd67021f905807324c6a02e49690 (diff)
altosdroid: Don't disconnect from bluetooth onStartCommand
If we've already got a bluetooth connection running, don't slam it shut when the UI starts up again. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosdroid')
-rw-r--r--altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java
index 58bf8804..d7fa704d 100644
--- a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java
+++ b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java
@@ -199,13 +199,11 @@ public class TelemetryService extends Service implements LocationListener {
* Messages from TelemetryReader
*/
case MSG_TELEMETRY:
- AltosDebug.debug("MSG_TELEMETRY");
s.telemetry((AltosTelemetry) msg.obj);
break;
case MSG_CRC_ERROR:
// forward crc error messages
s.telemetry_state.crc_errors = (Integer) msg.obj;
- AltosDebug.debug("MSG_CRC_ERROR");
s.send_to_clients();
break;
default:
@@ -226,7 +224,6 @@ public class TelemetryService extends Service implements LocationListener {
telem.update_state(state);
telemetry_state.states.put(telem.serial, state);
if (state != null) {
- AltosDebug.debug("Save state %d", telem.serial);
AltosPreferences.set_state(telem.serial, state, null);
}
send_to_clients();
@@ -280,7 +277,6 @@ public class TelemetryService extends Service implements LocationListener {
private void send_to_client(Messenger client, Message m) {
try {
- AltosDebug.debug("Send message to client %s", client.toString());
client.send(m);
} catch (RemoteException e) {
AltosDebug.error("Client %s disappeared", client.toString());
@@ -290,7 +286,6 @@ public class TelemetryService extends Service implements LocationListener {
private void send_to_clients() {
Message m = message();
- AltosDebug.debug("Send message to %d clients", clients.size());
for (Messenger client : clients)
send_to_client(client, m);
}
@@ -375,7 +370,6 @@ public class TelemetryService extends Service implements LocationListener {
if (altos_link != null) {
try {
double voltage = altos_link.monitor_battery();
- AltosDebug.debug("update receiver voltage %g\n", voltage);
telemetry_state.receiver_battery = voltage;
} catch (InterruptedException ie) {
}
@@ -519,7 +513,11 @@ public class TelemetryService extends Service implements LocationListener {
// Move us into the foreground.
startForeground(NOTIFICATION, notification);
- if (intent != null) {
+ /* Start bluetooth if we don't have a connection already */
+ if (intent != null &&
+ (telemetry_state.connect == TelemetryState.CONNECT_NONE ||
+ telemetry_state.connect == TelemetryState.CONNECT_DISCONNECTED))
+ {
String action = intent.getAction();
if (action.equals(AltosDroid.ACTION_BLUETOOTH)) {