X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FTelemetryService.java;h=bc3371f3cfee607dc16f495cc2565976bee0d93b;hp=f1304a95298f3d645e10eb13419e90ba9d993a07;hb=c5b31a14e1ceeb9a33e0016f345832344d24ced7;hpb=cc674d8f991a3a055236ad8b51fecd99080540e1 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 {