diff options
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | config.tests/compilerdetection/compilerdetection.pro | 9 | ||||
-rw-r--r-- | config.tests/compilerdetection/main.cpp | 58 | ||||
-rw-r--r-- | configure.json | 5 | ||||
-rw-r--r-- | qtknx.pro | 5 | ||||
-rw-r--r-- | src/knx/configure.json | 37 | ||||
-rw-r--r-- | src/knx/doc/src/index.qdoc | 18 | ||||
-rw-r--r-- | src/knx/doc/src/module.qdoc | 18 | ||||
-rw-r--r-- | src/knx/qknxnetipdescriptionresponse.h | 47 |
9 files changed, 170 insertions, 29 deletions
diff --git a/.qmake.conf b/.qmake.conf index 4e4a28b..08b8470 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,4 +1,6 @@ load(qt_build_config) + CONFIG += warning_clean +DEFINES += QT_NO_FOREACH MODULE_VERSION = 5.10.0 diff --git a/config.tests/compilerdetection/compilerdetection.pro b/config.tests/compilerdetection/compilerdetection.pro new file mode 100644 index 0000000..b3ef8d1 --- /dev/null +++ b/config.tests/compilerdetection/compilerdetection.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT = core + +CONFIG += qt +CONFIG += c++11 +CONFIG += console + +SOURCES += main.cpp diff --git a/config.tests/compilerdetection/main.cpp b/config.tests/compilerdetection/main.cpp new file mode 100644 index 0000000..2a9ba9f --- /dev/null +++ b/config.tests/compilerdetection/main.cpp @@ -0,0 +1,58 @@ +/****************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtKnx module. +** +** $QT_BEGIN_LICENSE:COMM$ +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** $QT_END_LICENSE$ +** +******************************************************************************/ + +#include <QtCore/qglobal.h> + +#if !defined(Q_OS_WIN) +# if defined(Q_CC_CLANG) +# if defined(__apple_build_version__) +# if __apple_build_version__ == 8020041 +# error "Apple LLVM version 8.1.0 (clang-802.0.41)" +# endif +# endif +# elif defined(Q_CC_GNU) +# if Q_CC_GNU < 409 +# error "GCC version less than 4.9.0" +# endif +# endif +#else +# if defined(Q_CC_MSVC) +# if Q_CC_MSVC >= 1900 +# error "Visual C++ compiler less than version 19." +# endif +# endif +#endif + +struct ConstExpr +{ + static constexpr const quint16 DefaultPort = 3671; + static constexpr const char *MulticastAddress = "224.0.23.12"; +}; + +int main(int /*argc*/, char** /*argv*/) +{ + auto port = ConstExpr::DefaultPort; + Q_UNUSED(port) + auto address = ConstExpr::MulticastAddress; + Q_UNUSED(address) + + return 0; +} diff --git a/configure.json b/configure.json new file mode 100644 index 0000000..78a1945 --- /dev/null +++ b/configure.json @@ -0,0 +1,5 @@ +{ + "subconfigs": [ + "src/knx" + ] +} @@ -4,3 +4,8 @@ lessThan(QT_MAJOR_VERSION, 5) { load(configure) load(qt_parts) + +include($$OUT_PWD/src/knx/qtknx-config.pri) +QT_FOR_CONFIG += knx-private + +requires(qtConfig(compilerdetection)) diff --git a/src/knx/configure.json b/src/knx/configure.json new file mode 100644 index 0000000..40a07df --- /dev/null +++ b/src/knx/configure.json @@ -0,0 +1,37 @@ +{ + "module": "knx", + "testDir": "../../config.tests", + + "tests": { + "compilerdetection": { + "label": "Minimum compiler version", + "type": "compile", + "test": "compilerdetection" + } + }, + + "features": { + "compilerdetection": { + "label": "Minimum compiler version detected", + "condition": "tests.compilerdetection", + "output": [ "privateFeature" ] + } + }, + + "report": [ + { + "type": "note", + "condition": "!features.compilerdetection", + "message": "QtKnx: Your compiler is not officially supported or was not detected properly." + } + ], + + "summary": [ + { + "section": "Qt KNX", + "entries": [ + "compilerdetection" + ] + } + ] +} diff --git a/src/knx/doc/src/index.qdoc b/src/knx/doc/src/index.qdoc index 65e8114..7479448 100644 --- a/src/knx/doc/src/index.qdoc +++ b/src/knx/doc/src/index.qdoc @@ -1,9 +1,23 @@ -/**************************************************************************** +/****************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** -****************************************************************************/ +** This file is part of the QtKnx module. +** +** $QT_BEGIN_LICENSE:COMM$ +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** $QT_END_LICENSE$ +** +******************************************************************************/ /*! \page qtknx-index.html diff --git a/src/knx/doc/src/module.qdoc b/src/knx/doc/src/module.qdoc index ef614ce..50bc50c 100644 --- a/src/knx/doc/src/module.qdoc +++ b/src/knx/doc/src/module.qdoc @@ -1,9 +1,23 @@ -/**************************************************************************** +/****************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** -****************************************************************************/ +** This file is part of the QtKnx module. +** +** $QT_BEGIN_LICENSE:COMM$ +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** $QT_END_LICENSE$ +** +******************************************************************************/ /*! \module QtKnx diff --git a/src/knx/qknxnetipdescriptionresponse.h b/src/knx/qknxnetipdescriptionresponse.h index 0abe435..e553ced 100644 --- a/src/knx/qknxnetipdescriptionresponse.h +++ b/src/knx/qknxnetipdescriptionresponse.h @@ -37,30 +37,6 @@ QT_BEGIN_NAMESPACE -namespace QKnxPrivate -{ - static inline QKnxNetIpStructRef::Type codeToType(QKnxNetIp::DescriptionType code) - { - switch (QKnxNetIp::DescriptionType(code)) { - case QKnxNetIp::DescriptionType::DeviceInfo: - return QKnxNetIpStructRef::Type::QKnxNetIpDeviceDib; - case QKnxNetIp::DescriptionType::SupportedServiceFamilies: - return QKnxNetIpStructRef::Type::QKnxNetIpServiceFamiliesDib; - case QKnxNetIp::DescriptionType::IpConfiguration: - return QKnxNetIpStructRef::Type::QKnxNetIpConfigDib; - case QKnxNetIp::DescriptionType::CurrentIpConfiguration: - return QKnxNetIpStructRef::Type::QKnxNetIpCurrentConfigDib; - case QKnxNetIp::DescriptionType::KnxAddresses: - return QKnxNetIpStructRef::Type::QKnxNetIpKnxAddressesDib; - case QKnxNetIp::DescriptionType::ManufactorData: - return QKnxNetIpStructRef::Type::QKnxNetIpManufacturerDib; - default: - break; - } - return QKnxNetIpStructRef::Type::Null; - } -} - class Q_KNX_EXPORT QKnxNetIpDescriptionResponse final : public QKnxNetIpFrame { public: @@ -85,6 +61,27 @@ public: static_assert(is_type<T, QVector<QKnxNetIpStructRef>, std::deque<QKnxNetIpStructRef>, std::vector<QKnxNetIpStructRef>>::value, "Type not supported."); + const auto codeToType = [] (QKnxNetIp::DescriptionType code) -> QKnxNetIpStructRef::Type + { + switch (QKnxNetIp::DescriptionType(code)) { + case QKnxNetIp::DescriptionType::DeviceInfo: + return QKnxNetIpStructRef::Type::QKnxNetIpDeviceDib; + case QKnxNetIp::DescriptionType::SupportedServiceFamilies: + return QKnxNetIpStructRef::Type::QKnxNetIpServiceFamiliesDib; + case QKnxNetIp::DescriptionType::IpConfiguration: + return QKnxNetIpStructRef::Type::QKnxNetIpConfigDib; + case QKnxNetIp::DescriptionType::CurrentIpConfiguration: + return QKnxNetIpStructRef::Type::QKnxNetIpCurrentConfigDib; + case QKnxNetIp::DescriptionType::KnxAddresses: + return QKnxNetIpStructRef::Type::QKnxNetIpKnxAddressesDib; + case QKnxNetIp::DescriptionType::ManufactorData: + return QKnxNetIpStructRef::Type::QKnxNetIpManufacturerDib; + default: + break; + } + return QKnxNetIpStructRef::Type::Null; + }; + const auto &ref = payloadRef(); auto header = QKnxNetIpStructHeader<QKnxNetIp::DescriptionType>::fromBytes(ref, 0); quint16 index = header.totalSize(); // total size of device DIB @@ -95,7 +92,7 @@ public: T dibs; while (index < ref.size()) { header = QKnxNetIpStructHeader<QKnxNetIp::DescriptionType>::fromBytes(ref, index); - dibs.push_back(QKnxNetIpStructRef(payloadRef(index), QKnxPrivate::codeToType(header.code()))); + dibs.push_back(QKnxNetIpStructRef(payloadRef(index), codeToType(header.code()))); index += header.totalSize(); // advance of total size of last read DIB } return dibs; |