Hello,
I want to check how many bytes are written on the port after I send an amount of data..
I connected bytesWritten signal of IODevice to a slot for viewing the amount of bytes written..
But when i print it on a textedit display, i see a value like:
-3617008641903833651
What does this mean? I was expecting something like 1024 (bytes)...
Here is the code:
Here I connected the slot to bytesWrittenSignal:
connect(serial,
SIGNAL(QIODevice::bytesWritten(qint64
)),
this,
SLOT(writtenBytes
(qint64
)));
connect(serial, SIGNAL(QIODevice::bytesWritten(qint64)),this,SLOT(writtenBytes(qint64)));
To copy to clipboard, switch view to plain text mode
That is the slot definition:
qint64 SerialPort::writtenBytes(qint64 bytes)
{
allWrittenBytes = bytes;
return bytes;
}
qint64 SerialPort::writtenBytes(qint64 bytes)
{
allWrittenBytes = bytes;
return bytes;
}
To copy to clipboard, switch view to plain text mode
I printed it on QTextEdit.(I converted it to QString for compatibility)
qint64 writtenBytes_x;
writtenBytes_x = sp->allWrittenBytes;
textEdit->append(writtenBytesString);
qint64 writtenBytes_x;
writtenBytes_x = sp->allWrittenBytes;
QString writtenBytesString = QString::number(writtenBytes_x,10);
textEdit->append(writtenBytesString);
To copy to clipboard, switch view to plain text mode
Bookmarks