Priority: Not Evaluated
Affects Version/s: 1.2.0
Fix Version/s: None
Environment:Ubuntu 12.04 x86
P.s.: I'm using Qt Mobility to Desktop. I compile it form this source code http://get.qt.nokia.com/qt/add-ons/qt-mobility-opensource-src-1.2.0.tar.gz (without problem).
I'm using a SerialPort (http://qt-project.org/wiki/QtSerialPort) as QIODevice for QNmeaPositionInfoSource, and the positionUpdated(const QGeoPositionInfo) signal is NOT being emited when it should.
The SerialPort class is emiting QIODevice::readyRead() signal as expected (http://doc.qt.nokia.com/qtmobility/qnmeapositioninfosource.html#setDevice), and the data (NMEA string from a GPS) is comming as it should. I test it both things.
- My Solution:
I went into to the QNmeaPositionInfoSource source code and I think I find out why this is happening.
At this fucniton "void QNmeaRealTimeReader::readAvailableData()" (qnmeapositioninfosource.cpp:57) it is made this test:
qint64 size = m_proxy->m_device->readLine(buf, sizeof(buf));
while (size > 0)
As expected from the documentation the readLine(...) function reads ALL buffer data even if there is no "\n" in it. I quote the documentation:
"Data is read until either of the following conditions are met: ... * The end of the device data is detected." (http://doc.qt.nokia.com/4.7-snapshot/qiodevice.html#readLine)
It reads all device buffer data without being a actual LINE on it. In other words, it gets the data even if in this particulary case when canReadLine() would returns FALSE (because that is no actual LINE in buffer).
Then, after reading this "incomplete line", it trys unsuccessfully to parse the data anyway and dump the readed content.
I made this change (below) and it works: