G'Day,
I have simple program to write to and read from a serial port. The port is opened as "serialPort->open( QIODevice::ReadWrite);" and I am able to send data. (viewed on another PC and serial breakout box).
My problem is trying to read the serial port for any data that comes in. I am using a timer to regularly check the port but the I get a seg fault when checking the "bytesAvailable" (see code). As soon as the code hits that line it seg faults.
Any thoughts would be greatly appreciated.
Qt Code:
void Mainscreen::checkPort() { qWarning( "checking port..." ); if (serialPort->bytesAvailable() > 0 ); { qWarning( "emitting signal..." ); emit( dataready() ); } qWarning( "checked port..." ); }To copy to clipboard, switch view to plain text mode
Thanks, B1.
Edit:
I ran it through Vlagrind and I get an "Use of uninitialised value of size 4" at the same line.
Bookmarks