Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

Best approach for serial port

$
0
0
Hi, i’m using qexteserial port to managed a serial port, in this case the library is not the focus. The problem is the approach. At the moment i have a class serialport, where i’ve basic command to write on serial, and i’ve a class Test that have custom function that create message and send to serial port by write() function of serial class. I have a slot connect to readyRead() of the serial class. The problem is send every 100ms a message and get a response, and send other message. What’s can be the best approach? I read more document online, some said use thread, some exclude thread approach. So i want write here a good knowhow of write a particular class to write/read data from serial. The requisite are: Always read() data when they are avaiable If i’m in a write function that split data by packets and send, if bytearrived() i can read that only when return to the main event loop(). Or i have to create a time delay(50) between each packet and use processEvent(); A method to send data without lock I don’t know if i can read/write at the same time, i think i can’t so i have to manage this problem.

Viewing all articles
Browse latest Browse all 18427

Trending Articles