2 * Copyright © 2010 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 package org.altusmetrum.telegps;
23 import java.awt.event.*;
25 import javax.swing.event.*;
26 import org.altusmetrum.altoslib_12.*;
27 import org.altusmetrum.altosuilib_12.*;
29 public class TeleGPSConfigUI
31 implements ActionListener, ItemListener, DocumentListener, AltosConfigValues, AltosUnitsListener
38 JLabel frequency_label;
39 JLabel radio_calibration_label;
40 JLabel radio_frequency_label;
41 JLabel radio_enable_label;
43 JLabel aprs_interval_label;
44 JLabel aprs_ssid_label;
45 JLabel aprs_format_label;
46 JLabel flight_log_max_label;
47 JLabel callsign_label;
48 JLabel tracker_motion_label;
49 JLabel tracker_interval_label;
57 AltosUIFreqList radio_frequency_value;
58 JLabel radio_calibration_value;
59 JRadioButton radio_enable_value;
60 AltosUIRateList rate_value;
61 JComboBox<String> aprs_interval_value;
62 JComboBox<Integer> aprs_ssid_value;
63 JComboBox<String> aprs_format_value;
64 JComboBox<String> flight_log_max_value;
65 JTextField callsign_value;
66 JComboBox<String> tracker_motion_value;
67 JComboBox<String> tracker_interval_value;
74 ActionListener listener;
76 static String[] aprs_interval_values = {
83 static Integer[] aprs_ssid_values = {
84 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
87 static String[] tracker_motion_values_m = {
94 static String[] tracker_motion_values_ft = {
101 static String[] tracker_interval_values = {
108 /* A window listener to catch closing events and tell the config code */
109 class ConfigListener extends WindowAdapter {
112 public ConfigListener(TeleGPSConfigUI this_ui) {
116 public void windowClosing(WindowEvent e) {
117 ui.actionPerformed(new ActionEvent(e.getSource(),
118 ActionEvent.ACTION_PERFORMED,
123 public void set_pyros(AltosPyro[] new_pyros) {
126 public AltosPyro[] pyros() {
130 public void set_pyro_firing_time(double new_pyro_firing_time) {
133 public double pyro_firing_time() {
134 return AltosLib.MISSING;
137 boolean is_telemetrum() {
138 String product = product_value.getText();
139 return product != null && product.startsWith("TeleGPS");
142 void set_radio_enable_tool_tip() {
143 if (radio_enable_value.isVisible())
144 radio_enable_value.setToolTipText("Enable/Disable telemetry and RDF transmissions");
146 radio_enable_value.setToolTipText("Firmware version does not support disabling radio");
149 void set_rate_tool_tip() {
150 if (rate_value.isVisible())
151 rate_value.setToolTipText("Select telemetry baud rate");
153 rate_value.setToolTipText("Firmware version does not support variable telemetry rates");
156 void set_aprs_interval_tool_tip() {
157 if (aprs_interval_value.isVisible())
158 aprs_interval_value.setToolTipText("Enable APRS and set the interval between APRS reports");
160 aprs_interval_value.setToolTipText("Hardware doesn't support APRS");
163 void set_aprs_ssid_tool_tip() {
164 if (aprs_ssid_value.isVisible())
165 aprs_ssid_value.setToolTipText("Set the APRS SSID (secondary station identifier)");
166 else if (aprs_ssid_value.isVisible())
167 aprs_ssid_value.setToolTipText("Software version doesn't support setting the APRS SSID");
169 aprs_ssid_value.setToolTipText("Hardware doesn't support APRS");
172 void set_aprs_format_tool_tip() {
173 if (aprs_format_value.isVisible())
174 aprs_format_value.setToolTipText("Set the APRS format (compressed/uncompressed)");
175 else if (aprs_format_value.isVisible())
176 aprs_format_value.setToolTipText("Software version doesn't support setting the APRS format");
178 aprs_format_value.setToolTipText("Hardware doesn't support APRS");
181 void set_flight_log_max_tool_tip() {
182 if (flight_log_max_value.isVisible())
183 flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)");
185 flight_log_max_value.setToolTipText("Cannot set max value with flight logs in memory");
188 /* Build the UI using a grid bag */
189 public TeleGPSConfigUI(JFrame in_owner) {
190 super (in_owner, "Configure Device", false);
193 GridBagConstraints c;
196 Insets il = new Insets(4,4,4,4);
197 Insets ir = new Insets(4,4,4,4);
199 pane = getContentPane();
200 pane.setLayout(new GridBagLayout());
203 c = new GridBagConstraints();
204 c.gridx = 0; c.gridy = row;
206 c.fill = GridBagConstraints.NONE;
207 c.anchor = GridBagConstraints.LINE_START;
209 product_label = new JLabel("Product:");
210 pane.add(product_label, c);
212 c = new GridBagConstraints();
213 c.gridx = 4; c.gridy = row;
215 c.fill = GridBagConstraints.HORIZONTAL;
217 c.anchor = GridBagConstraints.LINE_START;
219 product_value = new JLabel("");
220 pane.add(product_value, c);
224 c = new GridBagConstraints();
225 c.gridx = 0; c.gridy = row;
227 c.fill = GridBagConstraints.NONE;
228 c.anchor = GridBagConstraints.LINE_START;
231 version_label = new JLabel("Software version:");
232 pane.add(version_label, c);
234 c = new GridBagConstraints();
235 c.gridx = 4; c.gridy = row;
237 c.fill = GridBagConstraints.HORIZONTAL;
239 c.anchor = GridBagConstraints.LINE_START;
242 version_value = new JLabel("");
243 pane.add(version_value, c);
247 c = new GridBagConstraints();
248 c.gridx = 0; c.gridy = row;
250 c.fill = GridBagConstraints.NONE;
251 c.anchor = GridBagConstraints.LINE_START;
254 serial_label = new JLabel("Serial:");
255 pane.add(serial_label, c);
257 c = new GridBagConstraints();
258 c.gridx = 4; c.gridy = row;
260 c.fill = GridBagConstraints.HORIZONTAL;
262 c.anchor = GridBagConstraints.LINE_START;
265 serial_value = new JLabel("");
266 pane.add(serial_value, c);
270 c = new GridBagConstraints();
271 c.gridx = 0; c.gridy = row;
273 c.fill = GridBagConstraints.NONE;
274 c.anchor = GridBagConstraints.LINE_START;
277 radio_frequency_label = new JLabel("Frequency:");
278 pane.add(radio_frequency_label, c);
280 c = new GridBagConstraints();
281 c.gridx = 4; c.gridy = row;
283 c.fill = GridBagConstraints.HORIZONTAL;
285 c.anchor = GridBagConstraints.LINE_START;
288 radio_frequency_value = new AltosUIFreqList();
289 radio_frequency_value.addItemListener(this);
290 pane.add(radio_frequency_value, c);
291 radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency");
294 /* Radio Calibration */
295 c = new GridBagConstraints();
296 c.gridx = 0; c.gridy = row;
298 c.fill = GridBagConstraints.NONE;
299 c.anchor = GridBagConstraints.LINE_START;
302 radio_calibration_label = new JLabel("RF Calibration:");
303 pane.add(radio_calibration_label, c);
305 c = new GridBagConstraints();
306 c.gridx = 4; c.gridy = row;
308 c.fill = GridBagConstraints.HORIZONTAL;
310 c.anchor = GridBagConstraints.LINE_START;
313 radio_calibration_value = new JLabel(String.format("%d", 1186611));
314 pane.add(radio_calibration_value, c);
318 c = new GridBagConstraints();
319 c.gridx = 0; c.gridy = row;
321 c.fill = GridBagConstraints.NONE;
322 c.anchor = GridBagConstraints.LINE_START;
325 radio_enable_label = new JLabel("Telemetry/RDF/APRS Enable:");
326 pane.add(radio_enable_label, c);
328 c = new GridBagConstraints();
329 c.gridx = 4; c.gridy = row;
331 c.fill = GridBagConstraints.HORIZONTAL;
333 c.anchor = GridBagConstraints.LINE_START;
336 radio_enable_value = new JRadioButton("Enabled");
337 radio_enable_value.addItemListener(this);
338 pane.add(radio_enable_value, c);
339 set_radio_enable_tool_tip();
343 c = new GridBagConstraints();
344 c.gridx = 0; c.gridy = row;
346 c.fill = GridBagConstraints.NONE;
347 c.anchor = GridBagConstraints.LINE_START;
350 rate_label = new JLabel("Telemetry baud rate:");
351 pane.add(rate_label, c);
353 c = new GridBagConstraints();
354 c.gridx = 4; c.gridy = row;
356 c.fill = GridBagConstraints.HORIZONTAL;
358 c.anchor = GridBagConstraints.LINE_START;
361 rate_value = new AltosUIRateList();
362 rate_value.addItemListener(this);
363 pane.add(rate_value, c);
368 c = new GridBagConstraints();
369 c.gridx = 0; c.gridy = row;
371 c.fill = GridBagConstraints.NONE;
372 c.anchor = GridBagConstraints.LINE_START;
375 aprs_interval_label = new JLabel("APRS Interval(s):");
376 pane.add(aprs_interval_label, c);
378 c = new GridBagConstraints();
379 c.gridx = 4; c.gridy = row;
381 c.fill = GridBagConstraints.HORIZONTAL;
383 c.anchor = GridBagConstraints.LINE_START;
386 aprs_interval_value = new JComboBox<String>(aprs_interval_values);
387 aprs_interval_value.setEditable(true);
388 aprs_interval_value.addItemListener(this);
389 pane.add(aprs_interval_value, c);
390 set_aprs_interval_tool_tip();
394 c = new GridBagConstraints();
395 c.gridx = 0; c.gridy = row;
397 c.fill = GridBagConstraints.NONE;
398 c.anchor = GridBagConstraints.LINE_START;
401 aprs_ssid_label = new JLabel("APRS SSID:");
402 pane.add(aprs_ssid_label, c);
404 c = new GridBagConstraints();
405 c.gridx = 4; c.gridy = row;
407 c.fill = GridBagConstraints.HORIZONTAL;
409 c.anchor = GridBagConstraints.LINE_START;
412 aprs_ssid_value = new JComboBox<Integer>(aprs_ssid_values);
413 aprs_ssid_value.setEditable(false);
414 aprs_ssid_value.addItemListener(this);
415 aprs_ssid_value.setMaximumRowCount(aprs_ssid_values.length);
416 pane.add(aprs_ssid_value, c);
417 set_aprs_ssid_tool_tip();
421 c = new GridBagConstraints();
422 c.gridx = 0; c.gridy = row;
424 c.fill = GridBagConstraints.NONE;
425 c.anchor = GridBagConstraints.LINE_START;
428 aprs_format_label = new JLabel("APRS format:");
429 pane.add(aprs_format_label, c);
431 c = new GridBagConstraints();
432 c.gridx = 4; c.gridy = row;
434 c.fill = GridBagConstraints.HORIZONTAL;
436 c.anchor = GridBagConstraints.LINE_START;
439 aprs_format_value = new JComboBox<String>(AltosLib.ao_aprs_format_name);
440 aprs_format_value.setEditable(false);
441 aprs_format_value.addItemListener(this);
442 aprs_format_value.setMaximumRowCount(AltosLib.ao_aprs_format_name.length);
443 pane.add(aprs_format_value, c);
444 set_aprs_format_tool_tip();
448 c = new GridBagConstraints();
449 c.gridx = 0; c.gridy = row;
451 c.fill = GridBagConstraints.NONE;
452 c.anchor = GridBagConstraints.LINE_START;
455 callsign_label = new JLabel("Callsign:");
456 pane.add(callsign_label, c);
458 c = new GridBagConstraints();
459 c.gridx = 4; c.gridy = row;
461 c.fill = GridBagConstraints.HORIZONTAL;
463 c.anchor = GridBagConstraints.LINE_START;
466 callsign_value = new JTextField(AltosUIPreferences.callsign());
467 callsign_value.getDocument().addDocumentListener(this);
468 pane.add(callsign_value, c);
469 callsign_value.setToolTipText("Callsign reported in telemetry data");
473 c = new GridBagConstraints();
474 c.gridx = 0; c.gridy = row;
476 c.fill = GridBagConstraints.NONE;
477 c.anchor = GridBagConstraints.LINE_START;
480 flight_log_max_label = new JLabel("Maximum Log Size (kB):");
481 pane.add(flight_log_max_label, c);
483 c = new GridBagConstraints();
484 c.gridx = 4; c.gridy = row;
486 c.fill = GridBagConstraints.HORIZONTAL;
488 c.anchor = GridBagConstraints.LINE_START;
491 flight_log_max_value = new JComboBox<String>();
492 flight_log_max_value.setEditable(true);
493 flight_log_max_value.addItemListener(this);
494 pane.add(flight_log_max_value, c);
495 set_flight_log_max_tool_tip();
498 /* Tracker triger horiz distances */
499 c = new GridBagConstraints();
500 c.gridx = 0; c.gridy = row;
502 c.fill = GridBagConstraints.NONE;
503 c.anchor = GridBagConstraints.LINE_START;
506 tracker_motion_label = new JLabel(get_tracker_motion_label());
507 pane.add(tracker_motion_label, c);
509 c = new GridBagConstraints();
510 c.gridx = 4; c.gridy = row;
512 c.fill = GridBagConstraints.HORIZONTAL;
514 c.anchor = GridBagConstraints.LINE_START;
517 tracker_motion_value = new JComboBox<String>(tracker_motion_values());
518 tracker_motion_value.setEditable(true);
519 tracker_motion_value.addItemListener(this);
520 pane.add(tracker_motion_value, c);
523 /* Tracker triger vert distances */
524 c = new GridBagConstraints();
525 c.gridx = 0; c.gridy = row;
527 c.fill = GridBagConstraints.NONE;
528 c.anchor = GridBagConstraints.LINE_START;
531 tracker_interval_label = new JLabel("Position Reporting Interval (s):");
532 pane.add(tracker_interval_label, c);
534 c = new GridBagConstraints();
535 c.gridx = 4; c.gridy = row;
537 c.fill = GridBagConstraints.HORIZONTAL;
539 c.anchor = GridBagConstraints.LINE_START;
542 tracker_interval_value = new JComboBox<String>(tracker_interval_values);
543 tracker_interval_value.setEditable(true);
544 tracker_interval_value.addItemListener(this);
545 pane.add(tracker_interval_value, c);
546 set_tracker_tool_tip();
550 c = new GridBagConstraints();
551 c.gridx = 0; c.gridy = row;
553 c.fill = GridBagConstraints.NONE;
554 c.anchor = GridBagConstraints.LINE_START;
556 save = new JButton("Save");
558 save.addActionListener(this);
559 save.setActionCommand("Save");
561 c = new GridBagConstraints();
562 c.gridx = 2; c.gridy = row;
564 c.fill = GridBagConstraints.NONE;
565 c.anchor = GridBagConstraints.CENTER;
567 reset = new JButton("Reset");
569 reset.addActionListener(this);
570 reset.setActionCommand("Reset");
572 c = new GridBagConstraints();
573 c.gridx = 4; c.gridy = row;
575 c.fill = GridBagConstraints.NONE;
576 c.anchor = GridBagConstraints.CENTER;
578 reboot = new JButton("Reboot");
580 reboot.addActionListener(this);
581 reboot.setActionCommand("Reboot");
583 c = new GridBagConstraints();
584 c.gridx = 6; c.gridy = row;
586 c.fill = GridBagConstraints.NONE;
587 c.anchor = GridBagConstraints.LINE_END;
589 close = new JButton("Close");
591 close.addActionListener(this);
592 close.setActionCommand("Close");
594 addWindowListener(new ConfigListener(this));
595 AltosPreferences.register_units_listener(this);
598 /* Once the initial values are set, the config code will show the dialog */
599 public void make_visible() {
601 setLocationRelativeTo(owner);
605 /* If any values have been changed, confirm before closing */
606 public boolean check_dirty(String operation) {
608 Object[] options = { String.format("%s anyway", operation), "Keep editing" };
610 i = JOptionPane.showOptionDialog(this,
611 String.format("Configuration modified. %s anyway?", operation),
612 "Configuration Modified",
613 JOptionPane.DEFAULT_OPTION,
614 JOptionPane.WARNING_MESSAGE,
615 null, options, options[1]);
622 public void set_dirty() {
624 save.setEnabled(true);
627 public void set_clean() {
629 save.setEnabled(false);
632 public void dispose() {
633 AltosPreferences.unregister_units_listener(this);
637 public int accel_cal_plus() {
638 return AltosLib.MISSING;
641 public int accel_cal_minus() {
642 return AltosLib.MISSING;
645 public void set_accel_cal(int accel_plus, int accel_minus) {
648 /* Listen for events from our buttons */
649 public void actionPerformed(ActionEvent e) {
650 String cmd = e.getActionCommand();
652 if (cmd.equals("Close") || cmd.equals("Reboot"))
653 if (!check_dirty(cmd))
655 listener.actionPerformed(e);
656 if (cmd.equals("Close") || cmd.equals("Reboot")) {
663 /* ItemListener interface method */
664 public void itemStateChanged(ItemEvent e) {
668 /* DocumentListener interface methods */
669 public void changedUpdate(DocumentEvent e) {
673 public void insertUpdate(DocumentEvent e) {
677 public void removeUpdate(DocumentEvent e) {
681 /* Let the config code hook on a listener */
682 public void addActionListener(ActionListener l) {
686 public void units_changed(boolean imperial_units) {
687 boolean was_dirty = dirty;
689 if (tracker_motion_value.isVisible()) {
690 String motion = tracker_motion_value.getSelectedItem().toString();
691 tracker_motion_label.setText(get_tracker_motion_label());
692 set_tracker_motion_values();
694 int m = (int) (AltosConvert.height.parse_locale(motion, !imperial_units) + 0.5);
695 set_tracker_motion(m);
696 } catch (ParseException pe) {
703 /* set and get all of the dialog values */
704 public void set_product(String product) {
705 radio_frequency_value.set_product(product);
706 product_value.setText(product);
707 set_flight_log_max_tool_tip();
710 public void set_version(String version) {
711 version_value.setText(version);
714 public void set_serial(int serial) {
715 radio_frequency_value.set_serial(serial);
716 serial_value.setText(String.format("%d", serial));
719 public void set_altitude_32(int altitude_32) {
722 public void set_main_deploy(int new_main_deploy) {
725 public int main_deploy() {
726 return AltosLib.MISSING;
729 public void set_apogee_delay(int new_apogee_delay) { }
731 public int apogee_delay() {
732 return AltosLib.MISSING;
735 public void set_apogee_lockout(int new_apogee_lockout) { }
737 public int apogee_lockout() { return AltosLib.MISSING; }
739 public void set_radio_frequency(double new_radio_frequency) {
740 if (new_radio_frequency != AltosLib.MISSING)
741 radio_frequency_value.set_frequency(new_radio_frequency);
742 radio_frequency_label.setVisible(new_radio_frequency != AltosLib.MISSING);
743 radio_frequency_value.setVisible(new_radio_frequency != AltosLib.MISSING);
746 public double radio_frequency() {
747 return radio_frequency_value.frequency();
750 public void set_radio_calibration(int new_radio_calibration) {
751 if (new_radio_calibration != AltosLib.MISSING)
752 radio_calibration_value.setText(String.format("%d", new_radio_calibration));
753 radio_calibration_value.setVisible(new_radio_calibration == AltosLib.MISSING);
754 radio_calibration_label.setVisible(new_radio_calibration == AltosLib.MISSING);
757 public void set_radio_enable(int new_radio_enable) {
758 if (new_radio_enable != AltosLib.MISSING)
759 radio_enable_value.setSelected(new_radio_enable != 0);
760 radio_enable_label.setVisible(new_radio_enable != AltosLib.MISSING);
761 radio_enable_value.setVisible(new_radio_enable != AltosLib.MISSING);
762 set_radio_enable_tool_tip();
765 public int radio_enable() {
766 if (radio_enable_value.isVisible())
767 return radio_enable_value.isSelected() ? 1 : 0;
769 return AltosLib.MISSING;
772 public void set_telemetry_rate(int new_rate) {
773 if (new_rate != AltosLib.MISSING)
774 rate_value.set_rate(new_rate);
775 rate_label.setVisible(new_rate != AltosLib.MISSING);
776 rate_value.setVisible(new_rate != AltosLib.MISSING);
779 public int telemetry_rate() {
780 return rate_value.rate();
783 public void set_callsign(String new_callsign) {
784 if (new_callsign != null)
785 callsign_value.setText(new_callsign);
786 callsign_value.setVisible(new_callsign != null);
787 callsign_label.setVisible(new_callsign != null);
790 public String callsign() {
791 if (callsign_value.isVisible())
792 return callsign_value.getText();
796 private int parse_int(String name, String s, boolean split) throws AltosConfigDataException {
799 v = s.split("\\s+")[0];
801 return Integer.parseInt(v);
802 } catch (NumberFormatException ne) {
803 throw new AltosConfigDataException("Invalid %s \"%s\"", name, s);
807 int flight_log_max_limit;
810 public String flight_log_max_label(int flight_log_max) {
811 if (flight_log_max_limit != 0) {
812 int nflight = flight_log_max_limit / flight_log_max;
813 String plural = nflight > 1 ? "s" : "";
815 return String.format("%d (%d flight%s)", flight_log_max, nflight, plural);
817 return String.format("%d", flight_log_max);
820 public void set_flight_log_max(int new_flight_log_max) {
821 flight_log_max_value.setSelectedItem(flight_log_max_label(new_flight_log_max));
822 flight_log_max = new_flight_log_max;
823 set_flight_log_max_tool_tip();
826 public void set_flight_log_max_enabled(boolean enable) {
827 flight_log_max_value.setEnabled(enable);
828 set_flight_log_max_tool_tip();
831 public int flight_log_max() throws AltosConfigDataException {
832 return parse_int("flight log max", flight_log_max_value.getSelectedItem().toString(), true);
835 public void set_flight_log_max_limit(int new_flight_log_max_limit) {
836 flight_log_max_limit = new_flight_log_max_limit;
837 flight_log_max_value.removeAllItems();
838 for (int i = 8; i >= 1; i--) {
839 int size = flight_log_max_limit / i;
840 flight_log_max_value.addItem(String.format("%d (%d flights)", size, i));
842 if (flight_log_max != 0)
843 set_flight_log_max(flight_log_max);
846 public void set_ignite_mode(int new_ignite_mode) { }
847 public int ignite_mode() { return AltosLib.MISSING; }
850 public void set_pad_orientation(int new_pad_orientation) { }
851 public int pad_orientation() { return AltosLib.MISSING; }
853 public void set_beep(int new_beep) { }
855 public int beep() { return AltosLib.MISSING; }
857 String[] tracker_motion_values() {
858 if (AltosConvert.imperial_units)
859 return tracker_motion_values_ft;
861 return tracker_motion_values_m;
864 void set_tracker_motion_values() {
865 String[] v = tracker_motion_values();
866 while (tracker_motion_value.getItemCount() > 0)
867 tracker_motion_value.removeItemAt(0);
868 for (int i = 0; i < v.length; i++)
869 tracker_motion_value.addItem(v[i]);
870 tracker_motion_value.setMaximumRowCount(v.length);
873 String get_tracker_motion_label() {
874 return String.format("Logging Trigger Motion (%s):", AltosConvert.height.parse_units());
877 void set_tracker_tool_tip() {
878 if (tracker_motion_value.isVisible())
879 tracker_motion_value.setToolTipText("How far the device must move before logging");
881 tracker_motion_value.setToolTipText("This device doesn't disable logging when stationary");
882 if (tracker_interval_value.isVisible())
883 tracker_interval_value.setToolTipText("How often to report GPS position");
885 tracker_interval_value.setToolTipText("This device can't configure interval");
888 public void set_tracker_motion(int tracker_motion) {
889 if (tracker_motion != AltosLib.MISSING)
890 tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion));
891 tracker_motion_label.setVisible(tracker_motion != AltosLib.MISSING);
892 tracker_motion_value.setVisible(tracker_motion != AltosLib.MISSING);
895 public int tracker_motion() throws AltosConfigDataException {
896 if (tracker_motion_value.isVisible()) {
897 String str = tracker_motion_value.getSelectedItem().toString();
899 return (int) (AltosConvert.height.parse_locale(str) + 0.5);
900 } catch (ParseException pe) {
901 throw new AltosConfigDataException("invalid tracker motion %s", str);
904 return AltosLib.MISSING;
907 public void set_tracker_interval(int tracker_interval) {
908 if (tracker_interval != AltosLib.MISSING)
909 tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval));
910 tracker_interval_label.setVisible(tracker_interval != AltosLib.MISSING);
911 tracker_interval_value.setVisible(tracker_interval != AltosLib.MISSING);
914 public int tracker_interval() throws AltosConfigDataException {
915 if (tracker_interval_value.isVisible())
916 return parse_int ("tracker interval", tracker_interval_value.getSelectedItem().toString(), false);
917 return AltosLib.MISSING;
920 public void set_aprs_interval(int new_aprs_interval) {
921 if (new_aprs_interval != AltosLib.MISSING)
922 aprs_interval_value.setSelectedItem(Integer.toString(new_aprs_interval));
923 aprs_interval_value.setVisible(new_aprs_interval != AltosLib.MISSING);
924 aprs_interval_label.setVisible(new_aprs_interval != AltosLib.MISSING);
925 set_aprs_interval_tool_tip();
928 public int aprs_interval() throws AltosConfigDataException {
929 if (aprs_interval_value.isVisible()) {
930 String s = aprs_interval_value.getSelectedItem().toString();
932 return parse_int("aprs interval", s, false);
934 return AltosLib.MISSING;
937 public void set_aprs_ssid(int new_aprs_ssid) {
938 if (new_aprs_ssid != AltosLib.MISSING)
939 aprs_ssid_value.setSelectedItem(new_aprs_ssid);
940 aprs_ssid_value.setVisible(new_aprs_ssid != AltosLib.MISSING);
941 aprs_ssid_label.setVisible(new_aprs_ssid != AltosLib.MISSING);
942 set_aprs_ssid_tool_tip();
945 public int aprs_ssid() throws AltosConfigDataException {
946 if (aprs_ssid_value.isVisible()) {
947 Integer i = (Integer) aprs_ssid_value.getSelectedItem();
950 return AltosLib.MISSING;
953 public void set_aprs_format(int new_aprs_format) {
954 if (new_aprs_format != AltosLib.MISSING)
955 aprs_format_value.setSelectedIndex(new_aprs_format);
956 aprs_format_value.setVisible(new_aprs_format != AltosLib.MISSING);
957 aprs_format_label.setVisible(new_aprs_format != AltosLib.MISSING);
958 set_aprs_format_tool_tip();
961 public int aprs_format() throws AltosConfigDataException {
962 if (aprs_format_value.isVisible())
963 return aprs_format_value.getSelectedIndex();
964 return AltosLib.MISSING;