* threads.
*/
-public class AltosSerial implements Runnable {
+public class AltosSerial implements Runnable, AltosLink {
static java.util.List<String> devices_opened = Collections.synchronizedList(new LinkedList<String>());
AltosLib_JAVA = \
$(SRC)/AltosLib.java \
+ $(SRC)/AltosConfigData.java \
$(SRC)/AltosConvert.java \
$(SRC)/AltosCRCException.java \
$(SRC)/AltosFrequency.java \
$(SRC)/AltosGPS.java \
$(SRC)/AltosGPSSat.java \
$(SRC)/AltosLine.java \
+ $(SRC)/AltosLink.java \
$(SRC)/AltosParse.java \
$(SRC)/AltosPreferences.java \
$(SRC)/AltosRecordCompanion.java \
package altosui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.filechooser.FileNameExtensionFilter;
-import javax.swing.table.*;
import java.io.*;
import java.util.*;
import java.text.*;
import java.util.concurrent.*;
import org.altusmetrum.AltosLib.*;
-import libaltosJNI.*;
-
public class AltosConfigData implements Iterable<String> {
/* Version information */
return 0;
}
- public AltosConfigData(AltosSerial serial_line) throws InterruptedException, TimeoutException {
- serial_line.printf("c s\np\nf\nl\nv\n");
+ public AltosConfigData(AltosLink link) throws InterruptedException, TimeoutException {
+ link.printf("c s\np\nf\nl\nv\n");
lines = new LinkedList<String>();
radio_setting = 0;
radio_frequency = 0;
stored_flight = 0;
for (;;) {
- String line = serial_line.get_reply();
+ String line = link.get_reply();
if (line == null)
throw new TimeoutException();
if (line.contains("Syntax error"))
--- /dev/null
+/*
+ * Copyright © 2011 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.AltosLib;
+
+public interface AltosLink {
+ public void printf(String format, Object ... arguments) throws InterruptedException;
+
+ public String get_reply() throws InterruptedException;
+
+ public String get_reply(int timeout) throws InterruptedException;
+}