summaryrefslogtreecommitdiff
path: root/altosdroid
diff options
context:
space:
mode:
authorMike Beattie <mike@ethernal.org>2013-04-21 14:44:07 +1200
committerMike Beattie <mike@ethernal.org>2013-04-21 14:44:07 +1200
commitc5b31a14e1ceeb9a33e0016f345832344d24ced7 (patch)
tree9a2e03d9a11b76477719b1f50fc0f23cc64e72c9 /altosdroid
parentcc674d8f991a3a055236ad8b51fecd99080540e1 (diff)
altosdroid: fix up 'send last' code.
Signed-off-by: Mike Beattie <mike@ethernal.org>
Diffstat (limited to 'altosdroid')
-rw-r--r--altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java20
1 files changed, 4 insertions, 16 deletions
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java
index f1304a95..bc3371f3 100644
--- a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java
+++ b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java
@@ -133,16 +133,14 @@ public class TelemetryService extends Service {
// Now we try to send the freshly connected UI any relavant information about what
// we're talking to - Basically state and Config Data.
msg.replyTo.send(Message.obtain(null, AltosDroid.MSG_STATE_CHANGE, s.state, -1, s.mConfigData));
+ // We also send any recent telemetry or location data that's cached
+ if (s.last_state != null) msg.replyTo.send(Message.obtain(null, AltosDroid.MSG_TELEMETRY, s.last_state ));
+ if (s.last_location != null) msg.replyTo.send(Message.obtain(null, AltosDroid.MSG_LOCATION , s.last_location ));
+ if (s.last_crc_errors != 0 ) msg.replyTo.send(Message.obtain(null, AltosDroid.MSG_CRC_ERROR, s.last_crc_errors));
} catch (RemoteException e) {
s.mClients.remove(msg.replyTo);
}
if (D) Log.d(TAG, "Client bound to service");
- if (s.last_state != null)
- s.sendTelemetry(s.last_state);
- if (s.last_location != null)
- s.sendLocation(s.last_location);
- if (s.last_crc_errors != 0)
- s.sendCrcErrors(s.last_crc_errors);
break;
case MSG_UNREGISTER_CLIENT:
s.mClients.remove(msg.replyTo);
@@ -198,16 +196,6 @@ public class TelemetryService extends Service {
}
}
- public void sendTelemetry(AltosState state) {
- }
-
- public void sendLocation(Location location) {
- mHandler.obtainMessage(MSG_LOCATION, location).sendToTarget();
- }
-
- public void sendCrcErrors(int crc_errors) {
- }
-
private void sendMessageToClients(Message m) {
for (int i=mClients.size()-1; i>=0; i--) {
try {