summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-5.11.053
-rw-r--r--examples/serialbus/can/bitratebox.cpp2
-rw-r--r--src/serialbus/qmodbusclient.cpp13
-rw-r--r--src/serialbus/qmodbusserver.cpp35
4 files changed, 76 insertions, 27 deletions
diff --git a/dist/changes-5.11.0 b/dist/changes-5.11.0
new file mode 100644
index 0000000..e44822e
--- /dev/null
+++ b/dist/changes-5.11.0
@@ -0,0 +1,53 @@
+Qt 5.11 introduces many new features and improvements as well as bugfixes
+over the 5.10.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.11 series is binary compatible with the 5.10.x series.
+Applications compiled for 5.10 will continue to run with 5.11.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+This release contains all fixes included in the Qt 5.9.4, 5.9.5 and 5.10.1
+releases.
+
+****************************************************************************
+* Qt 5.11.0 Changes *
+****************************************************************************
+
+CAN bus
+-------
+
+ - Introduced categorized logging to the module which can be enabled
+ by the "qt.canbus" and "qt.canbus.plugins.<pluginname>" filters.
+
+ - Added description, serial number and channel to QCanBusDeviceInfo, as
+ far as supported by the various plugins.
+
+ - [QTBUG-63294] QCanBusFrame::isValid() now checks for invalid CAN FD
+ payload lengths. E.g. 24 is a valid CAN FD payload length, but 28
+ is not. Frames with invalid data field size may therefore be discarded
+ by QCanBusDevice::writeFrame() as it is impossible to transmit them on
+ a real CAN bus.
+
+ - All CAN bus plugins that don't support CAN FD now also discard CAN FD
+ frames with payload length <= 8.
+
+ - Added a J2534 Pass-Thru CAN bus plugin.
+
+ - [QTBUG-67030] Fixed a receive problem in the VectorCAN plugin. When
+ multiple channels were open, only the first one could receive frames.
+
+MOD bus
+------
+
+ - [QTBUG-66648] Ensure that QModbusDevice::close() handles being already
+ unconnected. Before, an unconnected device could hang in closing state
+ forever.
diff --git a/examples/serialbus/can/bitratebox.cpp b/examples/serialbus/can/bitratebox.cpp
index fab2da5..7c19a5d 100644
--- a/examples/serialbus/can/bitratebox.cpp
+++ b/examples/serialbus/can/bitratebox.cpp
@@ -58,7 +58,7 @@ BitRateBox::BitRateBox(QWidget *parent) :
{
fillBitRates();
- connect(this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
+ connect(this, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &BitRateBox::checkCustomSpeedPolicy);
}
diff --git a/src/serialbus/qmodbusclient.cpp b/src/serialbus/qmodbusclient.cpp
index 182a212..077b2ec 100644
--- a/src/serialbus/qmodbusclient.cpp
+++ b/src/serialbus/qmodbusclient.cpp
@@ -41,8 +41,6 @@
#include <QtCore/qdebug.h>
#include <QtCore/qloggingcategory.h>
-#include <bitset>
-
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(QT_MODBUS)
@@ -304,10 +302,11 @@ QModbusRequest QModbusClientPrivate::createWriteRequest(const QModbusDataUnit &d
quint8 address = 0;
QVector<quint8> bytes;
for (quint8 i = 0; i < byteCount; ++i) {
- std::bitset<8> byte;
+ quint8 byte = 0;
for (int currentBit = 0; currentBit < 8; ++currentBit)
- byte[currentBit] = data.value(address++);
- bytes.append(static_cast<quint8> (byte.to_ulong()));
+ if (data.value(address++))
+ byte |= (1U << currentBit);
+ bytes.append(byte);
}
return QModbusRequest(QModbusRequest::WriteMultipleCoils, quint16(data.startAddress()),
@@ -454,9 +453,9 @@ bool QModbusClientPrivate::collateBits(const QModbusPdu &response,
if (data) {
uint value = 0;
for (qint32 i = 1; i < payload.size(); ++i) {
- const std::bitset<8> byte = payload[i];
+ const quint8 byte = quint8(payload[i]);
for (qint32 currentBit = 0; currentBit < 8 && value < data->valueCount(); ++currentBit)
- data->setValue(value++, byte[currentBit]);
+ data->setValue(value++, byte & (1U << currentBit) ? 1 : 0);
}
data->setRegisterType(type);
}
diff --git a/src/serialbus/qmodbusserver.cpp b/src/serialbus/qmodbusserver.cpp
index 4e16e1b..5c0f8dd 100644
--- a/src/serialbus/qmodbusserver.cpp
+++ b/src/serialbus/qmodbusserver.cpp
@@ -39,12 +39,12 @@
#include "qmodbusserver_p.h"
#include "qmodbus_symbols_p.h"
+#include <QtCore/qbitarray.h>
#include <QtCore/qdebug.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/qvector.h>
#include <algorithm>
-#include <bitset>
QT_BEGIN_NAMESPACE
@@ -731,18 +731,16 @@ QModbusResponse QModbusServerPrivate::readBits(const QModbusPdu &request,
unit.setValueCount(byteCount * 8);
}
+ // Using byteCount * 8 so the remaining bits in the last byte are zero
+ QBitArray bytes(byteCount * 8);
+
address = 0; // The data range now starts with zero.
- QVector<quint8> bytes;
- for (int i = 0; i < byteCount; ++i) {
- std::bitset<8> byte;
- // According to the spec: If the returned quantity is not a multiple of eight,
- // the remaining bits in the final data byte will be padded with zeros.
- for (int currentBit = 0; currentBit < 8; ++currentBit)
- byte[currentBit] = unit.value(address++); // The padding happens inside value().
- bytes.append(static_cast<quint8> (byte.to_ulong()));
- }
+ for ( ; address < count; ++address)
+ bytes.setBit(address, unit.value(address));
- return QModbusResponse(request.functionCode(), byteCount, bytes);
+ QByteArray payload = QByteArray::fromRawData(bytes.bits(), byteCount);
+ payload.prepend(char(byteCount));
+ return QModbusResponse(request.functionCode(), payload);
}
QModbusResponse QModbusServerPrivate::processReadHoldingRegistersRequest(const QModbusRequest &rqst)
@@ -831,13 +829,12 @@ QModbusResponse QModbusServerPrivate::processReadExceptionStatusRequest(const QM
}
quint16 address = 0;
- QVector<quint8> bytes;
- std::bitset<8> byte;
+ quint8 byte = 0;
for (int currentBit = 0; currentBit < 8; ++currentBit)
- byte[currentBit] = coils.value(address++); // The padding happens inside value().
- bytes.append(static_cast<quint8> (byte.to_ulong()));
+ if (coils.value(address++)) // The padding happens inside value().
+ byte |= (1U << currentBit);
- return QModbusResponse(request.functionCode(), bytes);
+ return QModbusResponse(request.functionCode(), byte);
}
QModbusResponse QModbusServerPrivate::processDiagnosticsRequest(const QModbusRequest &request)
@@ -985,7 +982,7 @@ QModbusResponse QModbusServerPrivate::processWriteMultipleCoilsRequest(const QMo
QModbusExceptionResponse::IllegalDataAddress);
}
- QVector<std::bitset<8>> bytes;
+ QVector<quint8> bytes;
const QByteArray payload = request.data().mid(5);
for (qint32 i = payload.size() - 1; i >= 0; --i)
bytes.append(quint8(payload[i]));
@@ -994,9 +991,9 @@ QModbusResponse QModbusServerPrivate::processWriteMultipleCoilsRequest(const QMo
// range is numberOfCoils and therefore index too.
quint16 coil = numberOfCoils;
qint32 currentBit = 8 - ((byteCount * 8) - numberOfCoils);
- for (const auto &currentByte : qAsConst(bytes)) {
+ for (quint8 currentByte : qAsConst(bytes)) {
for (currentBit -= 1; currentBit >= 0; --currentBit)
- coils.setValue(--coil, currentByte[currentBit]);
+ coils.setValue(--coil, currentByte & (1U << currentBit) ? 1 : 0);
currentBit = 8;
}