- if (D) Log.d(TAG, "Connect command received");
- s.device = (BluetoothDevice) msg.obj;
- s.startAltosBluetooth();
+ AltosDebug.debug("Connect command received");
+ DeviceAddress address = (DeviceAddress) msg.obj;
+ AltosDroidPreferences.set_active_device(address);
+ s.start_altos_bluetooth(address, false);
+ break;
+ case MSG_OPEN_USB:
+ AltosDebug.debug("Open USB command received");
+ UsbDevice device = (UsbDevice) msg.obj;
+ s.start_usb(device);
+ break;
+ case MSG_DISCONNECT:
+ AltosDebug.debug("Disconnect command received");
+ s.address = null;
+ s.disconnect(true);
+ break;
+ case MSG_DELETE_SERIAL:
+ AltosDebug.debug("Delete Serial command received");
+ s.delete_serial((Integer) msg.obj);
+ break;
+ case MSG_SETFREQUENCY:
+ AltosDebug.debug("MSG_SETFREQUENCY");
+ s.telemetry_state.frequency = (Double) msg.obj;
+ if (s.telemetry_state.connect == TelemetryState.CONNECT_CONNECTED) {
+ try {
+ s.altos_link.set_radio_frequency(s.telemetry_state.frequency);
+ s.altos_link.save_frequency();
+ } catch (InterruptedException e) {
+ } catch (TimeoutException e) {
+ }
+ }
+ s.send_to_clients();
+ break;
+ case MSG_SETBAUD:
+ AltosDebug.debug("MSG_SETBAUD");
+ s.telemetry_state.telemetry_rate = (Integer) msg.obj;
+ if (s.telemetry_state.connect == TelemetryState.CONNECT_CONNECTED) {
+ s.altos_link.set_telemetry_rate(s.telemetry_state.telemetry_rate);
+ s.altos_link.save_telemetry_rate();
+ }
+ s.send_to_clients();