X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosConfigData.java;h=45a88783ad3a4a5e33fa023188804a66da6d077f;hb=fcb801b145e1ae6f1c0b3418a99245d34dbf5aa4;hp=4ad4e58a2955972d645e2bc85b7f5df828d2fdc3;hpb=69e6df07976a56b49e07c242cd6e5b2cbd2a578d;p=fw%2Faltos diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index 4ad4e58a..45a88783 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -17,12 +17,9 @@ package org.altusmetrum.AltosLib; -import java.io.*; import java.util.*; import java.text.*; -import java.util.prefs.*; import java.util.concurrent.*; -import org.altusmetrum.AltosLib.*; public class AltosConfigData implements Iterable { @@ -53,6 +50,8 @@ public class AltosConfigData implements Iterable { public int storage_size; public int storage_erase_unit; + public AltosPyro[] pyros; + public static String get_string(String line, String label) throws ParseException { if (line.startsWith(label)) { String quoted = line.substring(label.length()).trim(); @@ -104,7 +103,7 @@ public class AltosConfigData implements Iterable { for (int i = 0; i < parts.length; i++) { try { - r[i] = Altos.fromdec(parts[i]); + r[i] = AltosLib.fromdec(parts[i]); } catch (NumberFormatException n) { r[i] = 0; } @@ -132,11 +131,16 @@ public class AltosConfigData implements Iterable { } public AltosConfigData(AltosLink link) throws InterruptedException, TimeoutException { - link.printf("c s\np\nf\nl\nv\n"); + link.printf("c s\nf\nl\nv\n"); lines = new LinkedList(); radio_setting = 0; radio_frequency = 0; stored_flight = 0; + serial = -1; + pyros = null; + + int npyro = 0; + int pyro = 0; for (;;) { String line = link.get_reply(); if (line == null) @@ -144,6 +148,16 @@ public class AltosConfigData implements Iterable { if (line.contains("Syntax error")) continue; lines.add(line); + if (pyro < npyro - 1) { + if (pyros == null) + pyros = new AltosPyro[npyro]; + try { + pyros[pyro] = new AltosPyro(pyro, line); + } catch (ParseException e) { + } + ++pyro; + continue; + } try { serial = get_int(line, "serial-number"); } catch (Exception e) {} try { log_format = get_int(line, "log-format"); } catch (Exception e) {} try { main_deploy = get_int(line, "Main deploy:"); } catch (Exception e) {} @@ -170,10 +184,12 @@ public class AltosConfigData implements Iterable { try { callsign = get_string(line, "Callsign:"); } catch (Exception e) {} try { version = get_string(line,"software-version"); } catch (Exception e) {} try { product = get_string(line,"product"); } catch (Exception e) {} + try { manufacturer = get_string(line,"manufacturer"); } catch (Exception e) {} try { get_int(line, "flight"); stored_flight++; } catch (Exception e) {} try { storage_size = get_int(line, "Storage size:"); } catch (Exception e) {} try { storage_erase_unit = get_int(line, "Storage erase unit"); } catch (Exception e) {} + try { npyro = get_int(line, "Pyro-count:"); pyro = 0; } catch (Exception e) {} /* signals the end of the version info */ if (line.startsWith("software-version"))