- }
-
- public void open(File name) throws FileNotFoundException {
- close();
- serial_in = new FileInputStream(name);
- input_thread = new Thread(this);
- input_thread.start();
- }
- public void open(CommPort c) throws IOException {
- close();
- try {
- c.enableReceiveTimeout(1000); /* icky. the read method cannot be interrupted */
- } catch (UnsupportedCommOperationException ee) {
- }
- serial_in = c.getInputStream();
- input_thread = new Thread(this);
- input_thread.start();
- }
- public AltosSerialReader () {
- serial_in = null;
- input_thread = null;
- line = "";
- monitor_queue = new LinkedBlockingQueue<String> ();
- reply_queue = new LinkedBlockingQueue<String> ();
- }
-
-}
-
-public class AltosSerial {
- OutputStream serial_out = null;
- AltosSerialReader reader = null;
-
- public String get_telem() throws InterruptedException {
- return reader.get_telem();
- }
-
- CommPort comm_port = null;
-
- public void close() {
- try {
- serial_out.close();
- } catch (IOException ee) {