*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
import android.widget.Toast;
import android.location.Criteria;
-import org.altusmetrum.altoslib_10.*;
+import org.altusmetrum.altoslib_11.*;
public class TelemetryService extends Service implements AltosIdleMonitorListener {
case MSG_DISCONNECT:
AltosDebug.debug("Disconnect command received");
s.address = null;
+ if (!(Boolean) msg.obj)
+ AltosDroidPreferences.set_active_device(null);
s.disconnect(true);
break;
case MSG_DELETE_SERIAL:
telemetry_state.latest_serial = AltosPreferences.latest_state();
+ AltosDebug.debug("latest serial %d\n", telemetry_state.latest_serial);
+
for (int serial : serials) {
AltosState saved_state = AltosPreferences.state(serial);
if (saved_state != null) {
telemetry_state.states.put(serial, saved_state);
} else {
AltosDebug.debug("Failed to recover state for %d", serial);
+ AltosPreferences.remove_state(serial);
}
}
}
public void failed() {
}
+
+ public void error(String reason) {
+ stop_idle_monitor();
+ }
}