When switching radio parameters, the local device needs to have the
parameters switched, so interrupt the current operation and start
over, the frequency and callsign will be set the next time through.
Signed-off-by: Keith Packard <keithp@keithp.com>
AltosState state;
boolean remote;
double frequency;
AltosState state;
boolean remote;
double frequency;
AltosState previous_state;
AltosConfigData config_data;
AltosGPS gps;
AltosState previous_state;
AltosConfigData config_data;
AltosGPS gps;
try {
if (remote) {
link.set_radio_frequency(frequency);
try {
if (remote) {
link.set_radio_frequency(frequency);
+ link.set_callsign(callsign);
link.start_remote();
} else
link.flush_input();
link.start_remote();
} else
link.flush_input();
public void set_frequency(double in_frequency) {
frequency = in_frequency;
public void set_frequency(double in_frequency) {
frequency = in_frequency;
+ link.abort_reply();
+ }
+
+ public void set_callsign(String in_callsign) {
+ callsign = in_callsign;
+ link.abort_reply();
}
public void post_state() {
listener.update(state);
}
}
public void post_state() {
listener.update(state);
}
+ public void abort() {
+ if (isAlive()) {
+ interrupt();
+ link.abort_reply();
+ try {
+ join();
+ } catch (InterruptedException ie) {
+ }
+ }
+ }
+
public void run() {
try {
for (;;) {
public void run() {
try {
for (;;) {
public boolean monitor_mode = false;
public int telemetry = AltosLib.ao_telemetry_standard;
public double frequency;
public boolean monitor_mode = false;
public int telemetry = AltosLib.ao_telemetry_standard;
public double frequency;
+ public String callsign;
AltosConfigData config_data;
private int telemetry_len() {
AltosConfigData config_data;
private int telemetry_len() {
}
public void set_callsign(String callsign) {
}
public void set_callsign(String callsign) {
+ this.callsign = callsign;
printf ("c c %s\n", callsign);
flush_output();
}
printf ("c c %s\n", callsign);
flush_output();
}
boolean remote;
void stop_display() {
boolean remote;
void stop_display() {
- if (thread != null && thread.isAlive()) {
- thread.interrupt();
- try {
- thread.join();
- } catch (InterruptedException ie) {}
+ if (thread != null) {
+ thread.abort();
/* DocumentListener interface methods */
public void changedUpdate(DocumentEvent e) {
/* DocumentListener interface methods */
public void changedUpdate(DocumentEvent e) {
- if (callsign_value != null)
- AltosUIPreferences.set_callsign(callsign_value.getText());
+ if (callsign_value != null) {
+ String callsign = callsign_value.getText();
+ thread.set_callsign(callsign);
+ AltosUIPreferences.set_callsign(callsign);
+ }
}
public void insertUpdate(DocumentEvent e) {
}
public void insertUpdate(DocumentEvent e) {