ihewitt / poolviewer

Poolviewer - Opensource Swimovate Poolmate application
http://ihewitt.github.io/poolviewer/
GNU General Public License v2.0
6 stars 4 forks source link

qttest.cpp: how has it ever worked? #20

Closed audetto closed 9 years ago

audetto commented 9 years ago

Ok,

I must be doing something silly

I am trying to use qttest.cpp but it hangs in the first read(len+1). the code at line 98 seems to want to skip a 0, which is not there.

I did write a simple python app to test the communication and this is what it prints

OUT 16 [00, 00, 55, 55, 55, 55, 00, 63, 63, 00, 00, 00, 21, 8d, b0, 40] IN 16 [00, 00, 55, 55, 55, 55, 00, 63, 63, 00, 00, 00, 21, 8d, b0, 40] DATA 0 [] <<<<<<<<<<<<<< 0 size. no extra data read here!!!!!!!!

OUT 16 [00, 00, ff, ff, ff, ff, 00, 03, 00, 00, 00, 00, 1a, eb, 92, 1e] IN 16 [00, 00, ff, ff, ff, ff, 00, 03, 00, 00, 00, 00, 1a, eb, 92, 1e] DATA 9 [00, 42, 08, 00, 00, 30, fe, 37, 5b]

so the first time (the 55 55 55 55) of line 135 and 136 it writes 16 bytes and reads back 16, not 16 + 1.

Is it possible that Qt has changed since I tried this months ago? (I did upgrade Fedora, going from qt 4 to qt 5 probably)

Because I did not have this issue Reading

http://doc.qt.io/qt-5/qiodevice.html#read

it should not block. But here it does!

Any idea?

ihewitt commented 9 years ago

qtest updated to skip the zero if there's data. Think I've figured out the bitmask behaviour rationale now too. Might need to make the packet overrun logic a bit smarter, but it seems to work ok for now.