connect(m_serialPort, &QSerialPort::readyRead, this, &TokozSerial::HandleReadyRead);
void TokozSerial::HandleReadyRead()
{
if(m_serialPort->bytesAvailable() > 0)
{
while (!m_serialPort->atEnd())
{
m_readData.append(m_serialPort->readAll());
}
HandleTimeout();
}
}
void TokozSerial::HandleTimeout()
{
m_serialPort->clear();
qDebug() << "RawData" << m_readData;
connect(this, &TokozSerial::HandleReady, gp_protocolUart, &ProtocolUart::HandleReady);
emit HandleReady(m_readData);
disconnect(this, &TokozSerial::HandleReady, gp_protocolUart, &ProtocolUart::HandleReady);
disconnect(this, &TokozSerial::HandleReady, 0, 0);
m_readData.clear();
}
connect(m_serialPort, &QSerialPort::readyRead, this, &TokozSerial::HandleReadyRead);
void TokozSerial::HandleReadyRead()
{
if(m_serialPort->bytesAvailable() > 0)
{
while (!m_serialPort->atEnd())
{
m_readData.append(m_serialPort->readAll());
}
HandleTimeout();
}
}
void TokozSerial::HandleTimeout()
{
m_serialPort->clear();
qDebug() << "RawData" << m_readData;
connect(this, &TokozSerial::HandleReady, gp_protocolUart, &ProtocolUart::HandleReady);
emit HandleReady(m_readData);
disconnect(this, &TokozSerial::HandleReady, gp_protocolUart, &ProtocolUart::HandleReady);
disconnect(this, &TokozSerial::HandleReady, 0, 0);
m_readData.clear();
}
To copy to clipboard, switch view to plain text mode
Bookmarks