Can not get shared library spcommacx64.dylib resource as stream from sp-tty.jar
In the main method, I put this :class DataListener extends Serial implements ISerialComDataListener {static byte[] BufferRead = new byte[1048576];static int Lenarg = 0;int y = 0;@Overridepublic void onNewSerialDataAvailable(byte[] arg0) {System.arraycopy(arg0, 0, BufferRead, Lenarg, arg0.length);Lenarg += arg0.length;y = y + arg0.length;if(y >= 1) {exit.set(true);}}
if(scm.writeString(handle, "$PFMDNL,160703144207,2\n", 0) == true) {System.out.println("$PFMDNL,160703144207,2 envoyé \n");}
// wait till data listener has received all the datawhile(exit.get() == false) {Thread.sleep(600);}exit.set(false);
1. Use wait notify mechanism of java instead of thread.sleep.
2. No need of y. If the required number of bytes have been received notify main thread.
3. Use examples from application folder not from tests folder in repository.
--
You received this message because you are subscribed to the Google Groups "SerialPundit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to SerialPundit...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/SerialPundit/7f156eeb-65c4-4e63-aeb8-6cbf50286a30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
...If the required number of bytes have been received notify main thread...