Hi, All and @Erel especially,
Question about the catching error from stream (here https://www.b4x.com/android/forum/threads/asyncstream-com-port-buffer.143231/), log is so:
Error does not stop the process, but it occured (when device is unplugged) ! I guess, in another thread.
AStream_Error occured only after whole buffer is empty.
And to work correctly - i need to catch it and stop the stream. But how to do it ?
Question about the catching error from stream (here https://www.b4x.com/android/forum/threads/asyncstream-com-port-buffer.143231/), log is so:
23
Result:COM3: 11 226.47 235.77 203.85 235.75 202.79 230.94 244.50 204.64 243.45 222.89
Result:COM3: 11 106.17 111.57 113.02 117.86 109.46 120.81 113.15 109.89 124.25 105.63
23
java.lang.NegativeArraySizeException: -1
at jssc.SerialNativeInterface.readBytes(Native Method)
at jssc.SerialPort.readBytes(SerialPort.java:510)
at anywheresoftware.b4j.serial.Serial$1.read(Serial.java:165)
at anywheresoftware.b4j.serial.Serial$1.read(Serial.java:157)
at anywheresoftware.b4a.randomaccessfile.AsyncStreams$AIN.run(AsyncStreams.java:232)
at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.RuntimeException: java.lang.NegativeArraySizeException: -1
at anywheresoftware.b4j.serial.Serial$1.read(Serial.java:172)
at anywheresoftware.b4j.serial.Serial$1.read(Serial.java:157)
at anywheresoftware.b4a.randomaccessfile.AsyncStreams$AIN.run(AsyncStreams.java:232)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NegativeArraySizeException: -1
at jssc.SerialNativeInterface.readBytes(Native Method)
at jssc.SerialPort.readBytes(SerialPort.java:510)
at anywheresoftware.b4j.serial.Serial$1.read(Serial.java:165)
... 3 more
Result:COM3: 11 209.65 247.73 214.29 210.02 237.06 211.67 207.77 209.42 235.60 232.64
45
Result:COM3: 11 52.66 61.35 55.88 60.34 53.40 53.40 52.26 59.46 57.78 55.31
Result:COM3: 11 212.12 231.24 218.44 206.78 218.92 211.70 240.13 205.57 214.68 239.04
61
Result:COM3: 11 75.58 73.87 74.71 71.43 68.17 81.88 76.05 75.80 72.12 71.42
Error does not stop the process, but it occured (when device is unplugged) ! I guess, in another thread.
AStream_Error occured only after whole buffer is empty.
And to work correctly - i need to catch it and stop the stream. But how to do it ?