summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
bdc953e)
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>
* Messages from TelemetryReader
*/
case MSG_TELEMETRY:
* 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;
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:
s.send_to_clients();
break;
default:
telem.update_state(state);
telemetry_state.states.put(telem.serial, state);
if (state != null) {
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();
AltosPreferences.set_state(telem.serial, state, null);
}
send_to_clients();
private void send_to_client(Messenger client, Message m) {
try {
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());
client.send(m);
} catch (RemoteException e) {
AltosDebug.error("Client %s disappeared", client.toString());
private void send_to_clients() {
Message m = message();
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);
}
for (Messenger client : clients)
send_to_client(client, m);
}
if (altos_link != null) {
try {
double voltage = altos_link.monitor_battery();
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) {
}
telemetry_state.receiver_battery = voltage;
} catch (InterruptedException ie) {
}
// Move us into the foreground.
startForeground(NOTIFICATION, notification);
// Move us into the foreground.
startForeground(NOTIFICATION, notification);
+ /* 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)) {
String action = intent.getAction();
if (action.equals(AltosDroid.ACTION_BLUETOOTH)) {