diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-09-18 13:39:12 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-09-18 13:42:08 +0200 |
commit | 83a6b2a299d40513feb292dd041d1aa12e29fa13 (patch) | |
tree | 7044110b6b8af8c52667a3432648ecef9164def6 /src/knx | |
parent | cfd7b61bea8a5b12ee0959d6c5722e17bba689d7 (diff) | |
parent | 605aabe1549d22dd5b3c283e5bf9c0088e14704d (diff) |
Merge "Merge remote-tracking branch 'origin/5.15' into dev"
Diffstat (limited to 'src/knx')
-rw-r--r-- | src/knx/configure.json | 37 | ||||
-rw-r--r-- | src/knx/core/qknxbytearray.cpp | 8 | ||||
-rw-r--r-- | src/knx/core/qknxbytearray.h | 9 | ||||
-rw-r--r-- | src/knx/knxproj/qknxgroupaddressinfos.cpp | 10 | ||||
-rw-r--r-- | src/knx/netip/qknxnetipserverdescriptionagent.cpp | 4 | ||||
-rw-r--r-- | src/knx/netip/qknxnetipstruct.cpp | 20 | ||||
-rw-r--r-- | src/knx/netip/qknxnetipstruct.h | 23 | ||||
-rw-r--r-- | src/knx/netip/qknxnetipstructheader.cpp | 16 | ||||
-rw-r--r-- | src/knx/netip/qknxnetipstructheader.h | 44 | ||||
-rw-r--r-- | src/knx/qknxadditionalinfo.cpp | 2 | ||||
-rw-r--r-- | src/knx/qknxaddress.cpp | 4 | ||||
-rw-r--r-- | src/knx/qknxcontrolfield.cpp | 10 | ||||
-rw-r--r-- | src/knx/qknxcontrolfield.h | 9 | ||||
-rw-r--r-- | src/knx/qknxextendedcontrolfield.cpp | 2 |
14 files changed, 84 insertions, 114 deletions
diff --git a/src/knx/configure.json b/src/knx/configure.json deleted file mode 100644 index 92c66b0..0000000 --- a/src/knx/configure.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "module": "knx", - "testDir": "../../config.tests", - - "tests": { - "compiletest": { - "label": "Minimum compiler version", - "type": "compile", - "test": "compiletest" - } - }, - - "features": { - "compiletest": { - "label": "Minimum compiler version detected", - "condition": "tests.compiletest", - "output": [ "privateFeature" ] - } - }, - - "report": [ - { - "type": "note", - "condition": "!features.compiletest", - "message": "QtKnx: Your compiler is not officially supported or was not detected properly." - } - ], - - "summary": [ - { - "section": "Qt KNX", - "entries": [ - "compiletest" - ] - } - ] -} diff --git a/src/knx/core/qknxbytearray.cpp b/src/knx/core/qknxbytearray.cpp index 53ed547..bfec17d 100644 --- a/src/knx/core/qknxbytearray.cpp +++ b/src/knx/core/qknxbytearray.cpp @@ -262,18 +262,18 @@ void QKnxByteArray::resize(int size) */ /*! - \fn void QKnxByteArray::set(int i, quint8 value) + \fn void QKnxByteArray::set(int i, quint8 val) - Sets the character at the index position \a i in the byte array to \a value. + Sets the character at the index position \a i in the byte array to \a val. \a i must be a valid index position in the byte array (that is, between 0 and the value returned by size()). */ /*! - \fn void QKnxByteArray::setValue(int i, quint8 value) + \fn void QKnxByteArray::setValue(int i, quint8 val) - Sets the value at the index position \a i in the byte array to \a value. + Sets the value at the index position \a i in the byte array to \a val. If the index \a i is out of bounds, the function does nothing. If you are certain that \a i is within bounds, you can use set() instead, which diff --git a/src/knx/core/qknxbytearray.h b/src/knx/core/qknxbytearray.h index efc1a02..b48b9c5 100644 --- a/src/knx/core/qknxbytearray.h +++ b/src/knx/core/qknxbytearray.h @@ -92,14 +92,15 @@ public: void resize(int size); inline quint8 at(int i) const { return m_bytes.at(i); } - inline void set(int i, quint8 value) { + + inline void set(int i, quint8 val) { Q_ASSERT(i >= 0 && i < size()); - m_bytes[i] = value; + m_bytes[i] = val; } - inline void setValue(int i, quint8 value) + inline void setValue(int i, quint8 val) { - if (i >= 0 && i < m_bytes.size()) m_bytes[i] = value; + if (i >= 0 && i < m_bytes.size()) m_bytes[i] = val; } inline quint8 value(int i, quint8 defaultValue = {}) const { diff --git a/src/knx/knxproj/qknxgroupaddressinfos.cpp b/src/knx/knxproj/qknxgroupaddressinfos.cpp index 510fcab..b82c06f 100644 --- a/src/knx/knxproj/qknxgroupaddressinfos.cpp +++ b/src/knx/knxproj/qknxgroupaddressinfos.cpp @@ -142,7 +142,7 @@ bool QKnxGroupAddressInfosPrivate::readProject(const QKnxProject &project) } projects.insert(project.Id, info); } else { - projects.insert(project.Id, {}); // projects can have empty installations + projects.insert(project.Id, { QString(), {} }); // projects can have empty installations } return status == QKnxGroupAddressInfos::Status::NoError; @@ -369,7 +369,7 @@ QVector<QString> QKnxGroupAddressInfos::projectIds() const */ QString QKnxGroupAddressInfos::projectName(const QString &projectId) const { - return d_ptr->projects.value(projectId, {}).name; + return d_ptr->projects.value(projectId, { QString(), {} }).name; } /*! @@ -377,7 +377,7 @@ QString QKnxGroupAddressInfos::projectName(const QString &projectId) const */ QVector<QString> QKnxGroupAddressInfos::installations(const QString &projectId) const { - return d_ptr->projects.value(projectId, {}).installations.keys().toVector(); + return d_ptr->projects.value(projectId, { QString(), {} }).installations.keys().toVector(); } /*! @@ -386,7 +386,7 @@ QVector<QString> QKnxGroupAddressInfos::installations(const QString &projectId) */ qint32 QKnxGroupAddressInfos::infoCount(const QString &projectId, const QString &installation) const { - const auto installations = d_ptr->projects.value(projectId, {}).installations; + const auto installations = d_ptr->projects.value(projectId, { QString(), {} }).installations; if (installations.isEmpty()) return -1; @@ -404,7 +404,7 @@ QVector<QKnxGroupAddressInfo> QKnxGroupAddressInfos::addressInfos(const QString { if (projectId.isEmpty()) return {}; - return d_ptr->projects.value(projectId, {}).installations.value(installation); + return d_ptr->projects.value(projectId, { QString(), {} }).installations.value(installation); } /*! diff --git a/src/knx/netip/qknxnetipserverdescriptionagent.cpp b/src/knx/netip/qknxnetipserverdescriptionagent.cpp index 5735ed7..596cbbb 100644 --- a/src/knx/netip/qknxnetipserverdescriptionagent.cpp +++ b/src/knx/netip/qknxnetipserverdescriptionagent.cpp @@ -213,7 +213,11 @@ void QKnxNetIpServerDescriptionAgentPrivate::setupSocket() continue; setAndEmitServerDescriptionReceived({ m_server, response.deviceHardware(), +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) response.supportedFamilies() }); +#else + response.supportedFamilies(), {}, {} }); +#endif } }); } diff --git a/src/knx/netip/qknxnetipstruct.cpp b/src/knx/netip/qknxnetipstruct.cpp index affe641..124700f 100644 --- a/src/knx/netip/qknxnetipstruct.cpp +++ b/src/knx/netip/qknxnetipstruct.cpp @@ -156,17 +156,17 @@ QT_BEGIN_NAMESPACE */ /*! - \fn template <typename CodeType> QKnxNetIpStruct<CodeType>::QKnxNetIpStruct(CodeType code, const QKnxByteArray &data = {}) + \fn template <typename CodeType> QKnxNetIpStruct<CodeType>::QKnxNetIpStruct(CodeType codeType, const QKnxByteArray &dataField = {}) - Creates a new KNXnet/IP structure with the specified \a code and payload - \a data. + Creates a new KNXnet/IP structure with the specified \a codeType and payload + \a dataField. */ /*! - \fn template <typename CodeType> QKnxNetIpStruct<CodeType>::QKnxNetIpStruct(const QKnxNetIpStructHeader<CodeType> &header, const QKnxByteArray &data = {}) + \fn template <typename CodeType> QKnxNetIpStruct<CodeType>::QKnxNetIpStruct(const QKnxNetIpStructHeader<CodeType> &headerField, const QKnxByteArray &dataField = {}) - Creates a new KNXnet/IP structure with the specified \a header and payload - \a data. + Creates a new KNXnet/IP structure with the specified \a headerField and payload + \a dataField. The header is expected to be fully set up and all values describing the payload are expected to match the specified payload. @@ -238,16 +238,16 @@ QT_BEGIN_NAMESPACE */ /*! - \fn template <typename CodeType> QKnxNetIpStruct<CodeType>::setData(const QKnxByteArray &data) + \fn template <typename CodeType> QKnxNetIpStruct<CodeType>::setData(const QKnxByteArray &dataField) - Sets the data stored in the KNXnet/IP structure to \a data and updates the + Sets the data stored in the KNXnet/IP structure to \a dataField and updates the data size accordingly. */ /*! - \fn template <typename CodeType> QKnxNetIpStruct<CodeType>::setHeader(const QKnxNetIpStructHeader<CodeType> &header) + \fn template <typename CodeType> QKnxNetIpStruct<CodeType>::setHeader(const QKnxNetIpStructHeader<CodeType> &headerField) - Sets the header stored in the KNXnet/IP structure to \a header. + Sets the header stored in the KNXnet/IP structure to \a headerField. */ /*! diff --git a/src/knx/netip/qknxnetipstruct.h b/src/knx/netip/qknxnetipstruct.h index 0662ef1..0e2d196 100644 --- a/src/knx/netip/qknxnetipstruct.h +++ b/src/knx/netip/qknxnetipstruct.h @@ -46,15 +46,16 @@ public: QKnxNetIpStruct() = default; ~QKnxNetIpStruct() = default; - QKnxNetIpStruct(CodeType code, const QKnxByteArray &data = {}) - : m_header(code) + QKnxNetIpStruct(CodeType codeType, const QKnxByteArray &dataField = {}) + : m_header(codeType) { - setData(data); + setData(dataField); } - QKnxNetIpStruct(const QKnxNetIpStructHeader<CodeType> &header, const QKnxByteArray &data = {}) - : m_header(header) - , m_data(data) + QKnxNetIpStruct(const QKnxNetIpStructHeader<CodeType> &headerField, + const QKnxByteArray &dataField = {}) + : m_header(headerField) + , m_data(dataField) {} bool isNull() const @@ -82,9 +83,9 @@ public: return m_header; } - void setHeader(const QKnxNetIpStructHeader<CodeType> &header) + void setHeader(const QKnxNetIpStructHeader<CodeType> &headerField) { - m_header = header; + m_header = headerField; } CodeType code() const @@ -102,10 +103,10 @@ public: return m_data; } - void setData(const QKnxByteArray &data) + void setData(const QKnxByteArray &dataField) { - m_data = data; - m_header.setDataSize(data.size()); + m_data = dataField; + m_header.setDataSize(dataField.size()); } QKnxByteArray bytes() const diff --git a/src/knx/netip/qknxnetipstructheader.cpp b/src/knx/netip/qknxnetipstructheader.cpp index 3d977f5..34f7fc2 100644 --- a/src/knx/netip/qknxnetipstructheader.cpp +++ b/src/knx/netip/qknxnetipstructheader.cpp @@ -64,19 +64,19 @@ QT_BEGIN_NAMESPACE */ /*! - \fn template <typename CodeType> QKnxNetIpStructHeader<CodeType>::QKnxNetIpStructHeader(CodeType code) + \fn template <typename CodeType> QKnxNetIpStructHeader<CodeType>::QKnxNetIpStructHeader(CodeType codeType) Constructs a valid header object and sets the KNXnet/IP structure identifier - to \a code. + to \a codeType. \sa isValid(), code(), setCode() */ /*! - \fn template <typename CodeType> QKnxNetIpStructHeader<CodeType>::QKnxNetIpStructHeader(CodeType code, quint16 dataSize) + \fn template <typename CodeType> QKnxNetIpStructHeader<CodeType>::QKnxNetIpStructHeader(CodeType codeType, quint16 dataFieldSize) Constructs a valid header object and sets the KNXnet/IP structure identifier - to \a code and the data size to \a dataSize and updates the header size and + to \a codeType and the data size to \a dataFieldSize and updates the header size and total size accordingly. \sa isValid(), code(), setCode(), dataSize(), setDataSize() @@ -143,9 +143,9 @@ QT_BEGIN_NAMESPACE */ /*! - \fn template <typename CodeType> void QKnxNetIpStructHeader<CodeType>::setDataSize(quint16 dataSize) + \fn template <typename CodeType> void QKnxNetIpStructHeader<CodeType>::setDataSize(quint16 dataFieldSize) - Sets the KNXnet/IP structure data size to \a dataSize and updates the + Sets the KNXnet/IP structure data size to \a dataFieldSize and updates the header and total size accordingly. */ @@ -156,9 +156,9 @@ QT_BEGIN_NAMESPACE */ /*! - \fn template <typename CodeType> void QKnxNetIpStructHeader<CodeType>::setCode(CodeType code) + \fn template <typename CodeType> void QKnxNetIpStructHeader<CodeType>::setCode(CodeType codeType) - Sets the KNXnet/IP structure's code identifier to \a code. + Sets the KNXnet/IP structure's code identifier to \a codeType. */ /*! diff --git a/src/knx/netip/qknxnetipstructheader.h b/src/knx/netip/qknxnetipstructheader.h index a808a86..e57cfe4 100644 --- a/src/knx/netip/qknxnetipstructheader.h +++ b/src/knx/netip/qknxnetipstructheader.h @@ -46,22 +46,22 @@ public: QKnxNetIpStructHeader() = default; ~QKnxNetIpStructHeader() = default; - explicit QKnxNetIpStructHeader(CodeType code) - : QKnxNetIpStructHeader(code, 0) + explicit QKnxNetIpStructHeader(CodeType c) + : QKnxNetIpStructHeader(c, 0) {} - QKnxNetIpStructHeader(CodeType code, quint16 dataSize) + QKnxNetIpStructHeader(CodeType c, quint16 dataFieldSize) { - setCode(code); - setDataSize(dataSize); + setCode(c); + setDataSize(dataFieldSize); } template <typename T = CodeType, typename = typename std::enable_if<is_type<T, QKnxNetIp::SearchParameterType>::value>::type> - QKnxNetIpStructHeader(CodeType code, quint16 dataSize, bool mandatory) + QKnxNetIpStructHeader(CodeType c, quint16 dSize, bool mandatory) { - setCode(code); - setDataSize(dataSize); + setCode(c); + setDataSize(dSize); setMandatory(mandatory); } @@ -97,21 +97,21 @@ public: return totalSize() - size(); } - void setDataSize(quint16 dataSize) + void setDataSize(quint16 dataFieldSize) { // 2.1.3 Structures: If the amount of data exceeds 252 octets, the length octet shall // be 0xff and the next two octets shall contain the length as a 16 bit value. Then the // structure data shall start at the fifth octet. const auto tmp = code(); - setSize(dataSize > 0xfc ? 4 : 2); + setSize(dataFieldSize > 0xfc ? 4 : 2); - if (dataSize > 0xfc) { + if (dataFieldSize > 0xfc) { setByte(0, 0xff); - setByte(1, quint8((dataSize + 4) >> 8)); - setByte(2, quint8(dataSize + 4)); + setByte(1, quint8((dataFieldSize + 4) >> 8)); + setByte(2, quint8(dataFieldSize + 4)); } else { - setByte(0, quint8(dataSize + 2)); + setByte(0, quint8(dataFieldSize + 2)); } setCode(tmp); } @@ -121,9 +121,9 @@ public: return codeType(); } - void setCode(CodeType code) + void setCode(CodeType c) { - setCodeType(code); + setCodeType(c); } quint8 byte(quint8 index) const @@ -197,9 +197,9 @@ public: } private: - void setSize(quint8 size) + void setSize(quint8 structSize) { - m_bytes[0] = size; + m_bytes[0] = structSize; } void setByte(quint8 index, quint8 value) @@ -227,24 +227,24 @@ private: template<class T = CodeType> typename std::enable_if<is_type<T, QKnxNetIp::SearchParameterType>::value, void>::type - /* void */ setCodeType(CodeType code) + /* void */ setCodeType(CodeType c) { if (isNull()) { setSize(2); setByte(0, 2); } - setByte(size() - 1, (quint8(code) & ~(1 << 7)) | (quint8(isMandatory()) << 7)); + setByte(size() - 1, (quint8(c) & ~(1 << 7)) | (quint8(isMandatory()) << 7)); } template<class T = CodeType> typename std::enable_if<!is_type<T, QKnxNetIp::SearchParameterType>::value, void>::type - /* void */ setCodeType(CodeType code) + /* void */ setCodeType(CodeType c) { if (isNull()) { setSize(2); setByte(0, 2); } - setByte(size() - 1, quint8(code)); + setByte(size() - 1, quint8(c)); } template<class T = CodeType> diff --git a/src/knx/qknxadditionalinfo.cpp b/src/knx/qknxadditionalinfo.cpp index 6226313..611bdb5 100644 --- a/src/knx/qknxadditionalinfo.cpp +++ b/src/knx/qknxadditionalinfo.cpp @@ -318,7 +318,7 @@ QDebug operator<<(QDebug debug, const QKnxAdditionalInfo &info) { QDebugStateSaver _(debug); if (info.isValid()) { - QDebug &dbg = debug.nospace().noquote() << "0x" << hex << qSetFieldWidth(2) + QDebug &dbg = debug.nospace().noquote() << "0x" << Qt::hex << qSetFieldWidth(2) << qSetPadChar(QLatin1Char('0')); const auto rawData = info.bytes(); for (quint8 byte : qAsConst(rawData)) diff --git a/src/knx/qknxaddress.cpp b/src/knx/qknxaddress.cpp index 46a0cc2..439847e 100644 --- a/src/knx/qknxaddress.cpp +++ b/src/knx/qknxaddress.cpp @@ -421,8 +421,8 @@ QDebug operator<<(QDebug debug, const QKnxAddress &address) QDebugStateSaver _(debug); if (address.isValid()) { const auto rawData = address.bytes(); - debug.nospace().noquote() << "0x" << hex << qSetFieldWidth(2) << qSetPadChar(QLatin1Char('0')) - << rawData.at(0) << hex << rawData.at(1); + debug.nospace().noquote() << "0x" << Qt::hex << qSetFieldWidth(2) + << qSetPadChar(QLatin1Char('0')) << rawData.at(0) << Qt::hex << rawData.at(1); } else { debug.nospace().noquote() << "0x1nv4l1d"; } diff --git a/src/knx/qknxcontrolfield.cpp b/src/knx/qknxcontrolfield.cpp index 6a10ad3..b3c2d65 100644 --- a/src/knx/qknxcontrolfield.cpp +++ b/src/knx/qknxcontrolfield.cpp @@ -198,9 +198,9 @@ const std::bitset<8> gPriorityMask = 0x0c; */ /*! - \fn QKnxControlField::setRepeat(QKnxControlField::Repeat repeat) + \fn QKnxControlField::setRepeat(QKnxControlField::Repeat rep) - Sets the repetition flag to \a repeat. + Sets the repetition flag to \a rep. */ /*! @@ -219,9 +219,9 @@ const std::bitset<8> gPriorityMask = 0x0c; */ /*! - \fn QKnxControlField::setConfirm(QKnxControlField::Confirm confirm) + \fn QKnxControlField::setConfirm(QKnxControlField::Confirm conf) - Sets the confirm flag to \a confirm. + Sets the confirm flag to \a conf. */ /*! @@ -319,7 +319,7 @@ QKnxControlField::Builder QKnxControlField::builder() QDebug operator<<(QDebug debug, const QKnxControlField &field) { QDebugStateSaver _(debug); - debug.nospace().noquote() << "0x" << hex << qSetFieldWidth(2) << qSetPadChar(QLatin1Char('0')) + debug.nospace().noquote() << "0x" << Qt::hex << qSetFieldWidth(2) << qSetPadChar(QLatin1Char('0')) << field.bytes(); return debug; } diff --git a/src/knx/qknxcontrolfield.h b/src/knx/qknxcontrolfield.h index 02a0ddb..a418b79 100644 --- a/src/knx/qknxcontrolfield.h +++ b/src/knx/qknxcontrolfield.h @@ -77,8 +77,9 @@ public: Q_ENUM(Repeat) QKnxControlField::Repeat repeat() const // ### Qt6: Replace byte() with m_ctrl1 { return static_cast<Repeat> (quint8(testBit(byte(), 5))); } - void setRepeat(QKnxControlField::Repeat repeat) // ### Qt6: Replace byte() with m_ctrl1 - { m_ctrl1 = setBit(byte(), bool(static_cast<int> (repeat)), 5); } + void setRepeat(QKnxControlField::Repeat rep) // ### Qt6: Replace byte() with m_ctrl1 + { m_ctrl1 = setBit(byte(), bool(static_cast<int> (rep)), 5); } + enum class Broadcast : quint8 { @@ -121,8 +122,8 @@ public: Q_ENUM(Confirm) QKnxControlField::Confirm confirm() const // ### Qt6: Replace byte() with m_ctrl1 { return static_cast<Confirm> (quint8(testBit(byte(), 0))); } - void setConfirm(QKnxControlField::Confirm confirm) // ### Qt6: Replace byte() with m_ctrl1 - { m_ctrl1 = setBit(byte(), bool(static_cast<int> (confirm)), 0); } + void setConfirm(QKnxControlField::Confirm conf) // ### Qt6: Replace byte() with m_ctrl1 + { m_ctrl1 = setBit(byte(), bool(static_cast<int> (conf)), 0); } quint8 byte() const { return quint8(m_ctrl1.to_ulong()); } QKnxByteArray bytes() const { return { byte() }; } diff --git a/src/knx/qknxextendedcontrolfield.cpp b/src/knx/qknxextendedcontrolfield.cpp index 849aa2f..65bedc9 100644 --- a/src/knx/qknxextendedcontrolfield.cpp +++ b/src/knx/qknxextendedcontrolfield.cpp @@ -234,7 +234,7 @@ QKnxExtendedControlField::Builder QKnxExtendedControlField::builder() QDebug operator<<(QDebug debug, const QKnxExtendedControlField &field) { QDebugStateSaver _(debug); - debug.nospace().noquote() << "0x" << hex << qSetFieldWidth(2) << qSetPadChar(QLatin1Char('0')) + debug.nospace().noquote() << "0x" << Qt::hex << qSetFieldWidth(2) << qSetPadChar(QLatin1Char('0')) << field.bytes(); return debug; } |