[SOLVED] - QIODevice readyread() not raised
-
Hello,
I'm trying to use QtSerialPort which use QIOdevice.
I wonder why but it seems that readyread SIGNAL isn't raised.
If I use waitForReadyRead() for testing purpose, my SLOT is executed.any Idea ?
@
void MainWindow::readConfFile()
{
if (port->isOpen())
port->close();
port = new SerialPort();connectionStatus = false; QFile file("./config.ini"); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { // some configuration file stuff if (!port->open(QIODevice::ReadWrite)) { QMessageBox::critical(this,"Erreur","La communication n'a pas pu être établie...", QMessageBox::Ok); ui->actionConfiguration->trigger(); } // other configuration stuff file.close(); } else { port->setPort("COM1"); if (!port->open(QIODevice::ReadWrite)) { QMessageBox::critical(this,"Erreur","La communication n'a pas pu être établie...", QMessageBox::Ok); ui->actionConfiguration->trigger(); } port->setRate(19200); port->setParity(SerialPort::NoParity); port->setDataBits(SerialPort::Data8); port->setStopBits(SerialPort::OneStop); port->setFlowControl(SerialPort::NoFlowControl); } connectSlots();
}
@
SLOTS
@
void MainWindow::connectSlots()
{
connect(port, SIGNAL(readyRead()), this, SLOT(readData()));
connect(port, SIGNAL(bytesWritten(qint64)), this, SLOT(writeData(qint64)));
connect(port, SIGNAL(aboutToClose()), this, SLOT(connectionLost()));
}
@
readData
@
void MainWindow::readData()
{
lastAnswer = port->readLine();
qDebug("in : "+lastAnswer.toAscii());
if (lastframe == HANDY_REQUEST)
{
if (lastAnswer != "")
{
if (lastAnswer != HANDY_CONNECTED)
{
connectionStatus = false;
ui->FrameSeeking->setVisible(true);
}
else
{
connectionStatus = true;
ui->FrameSeeking->setVisible(false);
}
}
}
}
@I feel so screwed because this code was working Friday x)
Damn I hate Mondays !EDIT : Ah, and maybe should I add that writing data on this serial port works fine...