+
+ public void open(File serial_name) throws FileNotFoundException {
+ reader.open(serial_name);
+ serial_out = new FileOutputStream(serial_name);
+ }
+
+ public void open(CommPort comm_port) throws IOException {
+ reader.open(comm_port);
+ serial_out = comm_port.getOutputStream();
+ }
+
+ public void connect(String port_name) throws IOException, NoSuchPortException, PortInUseException {
+ System.out.printf("Opening serial port %s\n", port_name);
+ CommPort comm_port = new RXTXPort(port_name);
+// CommPortIdentifier port_identifier = CommPortIdentifier.getPortIdentifier(port_name);
+// CommPort comm_port = port_identifier.open("Altos", 1000);
+ open(comm_port);
+ }
+
+ void init() {
+ reader = new AltosSerialReader();
+ callbacks = new LinkedList<AltosSerialMonitor>();
+ }
+
+ public AltosSerial() {
+ init();
+ }
+
+ public AltosSerial(File serial_name) throws FileNotFoundException {
+ init();
+ open(serial_name);
+ }
+
+ public AltosSerial(CommPort comm_port) throws IOException {
+ init();
+ open(comm_port);
+ }