pafra88 / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

Not reading the serial port data fully using QExserialports readyread of singal slot #156

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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();
    }
}

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by arunkuma...@gmail.com on 18 Jan 2013 at 9:46

GoogleCodeExporter commented 8 years ago
apologize me I forgot to remove that last comments

Original comment by arunkuma...@gmail.com on 18 Jan 2013 at 9:49

GoogleCodeExporter commented 8 years ago
Hi, 

do you mean some issue like this  
?http://stackoverflow.com/questions/14109522/why-this-works-like-this

Original comment by dbzhang...@gmail.com on 21 Jan 2013 at 1:19

GoogleCodeExporter commented 8 years ago
Yes..., i am getting the result like partial output

Original comment by arunkuma...@gmail.com on 21 Jan 2013 at 8:34