- public void set_radio() {
- telemetry = AltosPreferences.telemetry(device.getSerial());
- channel = AltosPreferences.channel(device.getSerial());
- set_channel(channel);
- set_callsign(AltosPreferences.callsign());
- }
-
- private int telemetry_len() {
- return Altos.telemetry_len(telemetry);
- }
-
- public void set_channel(int in_channel) {
- channel = in_channel;
- if (altos != null) {
- if (monitor_mode)
- printf("m 0\nc r %d\nm %x\n",
- channel, telemetry_len());
- else
- printf("c r %d\n", channel);
- flush_output();
- }
- }
-
- public void set_telemetry(int in_telemetry) {
- telemetry = in_telemetry;
- if (altos != null) {
- if (monitor_mode)
- printf("m 0\nm %x\n", telemetry_len());
- flush_output();
- }
- }
-
- void set_monitor(boolean monitor) {
- monitor_mode = monitor;
- if (altos != null) {
- if (monitor)
- printf("m %x\n", telemetry_len());
- else
- printf("m 0\n");
- flush_output();
- }
- }
-
- public void set_callsign(String callsign) {
- if (altos != null) {
- printf ("c c %s\n", callsign);
- flush_output();
- }
- }
-
- public void start_remote() {
- if (debug)
- System.out.printf("start remote\n");
- set_radio();
- printf("p\nE 0\n");
- flush_input();
- remote = true;
- }
-
- public void stop_remote() {
- if (debug)
- System.out.printf("stop remote\n");
- try {
- flush_input();
- } finally {
- printf ("~\n");
- flush_output();
- }
- remote = false;
- }
-