linux - Posix Serial Connection with Callbacks -


I am trying to communicate with arduino using code,

Which uses the termios to open an arduino and talk to a non-blocking manner that works fine? What was I thinking when I registered a callback function using RST on Java I can say that whenever there is data on the line, do not check me manually Falls. I googled but can not find any information about how to register a callback function?

I am on Linux / OS X and I am trying to avoid starting a new thread to read / read data on line

Pausix does not define a method for assigning the callback function itself when the serial data arrives. The standard way to do this type of processing is to use the select library function if you do not want to use a different thread. This allows you to define a set of file descriptors of the program that are interested in your program and then go to sleep. If something interesting happens with your file descriptor (like new data is available for reading), then your process will automatically wake up. It avoids busy-waiting and many descriptors for the activity.

Another option would be to use Libre like Libevent, which is located above the Pozzix layer and provides callback infrastructure.

Comments