Just cleaning up the source code.
Signed-off-by: Keith Packard <keithp@keithp.com>
58 files changed:
void CaptureLog(AltosEepromLog log) throws IOException, InterruptedException, TimeoutException, ParseException {
int block, state_block = 0;
int log_format = flights.config_data.log_format;
void CaptureLog(AltosEepromLog log) throws IOException, InterruptedException, TimeoutException, ParseException {
int block, state_block = 0;
int log_format = flights.config_data.log_format;
public AltosEepromHeader (String[] tokens) {
last = false;
valid = true;
public AltosEepromHeader (String[] tokens) {
last = false;
valid = true;
for (AltosEepromHeader header : headers) {
header.write(out);
}
for (AltosEepromHeader header : headers) {
header.write(out);
}
}
public AltosEepromHeader (String line) {
}
public AltosEepromHeader (String line) {
public int year() { return data8(14); }
public int month() { return data8(15); }
public int day() { return data8(16); }
public int year() { return data8(14); }
public int month() { return data8(15); }
public int day() { return data8(16); }
/* AO_LOG_GPS_SAT elements */
public int nsat() { return data16(0); }
public int svid(int n) { return data8(2 + n * 2); }
/* AO_LOG_GPS_SAT elements */
public int nsat() { return data16(0); }
public int svid(int n) { return data8(2 + n * 2); }
public int year() { return data8(4); }
public int month() { return data8(5); }
public int day() { return data8(6); }
public int year() { return data8(4); }
public int month() { return data8(5); }
public int day() { return data8(6); }
/* AO_LOG_GPS_SAT elements */
public int nsat() { return data8(0); }
public int more() { return data8(1); }
/* AO_LOG_GPS_SAT elements */
public int nsat() { return data8(0); }
public int more() { return data8(1); }
break;
try {
AltosEepromMetrum2 metrum = new AltosEepromMetrum2(line);
break;
try {
AltosEepromMetrum2 metrum = new AltosEepromMetrum2(line);
if (metrum.cmd != AltosLib.AO_LOG_INVALID)
metrums.add(metrum);
} catch (Exception e) {
if (metrum.cmd != AltosLib.AO_LOG_INVALID)
metrums.add(metrum);
} catch (Exception e) {
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_3;
+package org.altusmetrum.altoslib_3;
import java.io.File;
import java.util.*;
import java.io.File;
import java.util.*;
state.set_received_time(System.currentTimeMillis());
} catch (TimeoutException te) {
}
state.set_received_time(System.currentTimeMillis());
} catch (TimeoutException te) {
}
}
public AltosIdleFetch(AltosLink link) {
}
public AltosIdleFetch(AltosLink link) {
throw new IllegalArgumentException(String.format("Invalid telemetry %d",
telemetry));
}
throw new IllegalArgumentException(String.format("Invalid telemetry %d",
telemetry));
}
private static String[] state_to_string = {
"startup",
"idle",
private static String[] state_to_string = {
"startup",
"idle",
return get_reply(5000);
}
return get_reply(5000);
}
public abstract boolean can_cancel_reply();
public abstract boolean show_reply_timeout();
public abstract void hide_reply_timeout();
public abstract boolean can_cancel_reply();
public abstract boolean show_reply_timeout();
public abstract void hide_reply_timeout();
} finally {
--in_reply;
}
} finally {
--in_reply;
}
-
\ No newline at end of file
//int P;
dT = raw_temp - ((int) tref << 8);
//int P;
dT = raw_temp - ((int) tref << 8);
TEMP = (int) (2000 + (((long) dT * (long) tempsens) >> 23));
if (ms5611) {
TEMP = (int) (2000 + (((long) dT * (long) tempsens) >> 23));
if (ms5611) {
OFF = ((long) off << 17) + (((long) tco * (long) dT) >> 6);
SENS = ((long) sens << 16) + (((long) tcs * (long) dT) >> 7);
OFF = ((long) off << 17) + (((long) tco * (long) dT) >> 6);
SENS = ((long) sens << 16) + (((long) tcs * (long) dT) >> 7);
if (TEMP < 2000) {
int T2 = (int) (((long) dT * (long) dT) >> 31);
if (TEMP < 2000) {
int T2 = (int) (((long) dT * (long) dT) >> 31);
/* Launcher channel preference name */
public final static String launcherChannelPreference = "LAUNCHER-CHANNEL";
/* Launcher channel preference name */
public final static String launcherChannelPreference = "LAUNCHER-CHANNEL";
/* Default logdir is ~/TeleMetrum */
public final static String logdirName = "TeleMetrum";
/* Default logdir is ~/TeleMetrum */
public final static String logdirName = "TeleMetrum";
return launcher_channel;
}
}
return launcher_channel;
}
}
public static AltosPreferencesBackend bt_devices() {
synchronized (backend) {
return backend.node("bt_devices");
public static AltosPreferencesBackend bt_devices() {
synchronized (backend) {
return backend.node("bt_devices");
private static HashMap<Integer,AltosUnits> pyro_to_units = new HashMap<Integer,AltosUnits>();
private static HashMap<Integer,Double> pyro_to_scale = new HashMap<Integer,Double>();
private static HashMap<Integer,AltosUnits> pyro_to_units = new HashMap<Integer,AltosUnits>();
private static HashMap<Integer,Double> pyro_to_scale = new HashMap<Integer,Double>();
private static void insert_map(int flag, String string, String name, AltosUnits units, double scale) {
string_to_pyro.put(string, flag);
pyro_to_string.put(flag, string);
private static void insert_map(int flag, String string, String name, AltosUnits units, double scale) {
string_to_pyro.put(string, flag);
pyro_to_string.put(flag, string);
pyro_to_units.put(flag, units);
pyro_to_scale.put(flag, scale);
}
pyro_to_units.put(flag, units);
pyro_to_scale.put(flag, scale);
}
public static int string_to_pyro(String name) {
if (string_to_pyro.containsKey(name))
return string_to_pyro.get(name);
public static int string_to_pyro(String name) {
if (string_to_pyro.containsKey(name))
return string_to_pyro.get(name);
insert_map(pyro_after_motor, pyro_after_motor_string, pyro_after_motor_name, null, 1.0);
insert_map(pyro_delay, pyro_delay_string, pyro_delay_name, null, pyro_delay_scale);
insert_map(pyro_after_motor, pyro_after_motor_string, pyro_after_motor_name, null, 1.0);
insert_map(pyro_delay, pyro_delay_string, pyro_delay_name, null, pyro_delay_scale);
insert_map(pyro_state_less, pyro_state_less_string, pyro_state_less_name, null, 1.0);
insert_map(pyro_state_greater_or_equal, pyro_state_greater_or_equal_string, pyro_state_greater_or_equal_name, null, 1.0);
}
insert_map(pyro_state_less, pyro_state_less_string, pyro_state_less_name, null, 1.0);
insert_map(pyro_state_greater_or_equal, pyro_state_greater_or_equal_string, pyro_state_greater_or_equal_name, null, 1.0);
}
ao_romconfig_check,
ao_serial_number
};
ao_romconfig_check,
ao_serial_number
};
private static boolean name_required(String name) {
for (String required : required_names)
if (name.equals(required))
private static boolean name_required(String name) {
for (String required : required_names)
if (name.equals(required))
for (int offset = 0; offset < len; offset += 0x100) {
link.printf("R %x\n", addr + offset);
byte[] reply = link.get_binary_reply(5000, 0x100);
for (int offset = 0; offset < len; offset += 0x100) {
link.printf("R %x\n", addr + offset);
byte[] reply = link.get_binary_reply(5000, 0x100);
if (reply == null)
throw new IOException("Read device memory timeout");
for (b = 0; b < len; b++)
if (reply == null)
throw new IOException("Read device memory timeout");
for (b = 0; b < len; b++)
void write_memory(long addr, byte[] data, int start, int len) {
int b;
link.printf("W %x\n", addr);
void write_memory(long addr, byte[] data, int start, int len) {
int b;
link.printf("W %x\n", addr);
state.set_battery_voltage(AltosConvert.cc_battery_to_voltage(sensor_tm.batt));
state.set_apogee_voltage(AltosConvert.cc_ignitor_to_voltage(sensor_tm.drogue));
state.set_main_voltage(AltosConvert.cc_ignitor_to_voltage(sensor_tm.main));
state.set_battery_voltage(AltosConvert.cc_battery_to_voltage(sensor_tm.batt));
state.set_apogee_voltage(AltosConvert.cc_ignitor_to_voltage(sensor_tm.drogue));
state.set_main_voltage(AltosConvert.cc_ignitor_to_voltage(sensor_tm.main));
} catch (TimeoutException te) {
}
}
} catch (TimeoutException te) {
}
}
state.set_battery_voltage(AltosConvert.tele_mini_voltage(sensor_tmini.batt));
state.set_apogee_voltage(AltosConvert.tele_mini_voltage(sensor_tmini.apogee));
state.set_main_voltage(AltosConvert.tele_mini_voltage(sensor_tmini.main));
state.set_battery_voltage(AltosConvert.tele_mini_voltage(sensor_tmini.batt));
state.set_apogee_voltage(AltosConvert.tele_mini_voltage(sensor_tmini.apogee));
state.set_main_voltage(AltosConvert.tele_mini_voltage(sensor_tmini.main));
} catch (TimeoutException te) {
}
}
} catch (TimeoutException te) {
}
}
public void write_comments (PrintStream out) {
}
public void write_comments (PrintStream out) {
}
public abstract void write(PrintStream out);
}
public abstract void write(PrintStream out);
}
final static int packet_type_metrum_sensor = 0x0a;
final static int packet_type_metrum_data = 0x0b;
final static int packet_type_mini = 0x10;
final static int packet_type_metrum_sensor = 0x0a;
final static int packet_type_metrum_data = 0x0b;
final static int packet_type_mini = 0x10;
static AltosTelemetry parse_hex(String hex) throws ParseException, AltosCRCException {
AltosTelemetry telem = null;
static AltosTelemetry parse_hex(String hex) throws ParseException, AltosCRCException {
AltosTelemetry telem = null;
}
public void write(PrintStream out) {
}
public void write(PrintStream out) {
}
public AltosTelemetryFile(FileInputStream input) {
}
public AltosTelemetryFile(FileInputStream input) {
batt = int16(29);
apogee = int16(31);
main = int16(33);
batt = int16(29);
apogee = int16(31);
main = int16(33);
ground_accel = int16(7);
ground_pres = int16(15);
accel_plus_g = int16(17);
ground_accel = int16(7);
ground_pres = int16(15);
accel_plus_g = int16(17);
public class AltosTelemetryMegaData extends AltosTelemetryStandard {
int state;
public class AltosTelemetryMegaData extends AltosTelemetryStandard {
int state;
int v_batt;
int v_pyro;
int sense[];
int v_batt;
int v_pyro;
int sense[];
v_batt = int16(6);
v_pyro = int16(8);
v_batt = int16(6);
v_pyro = int16(8);
for (int i = 0; i < 6; i++) {
sense[i] = int8(10 + i) << 4;
for (int i = 0; i < 6; i++) {
sense[i] = int8(10 + i) << 4;
super.update_state(state);
state.set_state(this.state);
super.update_state(state);
state.set_state(this.state);
state.set_battery_voltage(AltosConvert.mega_battery_voltage(v_batt));
state.set_pyro_voltage(AltosConvert.mega_pyro_voltage(v_pyro));
state.set_battery_voltage(AltosConvert.mega_battery_voltage(v_batt));
state.set_pyro_voltage(AltosConvert.mega_pyro_voltage(v_pyro));
state.set_orient(orient);
AltosIMU imu = new AltosIMU();
state.set_orient(orient);
AltosIMU imu = new AltosIMU();
imu.accel_x = AltosIMU.convert_accel(accel_x);
imu.accel_y = AltosIMU.convert_accel(accel_y);
imu.accel_z = AltosIMU.convert_accel(accel_z);
imu.accel_x = AltosIMU.convert_accel(accel_x);
imu.accel_y = AltosIMU.convert_accel(accel_y);
imu.accel_z = AltosIMU.convert_accel(accel_z);
super.update_state(state);
AltosGPS gps = state.make_temp_gps(true);
super.update_state(state);
AltosGPS gps = state.make_temp_gps(true);
gps.cc_gps_sat = sats;
state.set_temp_gps();
}
gps.cc_gps_sat = sats;
state.set_temp_gps();
}
public double value(double v) {
return value(v, AltosConvert.imperial_units);
}
public double value(double v) {
return value(v, AltosConvert.imperial_units);
}
public double inverse(double v) {
return inverse(v, AltosConvert.imperial_units);
}
public double inverse(double v) {
return inverse(v, AltosConvert.imperial_units);
}
public String show_units() {
return show_units(AltosConvert.imperial_units);
}
public String show_units() {
return show_units(AltosConvert.imperial_units);
}
public String say_units() {
return say_units(AltosConvert.imperial_units);
}
public String say_units() {
return say_units(AltosConvert.imperial_units);
}
public int show_fraction(int width) {
return show_fraction(width, AltosConvert.imperial_units);
}
public int show_fraction(int width) {
return show_fraction(width, AltosConvert.imperial_units);
}
int say_fraction(boolean imperial_units) {
return 0;
}
int say_fraction(boolean imperial_units) {
return 0;
}
show();
value.setText(s);
}
show();
value.setText(s);
}
void show(AltosUnits units, double v) {
show(units.show(8, v));
}
void show(AltosUnits units, double v) {
show(units.show(8, v));
}
show();
value.setText(s);
}
show();
value.setText(s);
}
void show(AltosUnits units, double v) {
show(units.show(8, v));
}
void show(AltosUnits units, double v) {
show(units.show(8, v));
}
return String.format("%02x\n", companion.board_id);
}
}
return String.format("%02x\n", companion.board_id);
}
}
public void show(AltosState state, AltosListenerState listener_state) {
if (state == null)
return;
public void show(AltosState state, AltosListenerState listener_state) {
if (state == null)
return;
GridBagConstraints c = new GridBagConstraints();
c.insets = new Insets (4,4,4,4);
GridBagConstraints c = new GridBagConstraints();
c.insets = new Insets (4,4,4,4);
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.WEST;
c.gridx = 0;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.WEST;
c.gridx = 0;
c.weightx = 0;
c.weighty = 0;
pane.add(ok_button, c);
c.weightx = 0;
c.weighty = 0;
pane.add(ok_button, c);
cancel_button = new JButton("Cancel");
cancel_button.setActionCommand("cancel");
cancel_button.addActionListener(this);
cancel_button = new JButton("Cancel");
cancel_button.setActionCommand("cancel");
cancel_button.addActionListener(this);
c.weightx = 0;
c.weighty = 0;
pane.add(cancel_button, c);
c.weightx = 0;
c.weighty = 0;
pane.add(cancel_button, c);
if (existing == null)
setTitle("Add New Frequency");
else {
if (existing == null)
setTitle("Add New Frequency");
else {
pack();
setLocationRelativeTo(frame);
pack();
setLocationRelativeTo(frame);
}
public AltosEditFreqUI(Frame in_frame) {
}
public AltosEditFreqUI(Frame in_frame) {
public AltosFrequency[] frequencies() {
return frequencies.frequencies();
}
public AltosFrequency[] frequencies() {
return frequencies.frequencies();
}
public AltosConfigFreqUI(Frame in_frame,
AltosFrequency[] in_frequencies) {
super(in_frame, "Manage Frequencies", true);
public AltosConfigFreqUI(Frame in_frame,
AltosFrequency[] in_frequencies) {
super(in_frame, "Manage Frequencies", true);
public void itemStateChanged(ItemEvent e) {
set_enable(enable.isSelected());
public void itemStateChanged(ItemEvent e) {
set_enable(enable.isSelected());
ui.set_dirty();
}
public void changedUpdate(DocumentEvent e) {
ui.set_dirty();
}
public void changedUpdate(DocumentEvent e) {
ui.set_dirty();
}
public void insertUpdate(DocumentEvent e) {
ui.set_dirty();
}
public void insertUpdate(DocumentEvent e) {
ui.set_dirty();
}
public void removeUpdate(DocumentEvent e) {
ui.set_dirty();
}
public void removeUpdate(DocumentEvent e) {
enable = new JCheckBox();
enable.addItemListener(this);
pane.add(enable, c);
enable = new JCheckBox();
enable.addItemListener(this);
pane.add(enable, c);
if ((flag & AltosPyro.pyro_no_value) == 0) {
c = new GridBagConstraints();
c.gridx = x+1; c.gridy = y;
if ((flag & AltosPyro.pyro_no_value) == 0) {
c = new GridBagConstraints();
c.gridx = x+1; c.gridy = y;
items = new PyroItem[nrow];
int row = 0;
items = new PyroItem[nrow];
int row = 0;
GridBagConstraints c;
c = new GridBagConstraints();
c.gridx = x; c.gridy = y;
GridBagConstraints c;
c = new GridBagConstraints();
c.gridx = x; c.gridy = y;
pane.add(close, c);
close.addActionListener(this);
close.setActionCommand("Close");
pane.add(close, c);
close.addActionListener(this);
close.setActionCommand("Close");
addWindowListener(new ConfigListener(this, owner));
AltosPreferences.register_units_listener(this);
}
addWindowListener(new ConfigListener(this, owner));
AltosPreferences.register_units_listener(this);
}
int i;
for (i = 0; i < radio_frequency_value.getItemCount(); i++) {
AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i);
int i;
for (i = 0; i < radio_frequency_value.getItemCount(); i++) {
AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i);
if (f.close(new_radio_frequency)) {
radio_frequency_value.setSelectedIndex(i);
return;
if (f.close(new_radio_frequency)) {
radio_frequency_value.setSelectedIndex(i);
return;
}
for (i = 0; i < radio_frequency_value.getItemCount(); i++) {
AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i);
}
for (i = 0; i < radio_frequency_value.getItemCount(); i++) {
AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i);
if (new_radio_frequency < f.frequency)
break;
}
if (new_radio_frequency < f.frequency)
break;
}
"Bottom",
"Bottom right",
};
"Bottom",
"Bottom right",
};
public void add_position() {
pane.add(new JLabel ("Menu position"), constraints(0, 1));
public void add_position() {
pane.add(new JLabel ("Menu position"), constraints(0, 1));
position_value = new JComboBox (position_names);
position_value.setMaximumRowCount(position_names.length);
int position = AltosUIPreferences.position();
position_value = new JComboBox (position_names);
position_value.setMaximumRowCount(position_names.length);
int position = AltosUIPreferences.position();
class Apogee extends DescentStatus {
void show (AltosState state, AltosListenerState listener_state) {
class Apogee extends DescentStatus {
void show (AltosState state, AltosListenerState listener_state) {
buttonPane.add(manage_bluetooth_button);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
}
buttonPane.add(manage_bluetooth_button);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
}
public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
if ("manage".equals(e.getActionCommand())) {
public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
if ("manage".equals(e.getActionCommand())) {
report(false);
}
} catch (InterruptedException ie) {
report(false);
}
} catch (InterruptedException ie) {
javax.swing.filechooser.FileFilter ihx_filter = new FileNameExtensionFilter("Flash Image", "ihx");
hexfile_chooser.addChoosableFileFilter(ihx_filter);
hexfile_chooser.setFileFilter(ihx_filter);
javax.swing.filechooser.FileFilter ihx_filter = new FileNameExtensionFilter("Flash Image", "ihx");
hexfile_chooser.addChoosableFileFilter(ihx_filter);
hexfile_chooser.setFileFilter(ihx_filter);
if (!is_pair_programmed() && !device.matchProduct(AltosLib.product_altusmetrum)) {
for (int i = 0; i < filters.length; i++) {
if (device != null && device.matchProduct(filters[i].product))
if (!is_pair_programmed() && !device.matchProduct(AltosLib.product_altusmetrum)) {
for (int i = 0; i < filters.length; i++) {
if (device != null && device.matchProduct(filters[i].product))
if (file == null)
return false;
AltosUIPreferences.set_firmwaredir(file.getParentFile());
if (file == null)
return false;
AltosUIPreferences.set_firmwaredir(file.getParentFile());
pos(stats.lon,"E","W"));
}
}
pos(stats.lon,"E","W"));
}
}
}
\ No newline at end of file
}
\ No newline at end of file
// Telemetry format menu
if (reader.supports_telemetry(Altos.ao_telemetry_standard)) {
telemetries = new JComboBox();
// Telemetry format menu
if (reader.supports_telemetry(Altos.ao_telemetry_standard)) {
telemetries = new JComboBox();
- for (int i = 1; i <= Altos.ao_telemetry_max; i++)
+ for (int i = 1; i <= Altos.ao_telemetry_max; i++)
telemetries.addItem(Altos.telemetry_name(i));
int telemetry = AltosPreferences.telemetry(serial);
if (telemetry <= Altos.ao_telemetry_off ||
telemetries.addItem(Altos.telemetry_name(i));
int telemetry = AltosPreferences.telemetry(serial);
if (telemetry <= Altos.ao_telemetry_off ||
for (i = 0; i < getItemCount(); i++) {
AltosFrequency f = (AltosFrequency) getItemAt(i);
for (i = 0; i < getItemCount(); i++) {
AltosFrequency f = (AltosFrequency) getItemAt(i);
if (f.close(new_frequency)) {
setSelectedIndex(i);
return;
if (f.close(new_frequency)) {
setSelectedIndex(i);
return;
}
for (i = 0; i < getItemCount(); i++) {
AltosFrequency f = (AltosFrequency) getItemAt(i);
}
for (i = 0; i < getItemCount(); i++) {
AltosFrequency f = (AltosFrequency) getItemAt(i);
if (new_frequency < f.frequency)
break;
}
if (new_frequency < f.frequency)
break;
}
public void set_product(String new_product) {
product = new_product;
}
public void set_product(String new_product) {
product = new_product;
}
public void set_serial(int new_serial) {
serial = new_serial;
}
public void set_serial(int new_serial) {
serial = new_serial;
}
break;
case data_gps_height:
y = state.gps_height;
break;
case data_gps_height:
y = state.gps_height;
case data_gps_nsat_solution:
if (state.gps != null)
y = state.gps.nsat;
case data_gps_nsat_solution:
if (state.gps != null)
y = state.gps.nsat;
case data_pressure:
y = state.pressure();
break;
case data_pressure:
y = state.pressure();
break;
case data_accel_x:
case data_accel_y:
case data_accel_z:
case data_accel_x:
case data_accel_y:
case data_accel_z:
import org.jfree.chart.JFreeChart;
import org.jfree.ui.RefineryUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.ui.RefineryUtilities;
-public class AltosGraphUI extends AltosUIFrame
+public class AltosGraphUI extends AltosUIFrame
{
JTabbedPane pane;
AltosGraph graph;
{
JTabbedPane pane;
AltosGraph graph;
pane.add(close, c);
close.addActionListener(this);
close.setActionCommand("close");
pane.add(close, c);
close.addActionListener(this);
close.setActionCommand("close");
pack();
setLocationRelativeTo(owner);
pack();
setLocationRelativeTo(owner);
info_add_deg(1, "Pad longitude", state.pad_lon, 'E', 'W');
info_add_row(1, "Pad GPS alt", "%6.0f m", state.pad_alt);
}
info_add_deg(1, "Pad longitude", state.pad_lon, 'E', 'W');
info_add_row(1, "Pad GPS alt", "%6.0f m", state.pad_alt);
}
- if (state.gps.year != AltosLib.MISSING)
+ if (state.gps.year != AltosLib.MISSING)
info_add_row(1, "GPS date", "%04d-%02d-%02d",
state.gps.year,
state.gps.month,
info_add_row(1, "GPS date", "%04d-%02d-%02d",
state.gps.year,
state.gps.month,
show();
value.setText(s);
}
show();
value.setText(s);
}
void show(AltosUnits units, double v) {
show(units.show(8, v));
}
void show(AltosUnits units, double v) {
show(units.show(8, v));
}
public void set_label(String text) {
label.setText(text);
}
public void set_label(String text) {
label.setText(text);
}
public LaunchStatus (GridBagLayout layout, int y, String text) {
GridBagConstraints c = new GridBagConstraints();
c.weighty = 1;
public LaunchStatus (GridBagLayout layout, int y, String text) {
GridBagConstraints c = new GridBagConstraints();
c.weighty = 1;
public void set_label(String text) {
label.setText(text);
}
public void set_label(String text) {
label.setText(text);
}
void reset() {
value.setText("");
}
void reset() {
value.setText("");
}
pad_lon.set_font();
pad_alt.set_font();
}
pad_lon.set_font();
pad_alt.set_font();
}
public void show(AltosState state, AltosListenerState listener_state) {
battery.show(state, listener_state);
apogee.show(state, listener_state);
public void show(AltosState state, AltosListenerState listener_state) {
battery.show(state, listener_state);
apogee.show(state, listener_state);
int flight;
AltosFrequency frequency;
int telemetry;
int flight;
AltosFrequency frequency;
int telemetry;
boolean interrupted = false;
boolean interrupted = false;
public String toString() {
return String.format("%-9.9s serial %-4d flight %-4d (%s %s)",
callsign, serial, flight, frequency.toShortString(), Altos.telemetry_name(telemetry));
public String toString() {
return String.format("%-9.9s serial %-4d flight %-4d (%s %s)",
callsign, serial, flight, frequency.toShortString(), Altos.telemetry_name(telemetry));
}
class AltosScanResults extends LinkedList<AltosScanResult> implements ListModel {
}
class AltosScanResults extends LinkedList<AltosScanResult> implements ListModel {
LinkedList<ListDataListener> listeners = new LinkedList<ListDataListener>();
void changed(ListDataEvent de) {
LinkedList<ListDataListener> listeners = new LinkedList<ListDataListener>();
void changed(ListDataEvent de) {
public void addListDataListener(ListDataListener l) {
listeners.add(l);
}
public void addListDataListener(ListDataListener l) {
listeners.add(l);
}
public void removeListDataListener(ListDataListener l) {
listeners.remove(l);
}
public void removeListDataListener(ListDataListener l) {
listeners.remove(l);
}
void set_telemetry() {
reader.set_telemetry(telemetry);
}
void set_telemetry() {
reader.set_telemetry(telemetry);
}
void set_frequency() throws InterruptedException, TimeoutException {
reader.set_frequency(frequencies[frequency_index].frequency);
reader.reset();
}
void set_frequency() throws InterruptedException, TimeoutException {
reader.set_frequency(frequencies[frequency_index].frequency);
reader.reset();
}
void next() throws InterruptedException, TimeoutException {
reader.set_monitor(false);
Thread.sleep(100);
void next() throws InterruptedException, TimeoutException {
reader.set_monitor(false);
Thread.sleep(100);
scanning_label = new JLabel("Scanning:");
frequency_label = new JLabel("");
telemetry_label = new JLabel("");
scanning_label = new JLabel("Scanning:");
frequency_label = new JLabel("");
telemetry_label = new JLabel("");
set_label();
c.fill = GridBagConstraints.HORIZONTAL;
set_label();
c.fill = GridBagConstraints.HORIZONTAL;
}
int y_offset = 3 + (Altos.ao_telemetry_max - Altos.ao_telemetry_min + 1);
}
int y_offset = 3 + (Altos.ao_telemetry_max - Altos.ao_telemetry_min + 1);
list = new JList(results) {
//Subclass JList to workaround bug 4832765, which can cause the
//scroll pane to not let the user easily scroll up to the beginning
list = new JList(results) {
//Subclass JList to workaround bug 4832765, which can cause the
//scroll pane to not let the user easily scroll up to the beginning
AltosSiteMapTile tile = mapTiles.get(k);
tile.clearMap();
}
AltosSiteMapTile tile = mapTiles.get(k);
tile.clearMap();
}
centre = getBaseLocation(lat, lng);
scrollRocketToVisible(pt(lat,lng));
}
centre = getBaseLocation(lat, lng);
scrollRocketToVisible(pt(lat,lng));
}
try {
URLConnection uc = url.openConnection();
//int length = uc.getContentLength();
try {
URLConnection uc = url.openConnection();
//int length = uc.getContentLength();
InputStreamReader in_stream = new InputStreamReader(uc.getInputStream(), Altos.unicode_set);
BufferedReader in = new BufferedReader(in_stream);
InputStreamReader in_stream = new InputStreamReader(uc.getInputStream(), Altos.unicode_set);
BufferedReader in = new BufferedReader(in_stream);
AltosSites sites;
JLabel site_list_label;
JComboBox site_list;
AltosSites sites;
JLabel site_list_label;
JComboBox site_list;
JToggleButton load_button;
boolean loading;
JButton close_button;
JToggleButton load_button;
boolean loading;
JButton close_button;
pbar.setValue(0);
pbar.setString("");
pbar.setStringPainted(true);
pbar.setValue(0);
pbar.setString("");
pbar.setStringPainted(true);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.CENTER;
c.insets = i;
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.CENTER;
c.insets = i;
c.gridwidth = 1;
pane.add(site_list_label, c);
c.gridwidth = 1;
pane.add(site_list_label, c);
site_list = new JComboBox(new String[] { "Site List" });
site_list.addItemListener(this);
site_list = new JComboBox(new String[] { "Site List" });
site_list.addItemListener(this);
c.gridwidth = 1;
pane.add(site_list, c);
c.gridwidth = 1;
pane.add(site_list, c);
lat = new AltosMapPos(owner,
"Latitude:",
lat_hemi_names,
lat = new AltosMapPos(owner,
"Latitude:",
lat_hemi_names,
c.anchor = GridBagConstraints.CENTER;
pane.add(lat, c);
c.anchor = GridBagConstraints.CENTER;
pane.add(lat, c);
lon = new AltosMapPos(owner,
"Longitude:",
lon_hemi_names,
lon = new AltosMapPos(owner,
"Longitude:",
lon_hemi_names,
load_button = new JToggleButton("Load Map");
load_button.addActionListener(this);
load_button.setActionCommand("load");
load_button = new JToggleButton("Load Map");
load_button.addActionListener(this);
load_button.setActionCommand("load");
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.CENTER;
c.insets = i;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.CENTER;
c.insets = i;
close_button = new JButton("Close");
close_button.addActionListener(this);
close_button.setActionCommand("close");
close_button = new JButton("Close");
close_button.addActionListener(this);
close_button.setActionCommand("close");
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.CENTER;
c.insets = i;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.CENTER;
c.insets = i;
});
setLocationByPlatform(false);
});
setLocationByPlatform(false);
/* Insets aren't set before the window is visible */
setVisible(true);
}
/* Insets aren't set before the window is visible */
setVisible(true);
}
static boolean process_summary(File file) {
AltosStateIterable states = record_iterable(file);
if (states == null)
static boolean process_summary(File file) {
AltosStateIterable states = record_iterable(file);
if (states == null)
System.out.printf(" --kml\tgenerate KML output for use with Google Earth\n");
System.exit(code);
}
System.out.printf(" --kml\tgenerate KML output for use with Google Earth\n");
System.exit(code);
}
public static void main(final String[] args) {
int errors = 0;
load_library(null);
public static void main(final String[] args) {
int errors = 0;
load_library(null);
public class AltosUIPreferencesBackend implements AltosPreferencesBackend {
private Preferences _preferences = null;
public class AltosUIPreferencesBackend implements AltosPreferencesBackend {
private Preferences _preferences = null;
public AltosUIPreferencesBackend() {
_preferences = Preferences.userRoot().node("/org/altusmetrum/altosui");
}
public AltosUIPreferencesBackend() {
_preferences = Preferences.userRoot().node("/org/altusmetrum/altosui");
}
public Frame frame;
public int product;
public JPanel buttonPane;
public Frame frame;
public int product;
public JPanel buttonPane;
public AltosDevice getValue() {
return value;
}
public AltosDevice getValue() {
return value;
}
public void set_units() {
setLabel(String.format("%s (%s)", label, units.show_units()));
}
public void set_units() {
setLabel(String.format("%s (%s)", label, units.show_units()));
}
public void set_enable(boolean enable) {
if (enable) {
visible++;
public void set_enable(boolean enable) {
if (enable) {
visible++;
this.name = name;
this.grapher = grapher;
enable = new JRadioButton(name, enabled);
this.name = name;
this.grapher = grapher;
enable = new JRadioButton(name, enabled);
- grapher.set_enable(enabled);
+ grapher.set_enable(enabled);
enable.addActionListener(this);
}
}
enable.addActionListener(this);
}
}
};
static public String[] icon_names;
};
static public String[] icon_names;
static public void set_icon_names(String[] new_icon_names) { icon_names = new_icon_names; }
public String[] icon_names() {
static public void set_icon_names(String[] new_icon_names) { icon_names = new_icon_names; }
public String[] icon_names() {
public void set_icon() {
ArrayList<Image> icons = new ArrayList<Image>();
String[] icon_names = icon_names();
public void set_icon() {
ArrayList<Image> icons = new ArrayList<Image>();
String[] icon_names = icon_names();
for (int i = 0; i < icon_names.length; i++) {
java.net.URL imgURL = AltosUIFrame.class.getResource(icon_names[i]);
if (imgURL != null)
for (int i = 0; i < icon_names.length; i++) {
java.net.URL imgURL = AltosUIFrame.class.getResource(icon_names[i]);
if (imgURL != null)
}
setIconImages(icons);
}
}
setIconImages(icons);
}
private boolean location_by_platform = true;
public void setLocationByPlatform(boolean lbp) {
location_by_platform = lbp;
super.setLocationByPlatform(lbp);
}
private boolean location_by_platform = true;
public void setLocationByPlatform(boolean lbp) {
location_by_platform = lbp;
super.setLocationByPlatform(lbp);
}
public void setSize() {
/* Smash sizes around so that the window comes up in the right shape */
Insets i = getInsets();
public void setSize() {
/* Smash sizes around so that the window comes up in the right shape */
Insets i = getInsets();
setPosition(position);
}
}
setPosition(position);
}
}
void init() {
AltosUIPreferences.register_ui_listener(this);
AltosUIPreferences.register_position_listener(this);
void init() {
AltosUIPreferences.register_ui_listener(this);
AltosUIPreferences.register_position_listener(this);
public void addSeries(String label, int fetch, AltosUnits units, Color color) {
addSeries(label, fetch, units, color, true, newAxis(label, units, color));
}
public void addSeries(String label, int fetch, AltosUnits units, Color color) {
addSeries(label, fetch, units, color, true, newAxis(label, units, color));
}
public void addMarker(String label, int fetch, Color color) {
AltosUIMarker marker = new AltosUIMarker(fetch, color, plot);
if (enable != null)
public void addMarker(String label, int fetch, Color color) {
AltosUIMarker marker = new AltosUIMarker(fetch, color, plot);
if (enable != null)
this.axis_index = 0;
xAxis = new NumberAxis("Time (s)");
this.axis_index = 0;
xAxis = new NumberAxis("Time (s)");
xAxis.setAutoRangeIncludesZero(true);
plot = new XYPlot();
xAxis.setAutoRangeIncludesZero(true);
plot = new XYPlot();
interface AltosUIGrapher {
public abstract void set_units();
interface AltosUIGrapher {
public abstract void set_units();
public abstract void clear();
public abstract void add(AltosUIDataPoint dataPoint);
public abstract void clear();
public abstract void add(AltosUIDataPoint dataPoint);
boolean enabled;
int fetch;
Color color;
boolean enabled;
int fetch;
Color color;
private void remove_markers() {
for (ValueMarker marker : markers)
plot.removeDomainMarker(marker);
private void remove_markers() {
for (ValueMarker marker : markers)
plot.removeDomainMarker(marker);
public class AltosUIPreferencesBackend implements AltosPreferencesBackend {
private Preferences _preferences = null;
public class AltosUIPreferencesBackend implements AltosPreferencesBackend {
private Preferences _preferences = null;
public AltosUIPreferencesBackend() {
_preferences = Preferences.userRoot().node("/org/altusmetrum/altosui");
}
public AltosUIPreferencesBackend() {
_preferences = Preferences.userRoot().node("/org/altusmetrum/altosui");
}
public double value(double v, boolean imperial_units) { return v; }
public double inverse(double v, boolean imperial_unis) { return v; }
public double value(double v, boolean imperial_units) { return v; }
public double inverse(double v, boolean imperial_unis) { return v; }
public String show_units(boolean imperial_units) { return "s"; }
public String say_units(boolean imperial_units) { return "seconds"; }
public String show_units(boolean imperial_units) { return "s"; }
public String say_units(boolean imperial_units) { return "seconds"; }
XYItemRenderer renderer;
int fetch;
boolean enable;
XYItemRenderer renderer;
int fetch;
boolean enable;
public void set_units() {
axis.set_units();
StandardXYToolTipGenerator ttg;
public void set_units() {
axis.set_units();
StandardXYToolTipGenerator ttg;
got_string = CFStringGetCString(entry_as_string,
result, result_len,
kCFStringEncodingASCII);
got_string = CFStringGetCString(entry_as_string,
result, result_len,
kCFStringEncodingASCII);
CFRelease(entry_as_string);
if (got_string)
return 1;
CFRelease(entry_as_string);
if (got_string)
return 1;
{
CFTypeRef entry_as_number;
Boolean got_number;
{
CFTypeRef entry_as_number;
Boolean got_number;
entry_as_number = IORegistryEntrySearchCFProperty (object,
kIOServicePlane,
entry,
entry_as_number = IORegistryEntrySearchCFProperty (object,
kIOServicePlane,
entry,
object = IOIteratorNext(list->iterator);
if (!object)
return 0;
object = IOIteratorNext(list->iterator);
if (!object)
return 0;
if (!get_number (object, CFSTR(kUSBVendorID), &device->vendor) ||
!get_number (object, CFSTR(kUSBProductID), &device->product))
continue;
if (!get_number (object, CFSTR(kUSBVendorID), &device->vendor) ||
!get_number (object, CFSTR(kUSBProductID), &device->product))
continue;
if (log) {
SYSTEMTIME time;
GetLocalTime(&time);
if (log) {
SYSTEMTIME time;
GetLocalTime(&time);
- fprintf (log, "%4d-%02d-%02d %2d:%02d:%02d. ",
+ fprintf (log, "%4d-%02d-%02d %2d:%02d:%02d. ",
time.wYear, time.wMonth, time.wDay,
time.wHour, time.wMinute, time.wSecond);
va_start(a, fmt);
time.wYear, time.wMonth, time.wDay,
time.wHour, time.wMinute, time.wSecond);
va_start(a, fmt);
altos_set_last_windows_error();
Sleep(100);
}
altos_set_last_windows_error();
Sleep(100);
}
if (file->handle == INVALID_HANDLE_VALUE) {
free(file);
return NULL;
if (file->handle == INVALID_HANDLE_VALUE) {
free(file);
return NULL;