From c5b31a14e1ceeb9a33e0016f345832344d24ced7 Mon Sep 17 00:00:00 2001 From: Mike Beattie Date: Sun, 21 Apr 2013 14:44:07 +1200 Subject: [PATCH] altosdroid: fix up 'send last' code. Signed-off-by: Mike Beattie --- .../AltosDroid/TelemetryService.java | 20 ++++--------------- 1 file 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 { -- 2.30.2