How can I read a specific point using QSerialPort?
-
Hello!
I send serial data to pc by DSP
Serial data's form like "!%d%d,%03d,%03d\n?"
Starts with "!"
Ends with "?"When I read serial data to readAll() Function, data comes like this.
"\u00150,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,e47\n?!00,000,347\n?!00,000,347\n"
"?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,3"
"47\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,00"
"0,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00"
",000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?"
"!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,347\n?!00,000,34"I want to read just between '!' to '?'
In this case, what function makes me read some specific points only?Always, thanks for your help :)
-
@Dragocitch said in How can I read a specific point using QSerialPort?:
what function makes me read some specific points only?
Such a function does not exist, so you must write it yourself.
Are you familiar with regular expressions (regex)? If not, there are many tutorials online.
Use QRegularExpression to extract data from your DSP's text stream: https://doc.qt.io/qt-5/qregularexpression.html
-
Thanks.
I'll check that :)