arunkumaraymuo1
21st January 2013, 08:56
OS:Ubuntu 11
QExtSerialport 1.2 beta
I am creating an application to write an instruction to a device and receive its response from the device. I connected the readyread() singal to onReadyRead() slot. but sometime its getting only the partial data from the device to the onReadyRead() slot.
I am writing *Read to device
and getting
*Read<Values>
P=122
C=0.33
sometime I got only the partial result in my onReadyRead()
I tried event driven and Polling methods.Still the issue exist.How I can completely read the device input in my onReadyRead().
I checked this on putty software also. its working perfectly in there.
my code sample is given below
void Reader::Create()
{
PortSettings settings = {BAUD19200, DATA_8, PAR_NONE, STOP_1, FLOW_OFF, 20};
port = new QextSerialPort(m_strPortName, settings, QextSerialPort::EventDriven);
timer = new QTimer(this);
timer->setInterval(20);
connect(timer, SIGNAL(timeout()), SLOT(onReadyRead()));
connect(port, SIGNAL(readyRead()), SLOT(onReadyRead()));
if (!port->isOpen())
{
port->setPortName(m_strPortName);
port->open(QIODevice::ReadWrite);
}
else {
// port->close();
}
if (port->isOpen() && port->queryMode() == QextSerialPort::Polling)
timer->start();
else
timer->stop();
}
void Reader::onReadyRead()
{
if (port->bytesAvailable())
{
m_strData= port->readAll();
}
}
QExtSerialport 1.2 beta
I am creating an application to write an instruction to a device and receive its response from the device. I connected the readyread() singal to onReadyRead() slot. but sometime its getting only the partial data from the device to the onReadyRead() slot.
I am writing *Read to device
and getting
*Read<Values>
P=122
C=0.33
sometime I got only the partial result in my onReadyRead()
I tried event driven and Polling methods.Still the issue exist.How I can completely read the device input in my onReadyRead().
I checked this on putty software also. its working perfectly in there.
my code sample is given below
void Reader::Create()
{
PortSettings settings = {BAUD19200, DATA_8, PAR_NONE, STOP_1, FLOW_OFF, 20};
port = new QextSerialPort(m_strPortName, settings, QextSerialPort::EventDriven);
timer = new QTimer(this);
timer->setInterval(20);
connect(timer, SIGNAL(timeout()), SLOT(onReadyRead()));
connect(port, SIGNAL(readyRead()), SLOT(onReadyRead()));
if (!port->isOpen())
{
port->setPortName(m_strPortName);
port->open(QIODevice::ReadWrite);
}
else {
// port->close();
}
if (port->isOpen() && port->queryMode() == QextSerialPort::Polling)
timer->start();
else
timer->stop();
}
void Reader::onReadyRead()
{
if (port->bytesAvailable())
{
m_strData= port->readAll();
}
}