diff options
author | Keith Packard <keithp@keithp.com> | 2014-05-28 22:45:23 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-05-28 22:45:23 -0700 |
commit | 8ba523cd793f2263bb1acd7a5a10f8964075bdc5 (patch) | |
tree | d15b86ae9593ffff2bcc52b58b7b1dee54d1f3e8 | |
parent | c30130d0bdc18ee351eb3d02e51f70f8a05905b1 (diff) |
telegps: Auto-connect to any base stations plugged in at startup
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | telegps/TeleGPS.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java index 1bb505e0..de2b4aa3 100644 --- a/telegps/TeleGPS.java +++ b/telegps/TeleGPS.java @@ -433,6 +433,11 @@ public class TeleGPS extends AltosUIFrame implements AltosFlightDisplay, AltosFo set_reader(reader); } + public TeleGPS(AltosDevice device) { + this(); + connect(device); + } + static AltosStateIterable record_iterable(File file) { FileInputStream in; try { @@ -562,7 +567,15 @@ public class TeleGPS extends AltosUIFrame implements AltosFlightDisplay, AltosFo } if (errors != 0) System.exit(errors); - if (!any_created) - new TeleGPS(); + if (!any_created) { + java.util.List<AltosDevice> devices = AltosUSBDevice.list(AltosLib.product_basestation); + if (devices != null) + for (AltosDevice device : devices) { + new TeleGPS(device); + any_created = true; + } + if (!any_created) + new TeleGPS(); + } } } |