Hi,
I am working on a project another student has written.
I don't like the way he handled reading from the SerialPort:
settings->RS485port.write(dataToSend);
if(settings->RS485port.waitForReadyRead(1)){
for(int charCount = 0; charCount < temp.count(); charCount++){
...... //handling the response
}
byteReceived = true;
}
}
settings->RS485port.write(dataToSend);
if(settings->RS485port.waitForReadyRead(1)){
QByteArray temp = settings->RS485port.readAll();
for(int charCount = 0; charCount < temp.count(); charCount++){
...... //handling the response
}
byteReceived = true;
}
}
To copy to clipboard, switch view to plain text mode
waitForReadyRead let the GUI freeze and that's definitely not what i want to happen. So i read about connecting the readyRead Signal with a Slot.
connect(settings->RS485port, SIGNAL(readyRead()), this, SLOT(handlePortReadyRead()));
connect(settings->RS485port, SIGNAL(readyRead()), this, SLOT(handlePortReadyRead()));
To copy to clipboard, switch view to plain text mode
If I try to compile this, it says:
C:\Users\...\bootloaderdialog.cpp:207: Fehler: no matching function for call to 'BootloaderDialog::connect(QSerialPort&, const char [13], BootloaderDialog* const, const char [23])'
connect(settings->RS485port, SIGNAL(readyRead()), this, SLOT(handlePortReadyRead()));
Do you know why i can't connect the Signal to the Slot. Or do you know any better way to read Data from a Serialport?
Bookmarks