Hello,
I use QSerialPort and I don't manage to display the information "QIODevice::write (QSerialPort): device not open" when I try to send some data if the serial port is not yet open. I can see the message in the output application of Qt Creator, but the SIGNAL(errorOccurred(QSerialPort::SerialPortError) is not emit; I guess it's because the serial port is not yet open?
I've got this source code (everything else is working well when I open the serial port):
connect(uart, SIGNAL(errorOccurred(QSerialPort::SerialPortError)), this, SLOT(handleError(QSerialPort::SerialPortError)));
...
void UART::handleError(QSerialPort::SerialPortError error)
{
if (error == QSerialPort::ResourceError)
{
emit errorDetected(uart->errorString()); //emit error string to the GUI
if(uart->isOpen())
{
uart->close();
}
}
}
connect(uart, SIGNAL(errorOccurred(QSerialPort::SerialPortError)), this, SLOT(handleError(QSerialPort::SerialPortError)));
...
void UART::handleError(QSerialPort::SerialPortError error)
{
if (error == QSerialPort::ResourceError)
{
emit errorDetected(uart->errorString()); //emit error string to the GUI
if(uart->isOpen())
{
uart->close();
}
}
}
To copy to clipboard, switch view to plain text mode
Do you have a clue?
Thanks
Bookmarks