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; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 package org.altusmetrum.telegps;
22 import java.awt.event.*;
24 import javax.swing.event.*;
25 import org.altusmetrum.altoslib_7.*;
26 import org.altusmetrum.altosuilib_7.*;
28 public class TeleGPSConfigUI
30 implements ActionListener, ItemListener, DocumentListener, AltosConfigValues, AltosUnitsListener
37 JLabel frequency_label;
38 JLabel radio_calibration_label;
39 JLabel radio_frequency_label;
40 JLabel radio_enable_label;
42 JLabel aprs_interval_label;
43 JLabel aprs_ssid_label;
44 JLabel aprs_format_label;
45 JLabel flight_log_max_label;
46 JLabel callsign_label;
47 JLabel tracker_motion_label;
48 JLabel tracker_interval_label;
56 AltosUIFreqList radio_frequency_value;
57 JTextField radio_calibration_value;
58 JRadioButton radio_enable_value;
59 AltosUIRateList rate_value;
60 JComboBox<String> aprs_interval_value;
61 JComboBox<Integer> aprs_ssid_value;
62 JComboBox<String> aprs_format_value;
63 JComboBox<String> flight_log_max_value;
64 JTextField callsign_value;
65 JComboBox<String> tracker_motion_value;
66 JComboBox<String> tracker_interval_value;
73 ActionListener listener;
75 static String[] aprs_interval_values = {
82 static Integer[] aprs_ssid_values = {
83 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
86 static String[] tracker_motion_values_m = {
93 static String[] tracker_motion_values_ft = {
100 static String[] tracker_interval_values = {
107 /* A window listener to catch closing events and tell the config code */
108 class ConfigListener extends WindowAdapter {
111 public ConfigListener(TeleGPSConfigUI this_ui) {
115 public void windowClosing(WindowEvent e) {
116 ui.actionPerformed(new ActionEvent(e.getSource(),
117 ActionEvent.ACTION_PERFORMED,
122 public void set_pyros(AltosPyro[] new_pyros) {
125 public AltosPyro[] pyros() {
129 public void set_pyro_firing_time(double new_pyro_firing_time) {
132 public double pyro_firing_time() {
136 boolean is_telemetrum() {
137 String product = product_value.getText();
138 return product != null && product.startsWith("TeleGPS");
141 void set_radio_calibration_tool_tip() {
142 if (radio_calibration_value.isEnabled())
143 radio_calibration_value.setToolTipText("Tune radio output to match desired frequency");
145 radio_calibration_value.setToolTipText("Cannot tune radio while connected over packet mode");
148 void set_radio_enable_tool_tip() {
149 if (radio_enable_value.isEnabled())
150 radio_enable_value.setToolTipText("Enable/Disable telemetry and RDF transmissions");
152 radio_enable_value.setToolTipText("Firmware version does not support disabling radio");
155 void set_rate_tool_tip() {
156 if (rate_value.isEnabled())
157 rate_value.setToolTipText("Select telemetry baud rate");
159 rate_value.setToolTipText("Firmware version does not support variable telemetry rates");
162 void set_aprs_interval_tool_tip() {
163 if (aprs_interval_value.isEnabled())
164 aprs_interval_value.setToolTipText("Enable APRS and set the interval between APRS reports");
166 aprs_interval_value.setToolTipText("Hardware doesn't support APRS");
169 void set_aprs_ssid_tool_tip() {
170 if (aprs_ssid_value.isEnabled())
171 aprs_ssid_value.setToolTipText("Set the APRS SSID (secondary station identifier)");
172 else if (aprs_ssid_value.isEnabled())
173 aprs_ssid_value.setToolTipText("Software version doesn't support setting the APRS SSID");
175 aprs_ssid_value.setToolTipText("Hardware doesn't support APRS");
178 void set_aprs_format_tool_tip() {
179 if (aprs_format_value.isEnabled())
180 aprs_format_value.setToolTipText("Set the APRS format (compressed/uncompressed)");
181 else if (aprs_format_value.isEnabled())
182 aprs_format_value.setToolTipText("Software version doesn't support setting the APRS format");
184 aprs_format_value.setToolTipText("Hardware doesn't support APRS");
187 void set_flight_log_max_tool_tip() {
188 if (flight_log_max_value.isEnabled())
189 flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)");
191 flight_log_max_value.setToolTipText("Cannot set max value with flight logs in memory");
194 /* Build the UI using a grid bag */
195 public TeleGPSConfigUI(JFrame in_owner) {
196 super (in_owner, "Configure Device", false);
199 GridBagConstraints c;
202 Insets il = new Insets(4,4,4,4);
203 Insets ir = new Insets(4,4,4,4);
205 pane = getContentPane();
206 pane.setLayout(new GridBagLayout());
209 c = new GridBagConstraints();
210 c.gridx = 0; c.gridy = row;
212 c.fill = GridBagConstraints.NONE;
213 c.anchor = GridBagConstraints.LINE_START;
215 product_label = new JLabel("Product:");
216 pane.add(product_label, c);
218 c = new GridBagConstraints();
219 c.gridx = 4; c.gridy = row;
221 c.fill = GridBagConstraints.HORIZONTAL;
223 c.anchor = GridBagConstraints.LINE_START;
225 product_value = new JLabel("");
226 pane.add(product_value, c);
230 c = new GridBagConstraints();
231 c.gridx = 0; c.gridy = row;
233 c.fill = GridBagConstraints.NONE;
234 c.anchor = GridBagConstraints.LINE_START;
237 version_label = new JLabel("Software version:");
238 pane.add(version_label, c);
240 c = new GridBagConstraints();
241 c.gridx = 4; c.gridy = row;
243 c.fill = GridBagConstraints.HORIZONTAL;
245 c.anchor = GridBagConstraints.LINE_START;
248 version_value = new JLabel("");
249 pane.add(version_value, c);
253 c = new GridBagConstraints();
254 c.gridx = 0; c.gridy = row;
256 c.fill = GridBagConstraints.NONE;
257 c.anchor = GridBagConstraints.LINE_START;
260 serial_label = new JLabel("Serial:");
261 pane.add(serial_label, c);
263 c = new GridBagConstraints();
264 c.gridx = 4; c.gridy = row;
266 c.fill = GridBagConstraints.HORIZONTAL;
268 c.anchor = GridBagConstraints.LINE_START;
271 serial_value = new JLabel("");
272 pane.add(serial_value, c);
276 c = new GridBagConstraints();
277 c.gridx = 0; c.gridy = row;
279 c.fill = GridBagConstraints.NONE;
280 c.anchor = GridBagConstraints.LINE_START;
283 radio_frequency_label = new JLabel("Frequency:");
284 pane.add(radio_frequency_label, c);
286 c = new GridBagConstraints();
287 c.gridx = 4; c.gridy = row;
289 c.fill = GridBagConstraints.HORIZONTAL;
291 c.anchor = GridBagConstraints.LINE_START;
294 radio_frequency_value = new AltosUIFreqList();
295 radio_frequency_value.addItemListener(this);
296 pane.add(radio_frequency_value, c);
297 radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency");
300 /* Radio Calibration */
301 c = new GridBagConstraints();
302 c.gridx = 0; c.gridy = row;
304 c.fill = GridBagConstraints.NONE;
305 c.anchor = GridBagConstraints.LINE_START;
308 radio_calibration_label = new JLabel("RF Calibration:");
309 pane.add(radio_calibration_label, c);
311 c = new GridBagConstraints();
312 c.gridx = 4; c.gridy = row;
314 c.fill = GridBagConstraints.HORIZONTAL;
316 c.anchor = GridBagConstraints.LINE_START;
319 radio_calibration_value = new JTextField(String.format("%d", 1186611));
320 radio_calibration_value.getDocument().addDocumentListener(this);
321 pane.add(radio_calibration_value, c);
322 set_radio_calibration_tool_tip();
326 c = new GridBagConstraints();
327 c.gridx = 0; c.gridy = row;
329 c.fill = GridBagConstraints.NONE;
330 c.anchor = GridBagConstraints.LINE_START;
333 radio_enable_label = new JLabel("Telemetry/RDF/APRS Enable:");
334 pane.add(radio_enable_label, c);
336 c = new GridBagConstraints();
337 c.gridx = 4; c.gridy = row;
339 c.fill = GridBagConstraints.HORIZONTAL;
341 c.anchor = GridBagConstraints.LINE_START;
344 radio_enable_value = new JRadioButton("Enabled");
345 radio_enable_value.addItemListener(this);
346 pane.add(radio_enable_value, c);
347 set_radio_enable_tool_tip();
351 c = new GridBagConstraints();
352 c.gridx = 0; c.gridy = row;
354 c.fill = GridBagConstraints.NONE;
355 c.anchor = GridBagConstraints.LINE_START;
358 rate_label = new JLabel("Telemetry baud rate:");
359 pane.add(rate_label, c);
361 c = new GridBagConstraints();
362 c.gridx = 4; c.gridy = row;
364 c.fill = GridBagConstraints.HORIZONTAL;
366 c.anchor = GridBagConstraints.LINE_START;
369 rate_value = new AltosUIRateList();
370 rate_value.addItemListener(this);
371 pane.add(rate_value, c);
376 c = new GridBagConstraints();
377 c.gridx = 0; c.gridy = row;
379 c.fill = GridBagConstraints.NONE;
380 c.anchor = GridBagConstraints.LINE_START;
383 aprs_interval_label = new JLabel("APRS Interval(s):");
384 pane.add(aprs_interval_label, c);
386 c = new GridBagConstraints();
387 c.gridx = 4; c.gridy = row;
389 c.fill = GridBagConstraints.HORIZONTAL;
391 c.anchor = GridBagConstraints.LINE_START;
394 aprs_interval_value = new JComboBox<String>(aprs_interval_values);
395 aprs_interval_value.setEditable(true);
396 aprs_interval_value.addItemListener(this);
397 pane.add(aprs_interval_value, c);
398 set_aprs_interval_tool_tip();
402 c = new GridBagConstraints();
403 c.gridx = 0; c.gridy = row;
405 c.fill = GridBagConstraints.NONE;
406 c.anchor = GridBagConstraints.LINE_START;
409 aprs_ssid_label = new JLabel("APRS SSID:");
410 pane.add(aprs_ssid_label, c);
412 c = new GridBagConstraints();
413 c.gridx = 4; c.gridy = row;
415 c.fill = GridBagConstraints.HORIZONTAL;
417 c.anchor = GridBagConstraints.LINE_START;
420 aprs_ssid_value = new JComboBox<Integer>(aprs_ssid_values);
421 aprs_ssid_value.setEditable(false);
422 aprs_ssid_value.addItemListener(this);
423 aprs_ssid_value.setMaximumRowCount(aprs_ssid_values.length);
424 pane.add(aprs_ssid_value, c);
425 set_aprs_ssid_tool_tip();
429 c = new GridBagConstraints();
430 c.gridx = 0; c.gridy = row;
432 c.fill = GridBagConstraints.NONE;
433 c.anchor = GridBagConstraints.LINE_START;
436 aprs_format_label = new JLabel("APRS format:");
437 pane.add(aprs_format_label, c);
439 c = new GridBagConstraints();
440 c.gridx = 4; c.gridy = row;
442 c.fill = GridBagConstraints.HORIZONTAL;
444 c.anchor = GridBagConstraints.LINE_START;
447 aprs_format_value = new JComboBox<String>(AltosLib.ao_aprs_format_name);
448 aprs_format_value.setEditable(false);
449 aprs_format_value.addItemListener(this);
450 aprs_format_value.setMaximumRowCount(AltosLib.ao_aprs_format_name.length);
451 pane.add(aprs_format_value, c);
452 set_aprs_format_tool_tip();
456 c = new GridBagConstraints();
457 c.gridx = 0; c.gridy = row;
459 c.fill = GridBagConstraints.NONE;
460 c.anchor = GridBagConstraints.LINE_START;
463 callsign_label = new JLabel("Callsign:");
464 pane.add(callsign_label, c);
466 c = new GridBagConstraints();
467 c.gridx = 4; c.gridy = row;
469 c.fill = GridBagConstraints.HORIZONTAL;
471 c.anchor = GridBagConstraints.LINE_START;
474 callsign_value = new JTextField(AltosUIPreferences.callsign());
475 callsign_value.getDocument().addDocumentListener(this);
476 pane.add(callsign_value, c);
477 callsign_value.setToolTipText("Callsign reported in telemetry data");
481 c = new GridBagConstraints();
482 c.gridx = 0; c.gridy = row;
484 c.fill = GridBagConstraints.NONE;
485 c.anchor = GridBagConstraints.LINE_START;
488 flight_log_max_label = new JLabel("Maximum Log Size (kB):");
489 pane.add(flight_log_max_label, c);
491 c = new GridBagConstraints();
492 c.gridx = 4; c.gridy = row;
494 c.fill = GridBagConstraints.HORIZONTAL;
496 c.anchor = GridBagConstraints.LINE_START;
499 flight_log_max_value = new JComboBox<String>();
500 flight_log_max_value.setEditable(true);
501 flight_log_max_value.addItemListener(this);
502 pane.add(flight_log_max_value, c);
503 set_flight_log_max_tool_tip();
506 /* Tracker triger horiz distances */
507 c = new GridBagConstraints();
508 c.gridx = 0; c.gridy = row;
510 c.fill = GridBagConstraints.NONE;
511 c.anchor = GridBagConstraints.LINE_START;
514 tracker_motion_label = new JLabel(get_tracker_motion_label());
515 pane.add(tracker_motion_label, c);
517 c = new GridBagConstraints();
518 c.gridx = 4; c.gridy = row;
520 c.fill = GridBagConstraints.HORIZONTAL;
522 c.anchor = GridBagConstraints.LINE_START;
525 tracker_motion_value = new JComboBox<String>(tracker_motion_values());
526 tracker_motion_value.setEditable(true);
527 tracker_motion_value.addItemListener(this);
528 pane.add(tracker_motion_value, c);
531 /* Tracker triger vert distances */
532 c = new GridBagConstraints();
533 c.gridx = 0; c.gridy = row;
535 c.fill = GridBagConstraints.NONE;
536 c.anchor = GridBagConstraints.LINE_START;
539 tracker_interval_label = new JLabel("Position Reporting Interval (s):");
540 pane.add(tracker_interval_label, c);
542 c = new GridBagConstraints();
543 c.gridx = 4; c.gridy = row;
545 c.fill = GridBagConstraints.HORIZONTAL;
547 c.anchor = GridBagConstraints.LINE_START;
550 tracker_interval_value = new JComboBox<String>(tracker_interval_values);
551 tracker_interval_value.setEditable(true);
552 tracker_interval_value.addItemListener(this);
553 pane.add(tracker_interval_value, c);
554 set_tracker_tool_tip();
558 c = new GridBagConstraints();
559 c.gridx = 0; c.gridy = row;
561 c.fill = GridBagConstraints.NONE;
562 c.anchor = GridBagConstraints.LINE_START;
564 save = new JButton("Save");
566 save.addActionListener(this);
567 save.setActionCommand("Save");
569 c = new GridBagConstraints();
570 c.gridx = 2; c.gridy = row;
572 c.fill = GridBagConstraints.NONE;
573 c.anchor = GridBagConstraints.CENTER;
575 reset = new JButton("Reset");
577 reset.addActionListener(this);
578 reset.setActionCommand("Reset");
580 c = new GridBagConstraints();
581 c.gridx = 4; c.gridy = row;
583 c.fill = GridBagConstraints.NONE;
584 c.anchor = GridBagConstraints.CENTER;
586 reboot = new JButton("Reboot");
588 reboot.addActionListener(this);
589 reboot.setActionCommand("Reboot");
591 c = new GridBagConstraints();
592 c.gridx = 6; c.gridy = row;
594 c.fill = GridBagConstraints.NONE;
595 c.anchor = GridBagConstraints.LINE_END;
597 close = new JButton("Close");
599 close.addActionListener(this);
600 close.setActionCommand("Close");
602 addWindowListener(new ConfigListener(this));
603 AltosPreferences.register_units_listener(this);
606 /* Once the initial values are set, the config code will show the dialog */
607 public void make_visible() {
609 setLocationRelativeTo(owner);
613 /* If any values have been changed, confirm before closing */
614 public boolean check_dirty(String operation) {
616 Object[] options = { String.format("%s anyway", operation), "Keep editing" };
618 i = JOptionPane.showOptionDialog(this,
619 String.format("Configuration modified. %s anyway?", operation),
620 "Configuration Modified",
621 JOptionPane.DEFAULT_OPTION,
622 JOptionPane.WARNING_MESSAGE,
623 null, options, options[1]);
632 save.setEnabled(true);
635 public void set_clean() {
637 save.setEnabled(false);
640 public void dispose() {
641 AltosPreferences.unregister_units_listener(this);
645 /* Listen for events from our buttons */
646 public void actionPerformed(ActionEvent e) {
647 String cmd = e.getActionCommand();
649 if (cmd.equals("Close") || cmd.equals("Reboot"))
650 if (!check_dirty(cmd))
652 listener.actionPerformed(e);
653 if (cmd.equals("Close") || cmd.equals("Reboot")) {
660 /* ItemListener interface method */
661 public void itemStateChanged(ItemEvent e) {
665 /* DocumentListener interface methods */
666 public void changedUpdate(DocumentEvent e) {
670 public void insertUpdate(DocumentEvent e) {
674 public void removeUpdate(DocumentEvent e) {
678 /* Let the config code hook on a listener */
679 public void addActionListener(ActionListener l) {
683 public void units_changed(boolean imperial_units) {
684 boolean was_dirty = dirty;
686 if (tracker_motion_value.isEnabled()) {
687 String motion = tracker_motion_value.getSelectedItem().toString();
688 tracker_motion_label.setText(get_tracker_motion_label());
689 set_tracker_motion_values();
691 int m = (int) (AltosConvert.height.parse_locale(motion, !imperial_units) + 0.5);
692 set_tracker_motion(m);
693 } catch (ParseException pe) {
700 /* set and get all of the dialog values */
701 public void set_product(String product) {
702 radio_frequency_value.set_product(product);
703 product_value.setText(product);
704 set_flight_log_max_tool_tip();
707 public void set_version(String version) {
708 version_value.setText(version);
711 public void set_serial(int serial) {
712 radio_frequency_value.set_serial(serial);
713 serial_value.setText(String.format("%d", serial));
716 public void set_altitude_32(int altitude_32) {
719 public void set_main_deploy(int new_main_deploy) {
722 public int main_deploy() {
726 public void set_apogee_delay(int new_apogee_delay) { }
728 public int apogee_delay() {
732 public void set_apogee_lockout(int new_apogee_lockout) { }
734 public int apogee_lockout() { return -1; }
736 public void set_radio_frequency(double new_radio_frequency) {
737 radio_frequency_value.set_frequency(new_radio_frequency);
740 public double radio_frequency() {
741 return radio_frequency_value.frequency();
744 public void set_radio_calibration(int new_radio_calibration) {
745 radio_calibration_value.setVisible(new_radio_calibration >= 0);
746 if (new_radio_calibration < 0)
747 radio_calibration_value.setText("Disabled");
749 radio_calibration_value.setText(String.format("%d", new_radio_calibration));
752 private int parse_int(String name, String s, boolean split) throws AltosConfigDataException {
755 v = s.split("\\s+")[0];
757 return Integer.parseInt(v);
758 } catch (NumberFormatException ne) {
759 throw new AltosConfigDataException("Invalid %s \"%s\"", name, s);
763 public int radio_calibration() throws AltosConfigDataException {
764 return parse_int("radio calibration", radio_calibration_value.getText(), false);
767 public void set_radio_enable(int new_radio_enable) {
768 if (new_radio_enable >= 0) {
769 radio_enable_value.setSelected(new_radio_enable > 0);
770 radio_enable_value.setEnabled(true);
772 radio_enable_value.setSelected(true);
773 radio_enable_value.setVisible(radio_frequency() > 0);
774 radio_enable_value.setEnabled(false);
776 set_radio_enable_tool_tip();
779 public int radio_enable() {
780 if (radio_enable_value.isEnabled())
781 return radio_enable_value.isSelected() ? 1 : 0;
786 public void set_telemetry_rate(int new_rate) {
787 rate_value.set_rate(new_rate);
790 public int telemetry_rate() {
791 return rate_value.rate();
794 public void set_callsign(String new_callsign) {
795 callsign_value.setVisible(new_callsign != null);
796 callsign_value.setText(new_callsign);
799 public String callsign() {
800 return callsign_value.getText();
803 int flight_log_max_limit;
806 public String flight_log_max_label(int flight_log_max) {
807 if (flight_log_max_limit != 0) {
808 int nflight = flight_log_max_limit / flight_log_max;
809 String plural = nflight > 1 ? "s" : "";
811 return String.format("%d (%d flight%s)", flight_log_max, nflight, plural);
813 return String.format("%d", flight_log_max);
816 public void set_flight_log_max(int new_flight_log_max) {
817 flight_log_max_value.setSelectedItem(flight_log_max_label(new_flight_log_max));
818 flight_log_max = new_flight_log_max;
819 set_flight_log_max_tool_tip();
822 public void set_flight_log_max_enabled(boolean enable) {
823 flight_log_max_value.setEnabled(enable);
824 set_flight_log_max_tool_tip();
827 public int flight_log_max() throws AltosConfigDataException {
828 return parse_int("flight log max", flight_log_max_value.getSelectedItem().toString(), true);
831 public void set_flight_log_max_limit(int new_flight_log_max_limit) {
832 flight_log_max_limit = new_flight_log_max_limit;
833 flight_log_max_value.removeAllItems();
834 for (int i = 8; i >= 1; i--) {
835 int size = flight_log_max_limit / i;
836 flight_log_max_value.addItem(String.format("%d (%d flights)", size, i));
838 if (flight_log_max != 0)
839 set_flight_log_max(flight_log_max);
842 public void set_ignite_mode(int new_ignite_mode) { }
843 public int ignite_mode() { return -1; }
846 public void set_pad_orientation(int new_pad_orientation) { }
847 public int pad_orientation() { return -1; }
849 public void set_beep(int new_beep) { }
851 public int beep() { return -1; }
853 String[] tracker_motion_values() {
854 if (AltosConvert.imperial_units)
855 return tracker_motion_values_ft;
857 return tracker_motion_values_m;
860 void set_tracker_motion_values() {
861 String[] v = tracker_motion_values();
862 while (tracker_motion_value.getItemCount() > 0)
863 tracker_motion_value.removeItemAt(0);
864 for (int i = 0; i < v.length; i++)
865 tracker_motion_value.addItem(v[i]);
866 tracker_motion_value.setMaximumRowCount(v.length);
869 String get_tracker_motion_label() {
870 return String.format("Logging Trigger Motion (%s):", AltosConvert.height.show_units());
873 void set_tracker_tool_tip() {
874 if (tracker_motion_value.isEnabled())
875 tracker_motion_value.setToolTipText("How far the device must move before logging");
877 tracker_motion_value.setToolTipText("This device doesn't disable logging when stationary");
878 if (tracker_interval_value.isEnabled())
879 tracker_interval_value.setToolTipText("How often to report GPS position");
881 tracker_interval_value.setToolTipText("This device can't configure interval");
884 public void set_tracker_motion(int tracker_motion) {
885 if (tracker_motion < 0) {
886 tracker_motion_value.setEnabled(false);
888 tracker_motion_value.setEnabled(true);
889 tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion));
893 public int tracker_motion() throws AltosConfigDataException {
894 String str = tracker_motion_value.getSelectedItem().toString();
896 return (int) (AltosConvert.height.parse_locale(str) + 0.5);
897 } catch (ParseException pe) {
898 throw new AltosConfigDataException("invalid tracker motion %s", str);
902 public void set_tracker_interval(int tracker_interval) {
903 if (tracker_interval< 0) {
904 tracker_interval_value.setEnabled(false);
906 tracker_interval_value.setEnabled(true);
907 tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval));
911 public int tracker_interval() throws AltosConfigDataException {
912 return parse_int ("tracker interval", tracker_interval_value.getSelectedItem().toString(), false);
915 public void set_aprs_interval(int new_aprs_interval) {
918 if (new_aprs_interval <= 0)
921 s = Integer.toString(new_aprs_interval);
922 aprs_interval_value.setSelectedItem(s);
923 aprs_interval_value.setVisible(new_aprs_interval >= 0);
924 set_aprs_interval_tool_tip();
927 public int aprs_interval() throws AltosConfigDataException {
928 String s = aprs_interval_value.getSelectedItem().toString();
930 if (s.equals("Disabled"))
932 return parse_int("aprs interval", s, false);
935 public void set_aprs_ssid(int new_aprs_ssid) {
936 aprs_ssid_value.setSelectedItem(Math.max(0,new_aprs_ssid));
937 aprs_ssid_value.setVisible(new_aprs_ssid >= 0);
938 set_aprs_ssid_tool_tip();
941 public int aprs_ssid() throws AltosConfigDataException {
942 Integer i = (Integer) aprs_ssid_value.getSelectedItem();
946 public void set_aprs_format(int new_aprs_format) {
947 aprs_format_value.setVisible(new_aprs_format >= 0);
948 aprs_format_label.setVisible(new_aprs_format >= 0);
950 aprs_format_value.setSelectedIndex(Math.max(0,new_aprs_format));
951 set_aprs_format_tool_tip();
954 public int aprs_format() throws AltosConfigDataException {
955 return aprs_format_value.getSelectedIndex();