diff options
author | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2016-02-17 11:39:19 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2016-02-17 19:10:33 +0000 |
commit | 0420e57c90ccdb94b89761da47140f284eb89d37 (patch) | |
tree | 064747c854e178adb0229c4308f0861318fe3ac8 /src/serialbus/qmodbuspdu.cpp | |
parent | c70a80597a06edc0c4121fbbfa18dd69ef1540ba (diff) |
qDebug: Add exception byte when streaming exception response.
Change-Id: I43c8e966d8f1f201c53d9672868a7baedbc6704c
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/serialbus/qmodbuspdu.cpp')
-rw-r--r-- | src/serialbus/qmodbuspdu.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/serialbus/qmodbuspdu.cpp b/src/serialbus/qmodbuspdu.cpp index a28130e..dd53092 100644 --- a/src/serialbus/qmodbuspdu.cpp +++ b/src/serialbus/qmodbuspdu.cpp @@ -354,8 +354,9 @@ static int minimumDataSize(const QModbusPdu &pdu, Type type) QDebug operator<<(QDebug debug, const QModbusPdu &pdu) { QDebugStateSaver _(debug); - debug.nospace().noquote() << "0x" << QByteArray(1, pdu.functionCode()).toHex() << pdu.data() - .toHex(); + debug.nospace().noquote() << "0x" << hex << qSetFieldWidth(2) << qSetPadChar('0') + << (pdu.isException() ? pdu.functionCode() | QModbusPdu::ExceptionByte : pdu.functionCode()) + << qSetFieldWidth(0) << pdu.data().toHex(); return debug; } |