summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--altoslib/AltosEepromDownload.java (renamed from altosui/AltosEepromDownload.java)39
-rw-r--r--altoslib/AltosEepromList.java (renamed from altosui/AltosEepromList.java)21
-rw-r--r--altoslib/Makefile.am4
-rw-r--r--altosui/Makefile.am2
-rw-r--r--altosuilib/Makefile.am2
5 files changed, 33 insertions, 35 deletions
diff --git a/altosui/AltosEepromDownload.java b/altoslib/AltosEepromDownload.java
index 6ce420d3..542defee 100644
--- a/altosui/AltosEepromDownload.java
+++ b/altoslib/AltosEepromDownload.java
@@ -15,17 +15,16 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
import java.text.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_2.*;
public class AltosEepromDownload implements Runnable {
- AltosSerial serial_line;
+ AltosLink link;
boolean remote;
Thread eeprom_thread;
AltosEepromMonitor monitor;
@@ -79,7 +78,7 @@ public class AltosEepromDownload implements Runnable {
boolean start;
void LogEeprom(AltosEeprom r) throws IOException {
- if (r.cmd != Altos.AO_LOG_INVALID) {
+ if (r.cmd != AltosLib.AO_LOG_INVALID) {
String line = r.string();
if (eeprom_file != null)
eeprom_file.write(line);
@@ -114,7 +113,7 @@ public class AltosEepromDownload implements Runnable {
if (state.state != AltosLib.ao_flight_invalid &&
state.state <= AltosLib.ao_flight_landed)
{
- if (state.state > Altos.ao_flight_pad)
+ if (state.state > AltosLib.ao_flight_pad)
want_file = true;
if (state.state == AltosLib.ao_flight_landed)
done = true;
@@ -161,19 +160,19 @@ public class AltosEepromDownload implements Runnable {
block - state_block,
block - log.start_block);
- AltosEepromChunk eechunk = new AltosEepromChunk(serial_line, block, block == log.start_block);
+ AltosEepromChunk eechunk = new AltosEepromChunk(link, block, block == log.start_block);
/*
* Guess what kind of data is there if the device
* didn't tell us
*/
- if (log_format == Altos.AO_LOG_FORMAT_UNKNOWN) {
+ if (log_format == AltosLib.AO_LOG_FORMAT_UNKNOWN) {
if (block == log.start_block) {
- if (eechunk.data(0) == Altos.AO_LOG_FLIGHT)
- log_format = Altos.AO_LOG_FORMAT_FULL;
+ if (eechunk.data(0) == AltosLib.AO_LOG_FLIGHT)
+ log_format = AltosLib.AO_LOG_FORMAT_FULL;
else
- log_format = Altos.AO_LOG_FORMAT_TINY;
+ log_format = AltosLib.AO_LOG_FORMAT_TINY;
}
}
@@ -190,7 +189,7 @@ public class AltosEepromDownload implements Runnable {
try {
boolean failed = false;
if (remote)
- serial_line.start_remote();
+ link.start_remote();
for (AltosEepromLog log : flights) {
parse_exception = null;
@@ -207,33 +206,33 @@ public class AltosEepromDownload implements Runnable {
monitor.show_message(String.format("Flight %d download error\n%s\nValid log data saved",
log.flight,
parse_exception.getMessage()),
- serial_line.device.toShortString(),
+ link.name,
AltosEepromMonitor.WARNING_MESSAGE);
}
}
success = !failed;
} catch (IOException ee) {
monitor.show_message(ee.getLocalizedMessage(),
- serial_line.device.toShortString(),
+ link.name,
AltosEepromMonitor.ERROR_MESSAGE);
} catch (InterruptedException ie) {
monitor.show_message(String.format("Connection to \"%s\" interrupted",
- serial_line.device.toShortString()),
+ link.name),
"Connection Interrupted",
AltosEepromMonitor.ERROR_MESSAGE);
} catch (TimeoutException te) {
monitor.show_message(String.format("Connection to \"%s\" failed",
- serial_line.device.toShortString()),
+ link.name),
"Connection Failed",
AltosEepromMonitor.ERROR_MESSAGE);
} finally {
if (remote) {
try {
- serial_line.stop_remote();
+ link.stop_remote();
} catch (InterruptedException ie) {
}
}
- serial_line.flush_output();
+ link.flush_output();
}
monitor.done(success);
}
@@ -244,17 +243,17 @@ public class AltosEepromDownload implements Runnable {
}
public AltosEepromDownload(AltosEepromMonitor given_monitor,
- AltosSerial given_serial_line,
+ AltosLink given_link,
boolean given_remote,
AltosEepromList given_flights) {
monitor = given_monitor;
- serial_line = given_serial_line;
+ link = given_link;
remote = given_remote;
flights = given_flights;
success = false;
- monitor.set_states(Altos.ao_flight_boost, Altos.ao_flight_landed);
+ monitor.set_states(AltosLib.ao_flight_boost, AltosLib.ao_flight_landed);
monitor.set_thread(eeprom_thread);
monitor.start();
diff --git a/altosui/AltosEepromList.java b/altoslib/AltosEepromList.java
index 258c421a..763bd1e2 100644
--- a/altosui/AltosEepromList.java
+++ b/altoslib/AltosEepromList.java
@@ -15,13 +15,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.altoslib_2;
import java.io.*;
import java.util.*;
import java.text.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_2.*;
/*
* Temporary structure to hold the list of stored flights;
@@ -46,15 +45,15 @@ class AltosEepromFlight {
*/
public class AltosEepromList extends ArrayList<AltosEepromLog> {
- AltosConfigData config_data;
+ public AltosConfigData config_data;
- public AltosEepromList (AltosSerial serial_line, boolean remote)
+ public AltosEepromList (AltosLink link, boolean remote)
throws IOException, InterruptedException, TimeoutException
{
try {
if (remote)
- serial_line.start_remote();
- config_data = new AltosConfigData (serial_line);
+ link.start_remote();
+ config_data = new AltosConfigData (link);
// if (config_data.serial == 0)
// throw new IOException("no serial number found");
@@ -66,9 +65,9 @@ public class AltosEepromList extends ArrayList<AltosEepromLog> {
* command which will list the region of storage
* occupied by each available flight
*/
- serial_line.printf("l\n");
+ link.printf("l\n");
for (;;) {
- String line = serial_line.get_reply(5000);
+ String line = link.get_reply(5000);
if (line == null)
throw new TimeoutException();
if (line.contains("done"))
@@ -106,13 +105,13 @@ public class AltosEepromList extends ArrayList<AltosEepromLog> {
* firmware, this will also extract the flight number.
*/
for (AltosEepromFlight flight : flights) {
- add(new AltosEepromLog(config_data, serial_line,
+ add(new AltosEepromLog(config_data, link,
flight.flight, flight.start, flight.end));
}
} finally {
if (remote)
- serial_line.stop_remote();
- serial_line.flush_output();
+ link.stop_remote();
+ link.flush_output();
}
}
} \ No newline at end of file
diff --git a/altoslib/Makefile.am b/altoslib/Makefile.am
index 2cf7b63d..6d3f3fc4 100644
--- a/altoslib/Makefile.am
+++ b/altoslib/Makefile.am
@@ -1,4 +1,4 @@
-AM_JAVACFLAGS=-encoding UTF-8 -Xlint:deprecation
+AM_JAVACFLAGS=-encoding UTF-8 -Xlint:deprecation -source 6
JAVAROOT=bin
@@ -34,11 +34,13 @@ altoslib_JAVA = \
AltosDebug.java \
AltosEeprom.java \
AltosEepromChunk.java \
+ AltosEepromDownload.java \
AltosEepromFile.java \
AltosEepromTM.java \
AltosEepromTm.java \
AltosEepromHeader.java \
AltosEepromIterable.java \
+ AltosEepromList.java \
AltosEepromLog.java \
AltosEepromMega.java \
AltosEepromMetrum2.java \
diff --git a/altosui/Makefile.am b/altosui/Makefile.am
index b51f8112..e103d289 100644
--- a/altosui/Makefile.am
+++ b/altosui/Makefile.am
@@ -34,8 +34,6 @@ altosui_JAVA = \
AltosDeviceUIDialog.java \
AltosDisplayThread.java \
AltosEepromDelete.java \
- AltosEepromDownload.java \
- AltosEepromList.java \
AltosEepromManage.java \
AltosEepromMonitorUI.java \
AltosEepromSelect.java \
diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am
index 0cd2aaea..5e19e00f 100644
--- a/altosuilib/Makefile.am
+++ b/altosuilib/Makefile.am
@@ -1,4 +1,4 @@
-AM_JAVACFLAGS=-encoding UTF-8 -Xlint:deprecation
+AM_JAVACFLAGS=-encoding UTF-8 -Xlint:deprecation -source 6
JAVAROOT=bin