pafra88 / qextserialport

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

Need Threshold parameter added to PortSettings #130

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What new feature(s) would you like to see included?

Add a qint64 Threshold field to PortSettings.  Have this field default to 0.  
Then modify the following section of code.

void QextSerialPortPrivate::_q_canRead()
{
    qint64 maxSize = bytesAvailable_sys();
    if (maxSize > use_port_settings_value_here) {
        char * writePtr = readBuffer.reserve(size_t(maxSize));
        qint64 bytesRead = readData_sys(writePtr, maxSize);
        if (bytesRead < maxSize)
            readBuffer.chop(maxSize - bytesRead);
        Q_Q(QextSerialPort);
        Q_EMIT q->readyRead();
    }
}

This will allow for a much greater flow control in applications.  Many 
applications are having to deal with short messages and such, when they really 
shouldn't have to.  GreenLeaf CommLib used to let us do things like this under 
DOS/Windows and a few other platforms.  Of course, that library had a double 
ring buffer as well.  One ring for writing and one for reading.  User could set 
the size.  Reader would simply keep writing and overwrite from beginning.  
Reader would stop when head met tail.

Roland

Original issue reported on code.google.com by rol...@logikalsolutions.com on 4 May 2012 at 3:11

GoogleCodeExporter commented 8 years ago
Ok, look good for me.

Original comment by dbzhang...@gmail.com on 4 May 2012 at 8:10

GoogleCodeExporter commented 8 years ago
don't work on this yet.  I'm going to take some time this weekend and try doing 
the mod myself and several others really need.  I will roll this mod in as 
well.  I'm going to move PortSettings into its own header file so I can 
implement a BoundPacketReady signal and ReadBoundPacket(), BoundPacketSize() 
methods.  Hope to email the code to you sometime tomorrow after I run a few 
errands.

Original comment by rol...@logikalsolutions.com on 5 May 2012 at 3:55