From de70bbb517839b552648d7590d240c3d2f7e646a Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Fri, 20 Apr 2018 14:59:04 +0300 Subject: Add changes file for Qt 5.11.0 Change-Id: I47f00b9b940e85d8c4d9d77b707283a2ab12b26e Reviewed-by: Alex Blasche --- dist/changes-5.11.0 | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 dist/changes-5.11.0 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." 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. -- cgit v1.2.3 From c66a364cf34b4945208f07362deabe0020e5b596 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 8 May 2018 13:46:39 -0700 Subject: Fix compilation with MSVC 2017 std::bitset<8> fails to compile with MSVC 2017. I don't know why nor do I care. Just use a regular byte for one byte, QBitArray for multiple. bitset(271): error C2666: 'operator /': 10 overloads have similar conversions [...] bitset(271): note: or 'built-in C++ operator/(size_t, )' bitset(271): note: while trying to match the argument list '(size_t, )' bitset(267): note: while compiling class template member function 'std::bitset<8> &std::bitset<8>::set(size_t,bool)' bitset(40): note: see reference to function template instantiation 'std::bitset<8> &std::bitset<8>::set(size_t,bool)' being compiled Change-Id: I5d0ee9389a794d80983efffd152cc64b1e99d236 Reviewed-by: Karsten Heimrich --- src/serialbus/qmodbusclient.cpp | 13 ++++++------- src/serialbus/qmodbusserver.cpp | 35 ++++++++++++++++------------------- 2 files changed, 22 insertions(+), 26 deletions(-) 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 #include -#include - QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(QT_MODBUS) @@ -304,10 +302,11 @@ QModbusRequest QModbusClientPrivate::createWriteRequest(const QModbusDataUnit &d quint8 address = 0; QVector 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 (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 #include #include #include #include -#include 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 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 (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 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 (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> bytes; + QVector 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 ¤tByte : 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; } -- cgit v1.2.3