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;
21 import java.awt.event.*;
23 import javax.swing.event.*;
24 import org.altusmetrum.altoslib_6.*;
25 import org.altusmetrum.altosuilib_6.*;
27 public class TeleGPSConfigUI
29 implements ActionListener, ItemListener, DocumentListener, AltosConfigValues, AltosUnitsListener
36 JLabel frequency_label;
37 JLabel radio_calibration_label;
38 JLabel radio_frequency_label;
39 JLabel radio_enable_label;
41 JLabel aprs_interval_label;
42 JLabel aprs_ssid_label;
43 JLabel aprs_format_label;
44 JLabel flight_log_max_label;
45 JLabel callsign_label;
46 JLabel tracker_motion_label;
47 JLabel tracker_interval_label;
55 AltosUIFreqList radio_frequency_value;
56 JTextField radio_calibration_value;
57 JRadioButton radio_enable_value;
58 AltosUIRateList rate_value;
59 JComboBox<String> aprs_interval_value;
60 JComboBox<Integer> aprs_ssid_value;
61 JComboBox<String> aprs_format_value;
62 JComboBox<String> flight_log_max_value;
63 JTextField callsign_value;
64 JComboBox<String> tracker_motion_value;
65 JComboBox<String> tracker_interval_value;
72 ActionListener listener;
74 static String[] aprs_interval_values = {
81 static Integer[] aprs_ssid_values = {
82 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
85 static String[] tracker_motion_values_m = {
92 static String[] tracker_motion_values_ft = {
99 static String[] tracker_interval_values = {
106 /* A window listener to catch closing events and tell the config code */
107 class ConfigListener extends WindowAdapter {
110 public ConfigListener(TeleGPSConfigUI this_ui) {
114 public void windowClosing(WindowEvent e) {
115 ui.actionPerformed(new ActionEvent(e.getSource(),
116 ActionEvent.ACTION_PERFORMED,
121 public void set_pyros(AltosPyro[] new_pyros) {
124 public AltosPyro[] pyros() {
128 public void set_pyro_firing_time(double new_pyro_firing_time) {
131 public double pyro_firing_time() {
135 boolean is_telemetrum() {
136 String product = product_value.getText();
137 return product != null && product.startsWith("TeleGPS");
140 void set_radio_calibration_tool_tip() {
141 if (radio_calibration_value.isEnabled())
142 radio_calibration_value.setToolTipText("Tune radio output to match desired frequency");
144 radio_calibration_value.setToolTipText("Cannot tune radio while connected over packet mode");
147 void set_radio_enable_tool_tip() {
148 if (radio_enable_value.isEnabled())
149 radio_enable_value.setToolTipText("Enable/Disable telemetry and RDF transmissions");
151 radio_enable_value.setToolTipText("Firmware version does not support disabling radio");
154 void set_rate_tool_tip() {
155 if (rate_value.isEnabled())
156 rate_value.setToolTipText("Select telemetry baud rate");
158 rate_value.setToolTipText("Firmware version does not support variable telemetry rates");
161 void set_aprs_interval_tool_tip() {
162 if (aprs_interval_value.isEnabled())
163 aprs_interval_value.setToolTipText("Enable APRS and set the interval between APRS reports");
165 aprs_interval_value.setToolTipText("Hardware doesn't support APRS");
168 void set_aprs_ssid_tool_tip() {
169 if (aprs_ssid_value.isEnabled())
170 aprs_ssid_value.setToolTipText("Set the APRS SSID (secondary station identifier)");
171 else if (aprs_ssid_value.isEnabled())
172 aprs_ssid_value.setToolTipText("Software version doesn't support setting the APRS SSID");
174 aprs_ssid_value.setToolTipText("Hardware doesn't support APRS");
177 void set_aprs_format_tool_tip() {
178 if (aprs_format_value.isEnabled())
179 aprs_format_value.setToolTipText("Set the APRS format (compressed/uncompressed)");
180 else if (aprs_format_value.isEnabled())
181 aprs_format_value.setToolTipText("Software version doesn't support setting the APRS format");
183 aprs_format_value.setToolTipText("Hardware doesn't support APRS");
186 void set_flight_log_max_tool_tip() {
187 if (flight_log_max_value.isEnabled())
188 flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)");
190 flight_log_max_value.setToolTipText("Cannot set max value with flight logs in memory");
193 /* Build the UI using a grid bag */
194 public TeleGPSConfigUI(JFrame in_owner) {
195 super (in_owner, "Configure Device", false);
198 GridBagConstraints c;
201 Insets il = new Insets(4,4,4,4);
202 Insets ir = new Insets(4,4,4,4);
204 pane = getContentPane();
205 pane.setLayout(new GridBagLayout());
208 c = new GridBagConstraints();
209 c.gridx = 0; c.gridy = row;
211 c.fill = GridBagConstraints.NONE;
212 c.anchor = GridBagConstraints.LINE_START;
214 product_label = new JLabel("Product:");
215 pane.add(product_label, c);
217 c = new GridBagConstraints();
218 c.gridx = 4; c.gridy = row;
220 c.fill = GridBagConstraints.HORIZONTAL;
222 c.anchor = GridBagConstraints.LINE_START;
224 product_value = new JLabel("");
225 pane.add(product_value, c);
229 c = new GridBagConstraints();
230 c.gridx = 0; c.gridy = row;
232 c.fill = GridBagConstraints.NONE;
233 c.anchor = GridBagConstraints.LINE_START;
236 version_label = new JLabel("Software version:");
237 pane.add(version_label, c);
239 c = new GridBagConstraints();
240 c.gridx = 4; c.gridy = row;
242 c.fill = GridBagConstraints.HORIZONTAL;
244 c.anchor = GridBagConstraints.LINE_START;
247 version_value = new JLabel("");
248 pane.add(version_value, c);
252 c = new GridBagConstraints();
253 c.gridx = 0; c.gridy = row;
255 c.fill = GridBagConstraints.NONE;
256 c.anchor = GridBagConstraints.LINE_START;
259 serial_label = new JLabel("Serial:");
260 pane.add(serial_label, c);
262 c = new GridBagConstraints();
263 c.gridx = 4; c.gridy = row;
265 c.fill = GridBagConstraints.HORIZONTAL;
267 c.anchor = GridBagConstraints.LINE_START;
270 serial_value = new JLabel("");
271 pane.add(serial_value, c);
275 c = new GridBagConstraints();
276 c.gridx = 0; c.gridy = row;
278 c.fill = GridBagConstraints.NONE;
279 c.anchor = GridBagConstraints.LINE_START;
282 radio_frequency_label = new JLabel("Frequency:");
283 pane.add(radio_frequency_label, c);
285 c = new GridBagConstraints();
286 c.gridx = 4; c.gridy = row;
288 c.fill = GridBagConstraints.HORIZONTAL;
290 c.anchor = GridBagConstraints.LINE_START;
293 radio_frequency_value = new AltosUIFreqList();
294 radio_frequency_value.addItemListener(this);
295 pane.add(radio_frequency_value, c);
296 radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency");
299 /* Radio Calibration */
300 c = new GridBagConstraints();
301 c.gridx = 0; c.gridy = row;
303 c.fill = GridBagConstraints.NONE;
304 c.anchor = GridBagConstraints.LINE_START;
307 radio_calibration_label = new JLabel("RF Calibration:");
308 pane.add(radio_calibration_label, c);
310 c = new GridBagConstraints();
311 c.gridx = 4; c.gridy = row;
313 c.fill = GridBagConstraints.HORIZONTAL;
315 c.anchor = GridBagConstraints.LINE_START;
318 radio_calibration_value = new JTextField(String.format("%d", 1186611));
319 radio_calibration_value.getDocument().addDocumentListener(this);
320 pane.add(radio_calibration_value, c);
321 set_radio_calibration_tool_tip();
325 c = new GridBagConstraints();
326 c.gridx = 0; c.gridy = row;
328 c.fill = GridBagConstraints.NONE;
329 c.anchor = GridBagConstraints.LINE_START;
332 radio_enable_label = new JLabel("Telemetry/RDF/APRS Enable:");
333 pane.add(radio_enable_label, c);
335 c = new GridBagConstraints();
336 c.gridx = 4; c.gridy = row;
338 c.fill = GridBagConstraints.HORIZONTAL;
340 c.anchor = GridBagConstraints.LINE_START;
343 radio_enable_value = new JRadioButton("Enabled");
344 radio_enable_value.addItemListener(this);
345 pane.add(radio_enable_value, c);
346 set_radio_enable_tool_tip();
350 c = new GridBagConstraints();
351 c.gridx = 0; c.gridy = row;
353 c.fill = GridBagConstraints.NONE;
354 c.anchor = GridBagConstraints.LINE_START;
357 rate_label = new JLabel("Telemetry baud rate:");
358 pane.add(rate_label, c);
360 c = new GridBagConstraints();
361 c.gridx = 4; c.gridy = row;
363 c.fill = GridBagConstraints.HORIZONTAL;
365 c.anchor = GridBagConstraints.LINE_START;
368 rate_value = new AltosUIRateList();
369 rate_value.addItemListener(this);
370 pane.add(rate_value, c);
375 c = new GridBagConstraints();
376 c.gridx = 0; c.gridy = row;
378 c.fill = GridBagConstraints.NONE;
379 c.anchor = GridBagConstraints.LINE_START;
382 aprs_interval_label = new JLabel("APRS Interval(s):");
383 pane.add(aprs_interval_label, c);
385 c = new GridBagConstraints();
386 c.gridx = 4; c.gridy = row;
388 c.fill = GridBagConstraints.HORIZONTAL;
390 c.anchor = GridBagConstraints.LINE_START;
393 aprs_interval_value = new JComboBox<String>(aprs_interval_values);
394 aprs_interval_value.setEditable(true);
395 aprs_interval_value.addItemListener(this);
396 pane.add(aprs_interval_value, c);
397 set_aprs_interval_tool_tip();
401 c = new GridBagConstraints();
402 c.gridx = 0; c.gridy = row;
404 c.fill = GridBagConstraints.NONE;
405 c.anchor = GridBagConstraints.LINE_START;
408 aprs_ssid_label = new JLabel("APRS SSID:");
409 pane.add(aprs_ssid_label, c);
411 c = new GridBagConstraints();
412 c.gridx = 4; c.gridy = row;
414 c.fill = GridBagConstraints.HORIZONTAL;
416 c.anchor = GridBagConstraints.LINE_START;
419 aprs_ssid_value = new JComboBox<Integer>(aprs_ssid_values);
420 aprs_ssid_value.setEditable(false);
421 aprs_ssid_value.addItemListener(this);
422 aprs_ssid_value.setMaximumRowCount(aprs_ssid_values.length);
423 pane.add(aprs_ssid_value, c);
424 set_aprs_ssid_tool_tip();
428 c = new GridBagConstraints();
429 c.gridx = 0; c.gridy = row;
431 c.fill = GridBagConstraints.NONE;
432 c.anchor = GridBagConstraints.LINE_START;
435 aprs_format_label = new JLabel("APRS format:");
436 pane.add(aprs_format_label, c);
438 c = new GridBagConstraints();
439 c.gridx = 4; c.gridy = row;
441 c.fill = GridBagConstraints.HORIZONTAL;
443 c.anchor = GridBagConstraints.LINE_START;
446 aprs_format_value = new JComboBox<String>(AltosLib.ao_aprs_format_name);
447 aprs_format_value.setEditable(false);
448 aprs_format_value.addItemListener(this);
449 aprs_format_value.setMaximumRowCount(AltosLib.ao_aprs_format_name.length);
450 pane.add(aprs_format_value, c);
451 set_aprs_format_tool_tip();
455 c = new GridBagConstraints();
456 c.gridx = 0; c.gridy = row;
458 c.fill = GridBagConstraints.NONE;
459 c.anchor = GridBagConstraints.LINE_START;
462 callsign_label = new JLabel("Callsign:");
463 pane.add(callsign_label, c);
465 c = new GridBagConstraints();
466 c.gridx = 4; c.gridy = row;
468 c.fill = GridBagConstraints.HORIZONTAL;
470 c.anchor = GridBagConstraints.LINE_START;
473 callsign_value = new JTextField(AltosUIPreferences.callsign());
474 callsign_value.getDocument().addDocumentListener(this);
475 pane.add(callsign_value, c);
476 callsign_value.setToolTipText("Callsign reported in telemetry data");
480 c = new GridBagConstraints();
481 c.gridx = 0; c.gridy = row;
483 c.fill = GridBagConstraints.NONE;
484 c.anchor = GridBagConstraints.LINE_START;
487 flight_log_max_label = new JLabel("Maximum Log Size (kB):");
488 pane.add(flight_log_max_label, c);
490 c = new GridBagConstraints();
491 c.gridx = 4; c.gridy = row;
493 c.fill = GridBagConstraints.HORIZONTAL;
495 c.anchor = GridBagConstraints.LINE_START;
498 flight_log_max_value = new JComboBox<String>();
499 flight_log_max_value.setEditable(true);
500 flight_log_max_value.addItemListener(this);
501 pane.add(flight_log_max_value, c);
502 set_flight_log_max_tool_tip();
505 /* Tracker triger horiz distances */
506 c = new GridBagConstraints();
507 c.gridx = 0; c.gridy = row;
509 c.fill = GridBagConstraints.NONE;
510 c.anchor = GridBagConstraints.LINE_START;
513 tracker_motion_label = new JLabel(get_tracker_motion_label());
514 pane.add(tracker_motion_label, c);
516 c = new GridBagConstraints();
517 c.gridx = 4; c.gridy = row;
519 c.fill = GridBagConstraints.HORIZONTAL;
521 c.anchor = GridBagConstraints.LINE_START;
524 tracker_motion_value = new JComboBox<String>(tracker_motion_values());
525 tracker_motion_value.setEditable(true);
526 tracker_motion_value.addItemListener(this);
527 pane.add(tracker_motion_value, c);
530 /* Tracker triger vert distances */
531 c = new GridBagConstraints();
532 c.gridx = 0; c.gridy = row;
534 c.fill = GridBagConstraints.NONE;
535 c.anchor = GridBagConstraints.LINE_START;
538 tracker_interval_label = new JLabel("Position Reporting Interval (s):");
539 pane.add(tracker_interval_label, c);
541 c = new GridBagConstraints();
542 c.gridx = 4; c.gridy = row;
544 c.fill = GridBagConstraints.HORIZONTAL;
546 c.anchor = GridBagConstraints.LINE_START;
549 tracker_interval_value = new JComboBox<String>(tracker_interval_values);
550 tracker_interval_value.setEditable(true);
551 tracker_interval_value.addItemListener(this);
552 pane.add(tracker_interval_value, c);
553 set_tracker_tool_tip();
557 c = new GridBagConstraints();
558 c.gridx = 0; c.gridy = row;
560 c.fill = GridBagConstraints.NONE;
561 c.anchor = GridBagConstraints.LINE_START;
563 save = new JButton("Save");
565 save.addActionListener(this);
566 save.setActionCommand("Save");
568 c = new GridBagConstraints();
569 c.gridx = 2; c.gridy = row;
571 c.fill = GridBagConstraints.NONE;
572 c.anchor = GridBagConstraints.CENTER;
574 reset = new JButton("Reset");
576 reset.addActionListener(this);
577 reset.setActionCommand("Reset");
579 c = new GridBagConstraints();
580 c.gridx = 4; c.gridy = row;
582 c.fill = GridBagConstraints.NONE;
583 c.anchor = GridBagConstraints.CENTER;
585 reboot = new JButton("Reboot");
587 reboot.addActionListener(this);
588 reboot.setActionCommand("Reboot");
590 c = new GridBagConstraints();
591 c.gridx = 6; c.gridy = row;
593 c.fill = GridBagConstraints.NONE;
594 c.anchor = GridBagConstraints.LINE_END;
596 close = new JButton("Close");
598 close.addActionListener(this);
599 close.setActionCommand("Close");
601 addWindowListener(new ConfigListener(this));
602 AltosPreferences.register_units_listener(this);
605 /* Once the initial values are set, the config code will show the dialog */
606 public void make_visible() {
608 setLocationRelativeTo(owner);
612 /* If any values have been changed, confirm before closing */
613 public boolean check_dirty(String operation) {
615 Object[] options = { String.format("%s anyway", operation), "Keep editing" };
617 i = JOptionPane.showOptionDialog(this,
618 String.format("Configuration modified. %s anyway?", operation),
619 "Configuration Modified",
620 JOptionPane.DEFAULT_OPTION,
621 JOptionPane.WARNING_MESSAGE,
622 null, options, options[1]);
631 save.setEnabled(true);
634 public void set_clean() {
636 save.setEnabled(false);
639 public void dispose() {
640 AltosPreferences.unregister_units_listener(this);
644 /* Listen for events from our buttons */
645 public void actionPerformed(ActionEvent e) {
646 String cmd = e.getActionCommand();
648 if (cmd.equals("Close") || cmd.equals("Reboot"))
649 if (!check_dirty(cmd))
651 listener.actionPerformed(e);
652 if (cmd.equals("Close") || cmd.equals("Reboot")) {
659 /* ItemListener interface method */
660 public void itemStateChanged(ItemEvent e) {
664 /* DocumentListener interface methods */
665 public void changedUpdate(DocumentEvent e) {
669 public void insertUpdate(DocumentEvent e) {
673 public void removeUpdate(DocumentEvent e) {
677 /* Let the config code hook on a listener */
678 public void addActionListener(ActionListener l) {
682 public void units_changed(boolean imperial_units) {
683 boolean was_dirty = dirty;
685 if (tracker_motion_value.isEnabled()) {
686 String motion = tracker_motion_value.getSelectedItem().toString();
687 tracker_motion_label.setText(get_tracker_motion_label());
688 set_tracker_motion_values();
689 set_tracker_motion((int) (AltosConvert.height.parse(motion, !imperial_units) + 0.5));
695 /* set and get all of the dialog values */
696 public void set_product(String product) {
697 radio_frequency_value.set_product(product);
698 product_value.setText(product);
699 set_flight_log_max_tool_tip();
702 public void set_version(String version) {
703 version_value.setText(version);
706 public void set_serial(int serial) {
707 radio_frequency_value.set_serial(serial);
708 serial_value.setText(String.format("%d", serial));
711 public void set_altitude_32(int altitude_32) {
714 public void set_main_deploy(int new_main_deploy) {
717 public int main_deploy() {
721 public void set_apogee_delay(int new_apogee_delay) { }
723 public int apogee_delay() {
727 public void set_apogee_lockout(int new_apogee_lockout) { }
729 public int apogee_lockout() { return -1; }
731 public void set_radio_frequency(double new_radio_frequency) {
732 radio_frequency_value.set_frequency(new_radio_frequency);
735 public double radio_frequency() {
736 return radio_frequency_value.frequency();
739 public void set_radio_calibration(int new_radio_calibration) {
740 radio_calibration_value.setVisible(new_radio_calibration >= 0);
741 if (new_radio_calibration < 0)
742 radio_calibration_value.setText("Disabled");
744 radio_calibration_value.setText(String.format("%d", new_radio_calibration));
747 private int parse_int(String name, String s, boolean split) throws AltosConfigDataException {
750 v = s.split("\\s+")[0];
752 return Integer.parseInt(v);
753 } catch (NumberFormatException ne) {
754 throw new AltosConfigDataException("Invalid %s \"%s\"", name, s);
758 public int radio_calibration() throws AltosConfigDataException {
759 return parse_int("radio calibration", radio_calibration_value.getText(), false);
762 public void set_radio_enable(int new_radio_enable) {
763 if (new_radio_enable >= 0) {
764 radio_enable_value.setSelected(new_radio_enable > 0);
765 radio_enable_value.setEnabled(true);
767 radio_enable_value.setSelected(true);
768 radio_enable_value.setVisible(radio_frequency() > 0);
769 radio_enable_value.setEnabled(false);
771 set_radio_enable_tool_tip();
774 public int radio_enable() {
775 if (radio_enable_value.isEnabled())
776 return radio_enable_value.isSelected() ? 1 : 0;
781 public void set_telemetry_rate(int new_rate) {
782 rate_value.set_rate(new_rate);
785 public int telemetry_rate() {
786 return rate_value.rate();
789 public void set_callsign(String new_callsign) {
790 callsign_value.setVisible(new_callsign != null);
791 callsign_value.setText(new_callsign);
794 public String callsign() {
795 return callsign_value.getText();
798 int flight_log_max_limit;
801 public String flight_log_max_label(int flight_log_max) {
802 if (flight_log_max_limit != 0) {
803 int nflight = flight_log_max_limit / flight_log_max;
804 String plural = nflight > 1 ? "s" : "";
806 return String.format("%d (%d flight%s)", flight_log_max, nflight, plural);
808 return String.format("%d", flight_log_max);
811 public void set_flight_log_max(int new_flight_log_max) {
812 flight_log_max_value.setSelectedItem(flight_log_max_label(new_flight_log_max));
813 flight_log_max = new_flight_log_max;
814 set_flight_log_max_tool_tip();
817 public void set_flight_log_max_enabled(boolean enable) {
818 flight_log_max_value.setEnabled(enable);
819 set_flight_log_max_tool_tip();
822 public int flight_log_max() throws AltosConfigDataException {
823 return parse_int("flight log max", flight_log_max_value.getSelectedItem().toString(), true);
826 public void set_flight_log_max_limit(int new_flight_log_max_limit) {
827 flight_log_max_limit = new_flight_log_max_limit;
828 flight_log_max_value.removeAllItems();
829 for (int i = 8; i >= 1; i--) {
830 int size = flight_log_max_limit / i;
831 flight_log_max_value.addItem(String.format("%d (%d flights)", size, i));
833 if (flight_log_max != 0)
834 set_flight_log_max(flight_log_max);
837 public void set_ignite_mode(int new_ignite_mode) { }
838 public int ignite_mode() { return -1; }
841 public void set_pad_orientation(int new_pad_orientation) { }
842 public int pad_orientation() { return -1; }
844 public void set_beep(int new_beep) { }
846 public int beep() { return -1; }
848 String[] tracker_motion_values() {
849 if (AltosConvert.imperial_units)
850 return tracker_motion_values_ft;
852 return tracker_motion_values_m;
855 void set_tracker_motion_values() {
856 String[] v = tracker_motion_values();
857 while (tracker_motion_value.getItemCount() > 0)
858 tracker_motion_value.removeItemAt(0);
859 for (int i = 0; i < v.length; i++)
860 tracker_motion_value.addItem(v[i]);
861 tracker_motion_value.setMaximumRowCount(v.length);
864 String get_tracker_motion_label() {
865 return String.format("Logging Trigger Motion (%s):", AltosConvert.height.show_units());
868 void set_tracker_tool_tip() {
869 if (tracker_motion_value.isEnabled())
870 tracker_motion_value.setToolTipText("How far the device must move before logging");
872 tracker_motion_value.setToolTipText("This device doesn't disable logging when stationary");
873 if (tracker_interval_value.isEnabled())
874 tracker_interval_value.setToolTipText("How often to report GPS position");
876 tracker_interval_value.setToolTipText("This device can't configure interval");
879 public void set_tracker_motion(int tracker_motion) {
880 if (tracker_motion < 0) {
881 tracker_motion_value.setEnabled(false);
883 tracker_motion_value.setEnabled(true);
884 tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion));
888 public int tracker_motion() throws AltosConfigDataException {
889 return (int) AltosConvert.height.parse(tracker_motion_value.getSelectedItem().toString());
892 public void set_tracker_interval(int tracker_interval) {
893 if (tracker_interval< 0) {
894 tracker_interval_value.setEnabled(false);
896 tracker_interval_value.setEnabled(true);
897 tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval));
901 public int tracker_interval() throws AltosConfigDataException {
902 return parse_int ("tracker interval", tracker_interval_value.getSelectedItem().toString(), false);
905 public void set_aprs_interval(int new_aprs_interval) {
908 if (new_aprs_interval <= 0)
911 s = Integer.toString(new_aprs_interval);
912 aprs_interval_value.setSelectedItem(s);
913 aprs_interval_value.setVisible(new_aprs_interval >= 0);
914 set_aprs_interval_tool_tip();
917 public int aprs_interval() throws AltosConfigDataException {
918 String s = aprs_interval_value.getSelectedItem().toString();
920 if (s.equals("Disabled"))
922 return parse_int("aprs interval", s, false);
925 public void set_aprs_ssid(int new_aprs_ssid) {
926 aprs_ssid_value.setSelectedItem(Math.max(0,new_aprs_ssid));
927 aprs_ssid_value.setVisible(new_aprs_ssid >= 0);
928 set_aprs_ssid_tool_tip();
931 public int aprs_ssid() throws AltosConfigDataException {
932 Integer i = (Integer) aprs_ssid_value.getSelectedItem();
936 public void set_aprs_format(int new_aprs_format) {
937 aprs_format_value.setVisible(new_aprs_format >= 0);
938 aprs_format_label.setVisible(new_aprs_format >= 0);
940 aprs_format_value.setSelectedIndex(Math.max(0,new_aprs_format));
941 set_aprs_format_tool_tip();
944 public int aprs_format() throws AltosConfigDataException {
945 return aprs_format_value.getSelectedIndex();