-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New feature of closing the Monitor thread when the hardware disconnects
This is to address #75 It is a very old bug, predates my interaction with this codebase.
- Loading branch information
1 parent
5a58c6b
commit 60aaeea
Showing
18 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
.settings/ | ||
*~* | ||
/.gradle/ | ||
/hs_err_pid26993.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/build | ||
.project | ||
.cproject | ||
/Default/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+4 Bytes
(100%)
src/main/c/resources/native/linux/ARM_32/libNRJavaSerialv5.so
Binary file not shown.
Binary file modified
BIN
+4 Bytes
(100%)
src/main/c/resources/native/linux/ARM_32/libNRJavaSerialv6.so
Binary file not shown.
Binary file modified
BIN
+4 Bytes
(100%)
src/main/c/resources/native/linux/ARM_32/libNRJavaSerialv6_HF.so
Binary file not shown.
Binary file modified
BIN
+4 Bytes
(100%)
src/main/c/resources/native/linux/ARM_32/libNRJavaSerialv7.so
Binary file not shown.
Binary file modified
BIN
+4 Bytes
(100%)
src/main/c/resources/native/linux/ARM_32/libNRJavaSerialv7_HF.so
Binary file not shown.
Binary file modified
BIN
+4 Bytes
(100%)
src/main/c/resources/native/linux/ARM_32/libNRJavaSerialv8.so
Binary file not shown.
Binary file modified
BIN
+4 Bytes
(100%)
src/main/c/resources/native/linux/ARM_32/libNRJavaSerialv8_HF.so
Binary file not shown.
Binary file modified
BIN
+8 Bytes
(100%)
src/main/c/resources/native/linux/ARM_64/libNRJavaSerialv8.so
Binary file not shown.
Binary file modified
BIN
+4 Bytes
(100%)
src/main/c/resources/native/linux/x86_32/libNRJavaSerial.so
Binary file not shown.
Binary file modified
BIN
+8 Bytes
(100%)
src/main/c/resources/native/linux/x86_64/libNRJavaSerial.so
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
src/main/c/resources/native/windows/x86_32/libNRJavaSerial.dll
Binary file not shown.
Binary file modified
BIN
+512 Bytes
(100%)
src/main/c/resources/native/windows/x86_64/libNRJavaSerial.dll
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package test; | ||
import java.io.DataInputStream; | ||
import java.io.DataOutputStream; | ||
import java.io.IOException; | ||
import java.util.TooManyListenersException; | ||
|
||
import gnu.io.NRSerialPort; | ||
import gnu.io.Zystem; | ||
public class ReadTest { | ||
public static void main(String [] args) { | ||
|
||
String port = ""; | ||
for(String s:NRSerialPort.getAvailableSerialPorts()){ | ||
System.out.println("Availible port: "+s); | ||
port=s; | ||
} | ||
|
||
int baudRate = 115200; | ||
NRSerialPort serial = new NRSerialPort(port, baudRate); | ||
serial.connect(); | ||
DataInputStream ins = new DataInputStream(serial.getInputStream()); | ||
try { | ||
serial.addEventListener(ev->{ | ||
//while(ins.available()==0 && !Thread.interrupted());// wait for a byte | ||
try { | ||
while(ins.available()>0) {// read all bytes | ||
|
||
char b = (char) ins.read(); | ||
//outs.write((byte)b); | ||
System.out.print(b); | ||
|
||
} | ||
} catch (IOException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
}); | ||
} catch (TooManyListenersException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
// | ||
// DataOutputStream outs = new DataOutputStream(serial.getOutputStream()); | ||
// try{ | ||
// //while(ins.available()==0 && !Thread.interrupted());// wait for a byte | ||
// while(!Thread.interrupted()) {// read all bytes | ||
// if(ins.available()>0) { | ||
// char b = (char) ins.read(); | ||
// //outs.write((byte)b); | ||
// System.out.print(b); | ||
// } | ||
// Thread.sleep(5); | ||
// } | ||
// }catch(Exception ex){ | ||
// ex.printStackTrace(); | ||
// } | ||
// serial.disconnect(); | ||
} | ||
} |