INCLUDEPATH += $$(QTPATH)/serportM04/src/qserialdevice \ $$(QTPATH)/serportM04/src/qserialdeviceenumeratorQMAKE_LIBDIR += $$(QTPATH)/serportM04/src/build/releaseLIBS += -lqserialdevice
d:/soft/Qt/serportM04/src/build/release/libqserialdevice.a(serialdeviceenumerator_p_win.o):serialdeviceenumerator_p_win.cpp:(.text+0x89a): undefined reference to `_imp__SetupDiGetDeviceRegistryPropertyW@28'd:/soft/Qt/serportM04/src/build/release/libqserialdevice.a(serialdeviceenumerator_p_win.o):serialdeviceenumerator_p_win.cpp:(.text+0xfb3): undefined reference to `_imp__SetupDiGetClassDevsW@16'd:/soft/Qt/serportM04/src/build/release/libqserialdevice.a(serialdeviceenumerator_p_win.o):serialdeviceenumerator_p_win.cpp:(.text+0x100a): undefined reference to `_imp__SetupDiEnumDeviceInfo@12'd:/soft/Qt/serportM04/src/build/release/libqserialdevice.a(serialdeviceenumerator_p_win.o):serialdeviceenumerator_p_win.cpp:(.text+0x1170): undefined reference to `_imp__SetupDiOpenDevRegKey@24'd:/soft/Qt/serportM04/src/build/release/libqserialdevice.a(serialdeviceenumerator_p_win.o):serialdeviceenumerator_p_win.cpp:(.text+0x27de): undefined reference to `_imp__SetupDiDestroyDeviceInfoList@4'collect2: ld returned 1 exit statusmingw32-make[1]: *** [debug/TestProg.exe] Error 1mingw32-make: *** [debug] Error 2
char command[4];AbstractSerial *port;...port->write(command, 4);...
C++ (Qt)void MainWidget::procSerialDataTransfer(const QByteArray &data){ char buf[4]; buf[0] = 'a'; buf[1] = 'b'; buf[2] = 'c'; buf[3] = 'd'; if (this->serial && this->serial->isOpen()) this->serial->write(buf, 4);}
C++ (Qt)void AnyMaster::transaction(){ start(false); char tx_packet[4]; tx_packet[0] = 0x03; tx_packet[1] = 0xFC; tx_packet[2] = 0x41; tx_packet[3] = 0x00; qint64 r = port->write(tx_packet, 4); if (r == 4) { qDebug() << "Writed: " << r << " bytes"; if ((port->bytesAvailable() > 0) || port->waitForReadyRead(responseTimeout)) { char rx_packet[258]; r = port->read(rx_packet, 258); qDebug() << "Readed: " << r << " bytes"; } else { qDebug() << "Response timeout."; } } else qDebug() << "Bytes writed small: " << r; start(true);}
C++ (Qt) char rx_packet[4]; /* 5. Fifth - you can now read / write device, or further modify its settings, etc. */ while (1) { if ((port->bytesAvailable() > 0) || port->waitForReadyRead(rrto)) { qint64 r = port->read(rx_packet, 4); if (4 != r) { qDebug() << "Readed fail: " << r << " bytes"; } else { quint32 val = quint8(rx_packet[3]) | (quint8(rx_packet[2]) << 8) | (quint8(rx_packet[1]) << 16) | (quint8(rx_packet[0]) << 24) ; if (0x03FC4100 != val) { qDebug() << "Readed fail: bad packet : val = " << quint32(val); } //else { qDebug() << "Ok"; } } } else { qDebug() << "Timeout read data in time : " << QTime::currentTime(); } }//while