├── src
├── serialbus
│ ├── qt_cmdline.cmake
│ ├── doc
│ │ ├── images
│ │ │ ├── can-example.png
│ │ │ ├── canbus_signals_be.png
│ │ │ └── canbus_signals_le.png
│ │ ├── src
│ │ │ ├── examples
│ │ │ │ └── qtserialbus-examples.qdoc
│ │ │ ├── external-resources.qdoc
│ │ │ ├── qtserialbus-module-use.qdocinc
│ │ │ ├── qtserialbus-toc.qdoc
│ │ │ ├── qtserialbus-module-cpp.qdoc
│ │ │ └── qtmodbus-backends.qdoc
│ │ └── snippets
│ │ │ └── snippetmain.cpp
│ ├── qtserialbusglobal.h
│ ├── qmodbustcpclient.h
│ ├── qcanbusfactory.h
│ ├── qcanbus.h
│ ├── qcanbusdeviceinfo_p.h
│ ├── qcanuniqueiddescription_p.h
│ ├── qcanmessagedescription_p.h
│ ├── qmodbustcpserver.h
│ ├── qcanbusfactory.cpp
│ ├── qmodbusrtuserialclient.h
│ ├── qmodbusrtuserialserver.h
│ ├── qcanbusdevice_p.h
│ ├── qmodbus_symbols_p.h
│ ├── qcancommondefinitions.h
│ ├── qcanbusdeviceinfo.h
│ ├── qmodbusclient.h
│ ├── qmodbusreply.h
│ ├── configure.cmake
│ └── qcanframeprocessor_p.h
├── plugins
│ ├── CMakeLists.txt
│ └── canbus
│ │ ├── peakcan
│ │ ├── plugin.json
│ │ ├── CMakeLists.txt
│ │ ├── main.cpp
│ │ ├── peakcanbackend_p.h
│ │ └── peakcanbackend.h
│ │ ├── tinycan
│ │ ├── plugin.json
│ │ ├── CMakeLists.txt
│ │ ├── tinycanbackend.h
│ │ ├── main.cpp
│ │ └── tinycanbackend_p.h
│ │ ├── passthrucan
│ │ ├── plugin.json
│ │ ├── CMakeLists.txt
│ │ ├── main.cpp
│ │ └── passthrucanbackend.h
│ │ ├── socketcan
│ │ ├── plugin.json
│ │ ├── CMakeLists.txt
│ │ ├── libsocketcan.h
│ │ └── main.cpp
│ │ ├── systeccan
│ │ ├── plugin.json
│ │ ├── CMakeLists.txt
│ │ ├── main.cpp
│ │ └── systeccanbackend.h
│ │ ├── vectorcan
│ │ ├── plugin.json
│ │ ├── CMakeLists.txt
│ │ ├── vectorcanbackend.h
│ │ └── main.cpp
│ │ ├── virtualcan
│ │ ├── plugin.json
│ │ ├── CMakeLists.txt
│ │ └── main.cpp
│ │ └── CMakeLists.txt
├── CMakeLists.txt
└── tools
│ ├── CMakeLists.txt
│ └── canbusutil
│ ├── sigtermhandler.h
│ ├── CMakeLists.txt
│ ├── sigtermhandler.cpp
│ ├── readtask.h
│ └── canbusutil.h
├── .tag
├── qt_cmdline.cmake
├── tests
├── auto
│ ├── plugins
│ │ ├── CMakeLists.txt
│ │ └── testcanbus
│ │ │ ├── plugin.json
│ │ │ ├── CMakeLists.txt
│ │ │ ├── testcanbackend.h
│ │ │ ├── main.cpp
│ │ │ └── testcanbackend.cpp
│ ├── qcandbcfileparser
│ │ ├── data
│ │ │ ├── invalid_messages.dbc
│ │ │ ├── different_endian.dbc
│ │ │ ├── valid_message_and_signals.dbc
│ │ │ ├── multiple_files_1.dbc
│ │ │ ├── invalid_signal_pos.dbc
│ │ │ ├── char_string_test.dbc
│ │ │ ├── multiple_receivers.dbc
│ │ │ ├── random_whitespaces.dbc
│ │ │ ├── message_signals_in_one_line.dbc
│ │ │ ├── different_data_types.dbc
│ │ │ ├── signal_names.dbc
│ │ │ ├── different_ranges.dbc
│ │ │ ├── different_factor_offset.dbc
│ │ │ ├── invalid_signals.dbc
│ │ │ ├── multiple_files_2.dbc
│ │ │ ├── simple_multiplexing.dbc
│ │ │ ├── messages_with_comments.dbc
│ │ │ ├── invalid_message_pos.dbc
│ │ │ └── value_descriptions.dbc
│ │ └── CMakeLists.txt
│ ├── qmodbusrtuserialclient
│ │ ├── CMakeLists.txt
│ │ └── tst_qmodbusrtuserialclient.cpp
│ ├── qcanframeprocessor
│ │ └── CMakeLists.txt
│ ├── qmodbuspdu
│ │ └── CMakeLists.txt
│ ├── qcanbusframe
│ │ └── CMakeLists.txt
│ ├── qmodbusreply
│ │ └── CMakeLists.txt
│ ├── qmodbusdevice
│ │ └── CMakeLists.txt
│ ├── qmodbusserver
│ │ └── CMakeLists.txt
│ ├── qmodbusdataunit
│ │ └── CMakeLists.txt
│ ├── qcansignaldescription
│ │ └── CMakeLists.txt
│ ├── qcanmessagedescription
│ │ └── CMakeLists.txt
│ ├── qmodbusadu
│ │ └── CMakeLists.txt
│ ├── qcanuniqueiddescription
│ │ └── CMakeLists.txt
│ ├── qmodbuscommevent
│ │ └── CMakeLists.txt
│ ├── qmodbusdeviceidentification
│ │ └── CMakeLists.txt
│ ├── qmodbusclient
│ │ └── CMakeLists.txt
│ ├── qcanbus
│ │ └── CMakeLists.txt
│ ├── qcanbusdevice
│ │ └── CMakeLists.txt
│ ├── shared
│ │ ├── qcanuniqueiddescription_helpers.h
│ │ └── qcanmessagedescription_helpers.h
│ ├── CMakeLists.txt
│ └── cmake
│ │ └── CMakeLists.txt
├── global
│ └── global.cfg
├── manual
│ ├── modbus
│ │ ├── CMakeLists.txt
│ │ └── adueditor
│ │ │ ├── main.cpp
│ │ │ ├── CMakeLists.txt
│ │ │ ├── modbustcpclient.h
│ │ │ ├── modbustcpclient.cpp
│ │ │ ├── mainwindow.h
│ │ │ └── plaintextedit.h
│ └── CMakeLists.txt
└── CMakeLists.txt
├── .gitreview
├── examples
├── serialbus
│ ├── can
│ │ ├── images
│ │ │ ├── clear.png
│ │ │ ├── connect.png
│ │ │ ├── disconnect.png
│ │ │ └── application-exit.png
│ │ ├── can.qrc
│ │ ├── common.h
│ │ ├── main.cpp
│ │ ├── receivedframesview.h
│ │ ├── canbusdeviceinfodialog.cpp
│ │ ├── canbusdeviceinfodialog.h
│ │ ├── canbusdeviceinfobox.h
│ │ ├── bitratebox.h
│ │ ├── can.pro
│ │ ├── sendframebox.h
│ │ ├── mainwindow.h
│ │ ├── receivedframesmodel.h
│ │ ├── connectdialog.h
│ │ ├── CMakeLists.txt
│ │ ├── canbusdeviceinfodialog.ui
│ │ └── bitratebox.cpp
│ ├── modbus
│ │ ├── modbus.pro
│ │ ├── client
│ │ │ ├── images
│ │ │ │ ├── connect.png
│ │ │ │ ├── disconnect.png
│ │ │ │ ├── settings.png
│ │ │ │ └── application-exit.png
│ │ │ ├── doc
│ │ │ │ └── images
│ │ │ │ │ └── modbusclient.png
│ │ │ ├── client.qrc
│ │ │ ├── client.pro
│ │ │ ├── main.cpp
│ │ │ ├── settingsdialog.h
│ │ │ ├── writeregistermodel.h
│ │ │ ├── mainwindow.h
│ │ │ ├── settingsdialog.cpp
│ │ │ └── CMakeLists.txt
│ │ ├── custom
│ │ │ ├── images
│ │ │ │ ├── connect.png
│ │ │ │ ├── disconnect.png
│ │ │ │ ├── settings.png
│ │ │ │ └── application-exit.png
│ │ │ ├── doc
│ │ │ │ └── images
│ │ │ │ │ └── custom.png
│ │ │ ├── images.qrc
│ │ │ ├── main.cpp
│ │ │ ├── custom.pro
│ │ │ ├── modbusserver.h
│ │ │ ├── modbusclient.h
│ │ │ ├── registermodel.h
│ │ │ ├── mainwindow.h
│ │ │ └── CMakeLists.txt
│ │ ├── server
│ │ │ ├── images
│ │ │ │ ├── connect.png
│ │ │ │ ├── disconnect.png
│ │ │ │ ├── settings.png
│ │ │ │ └── application-exit.png
│ │ │ ├── doc
│ │ │ │ └── images
│ │ │ │ │ └── modbusserver.png
│ │ │ ├── server.qrc
│ │ │ ├── main.cpp
│ │ │ ├── server.pro
│ │ │ ├── settingsdialog.h
│ │ │ ├── settingsdialog.cpp
│ │ │ ├── mainwindow.h
│ │ │ └── CMakeLists.txt
│ │ └── CMakeLists.txt
│ ├── serialbus.pro
│ └── CMakeLists.txt
├── examples.pro
└── CMakeLists.txt
├── dependencies.yaml
├── config.tests
├── socketcan
│ ├── main.cpp
│ └── CMakeLists.txt
└── socketcan_fd
│ ├── main.cpp
│ └── CMakeLists.txt
├── .cmake.conf
├── dist
├── REUSE.toml
├── changes-5.12.1
├── changes-5.13.1
├── changes-5.14.1
├── changes-5.15.1
├── changes-5.12.2
├── changes-5.12.3
├── changes-5.9.5
├── changes-5.11.1
├── changes-5.11.2
├── changes-5.14.2
├── changes-5.11.3
├── changes-5.13.2
├── changes-5.9.6
├── changes-5.12.5
├── changes-5.10.1
├── changes-5.12.4
├── changes-5.12.10
├── changes-5.7.0
├── changes-5.9.1
├── changes-5.9.2
├── changes-5.7.1
├── changes-5.6.3
├── changes-5.6.2
├── changes-5.9.4
├── changes-5.6.1
├── changes-5.9.3
├── changes-5.15.0
└── changes-5.13.0
├── LICENSES
├── LicenseRef-Qt-Commercial.txt
├── Qt-GPL-exception-1.0.txt
└── BSD-3-Clause.txt
├── coin
├── module_config.yaml
└── axivion
│ └── ci_config_linux.json
├── configure.cmake
└── CMakeLists.txt
/src/serialbus/qt_cmdline.cmake:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.tag:
--------------------------------------------------------------------------------
1 | b35a01d78d01b31b41fc8946d08dea92cdc87d54
2 |
--------------------------------------------------------------------------------
/src/plugins/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(canbus)
2 |
--------------------------------------------------------------------------------
/qt_cmdline.cmake:
--------------------------------------------------------------------------------
1 | qt_commandline_subconfig(src/serialbus)
2 |
--------------------------------------------------------------------------------
/tests/auto/plugins/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(testcanbus)
2 |
--------------------------------------------------------------------------------
/src/plugins/canbus/peakcan/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "Key": "peakcan"
3 | }
4 |
--------------------------------------------------------------------------------
/src/plugins/canbus/tinycan/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "Key": "tinycan"
3 | }
4 |
--------------------------------------------------------------------------------
/tests/auto/plugins/testcanbus/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "Key": "testcan"
3 | }
4 |
--------------------------------------------------------------------------------
/src/plugins/canbus/passthrucan/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "Key": "passthrucan"
3 | }
4 |
--------------------------------------------------------------------------------
/src/plugins/canbus/socketcan/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "Key": "socketcan"
3 | }
4 |
--------------------------------------------------------------------------------
/src/plugins/canbus/systeccan/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "Key": "systeccan"
3 | }
4 |
--------------------------------------------------------------------------------
/src/plugins/canbus/vectorcan/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "Key": "vectorcan"
3 | }
4 |
--------------------------------------------------------------------------------
/src/plugins/canbus/virtualcan/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "Key": "virtualcan"
3 | }
4 |
--------------------------------------------------------------------------------
/.gitreview:
--------------------------------------------------------------------------------
1 | [gerrit]
2 | host=codereview.qt-project.org
3 | project=qt/qtserialbus
4 | defaultbranch=dev
5 |
--------------------------------------------------------------------------------
/examples/serialbus/can/images/clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/can/images/clear.png
--------------------------------------------------------------------------------
/examples/serialbus/can/images/connect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/can/images/connect.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/modbus.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | SUBDIRS += \
4 | client \
5 | server \
6 | custom
7 |
--------------------------------------------------------------------------------
/src/serialbus/doc/images/can-example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/src/serialbus/doc/images/can-example.png
--------------------------------------------------------------------------------
/examples/serialbus/can/images/disconnect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/can/images/disconnect.png
--------------------------------------------------------------------------------
/tests/global/global.cfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/serialbus/doc/images/canbus_signals_be.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/src/serialbus/doc/images/canbus_signals_be.png
--------------------------------------------------------------------------------
/src/serialbus/doc/images/canbus_signals_le.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/src/serialbus/doc/images/canbus_signals_le.png
--------------------------------------------------------------------------------
/examples/examples.pro:
--------------------------------------------------------------------------------
1 | requires(qtHaveModule(widgets))
2 | requires(qtHaveModule(serialbus))
3 |
4 | TEMPLATE = subdirs
5 | SUBDIRS += serialbus
6 |
--------------------------------------------------------------------------------
/examples/serialbus/serialbus.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | qtHaveModule(widgets) {
4 | SUBDIRS += can \
5 | modbus
6 | }
7 |
--------------------------------------------------------------------------------
/examples/serialbus/can/images/application-exit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/can/images/application-exit.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/images/connect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/client/images/connect.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/images/connect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/custom/images/connect.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/images/connect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/server/images/connect.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/images/disconnect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/client/images/disconnect.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/images/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/client/images/settings.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/doc/images/custom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/custom/doc/images/custom.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/images/disconnect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/custom/images/disconnect.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/images/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/custom/images/settings.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/images/disconnect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/server/images/disconnect.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/images/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/server/images/settings.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/doc/images/modbusclient.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/client/doc/images/modbusclient.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/images/application-exit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/client/images/application-exit.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/images/application-exit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/custom/images/application-exit.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/doc/images/modbusserver.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/server/doc/images/modbusserver.png
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/images/application-exit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qt/qtserialbus/HEAD/examples/serialbus/modbus/server/images/application-exit.png
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/invalid_messages.dbc:
--------------------------------------------------------------------------------
1 | BO_ MessageName : 8 Vector__XXX
2 | BO_ 1234 : 8 Vector__XXX
3 | BO_ 1234 MessageName : Vector__XXX
4 | BO_ 1234 MessageName : 8
5 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/different_endian.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test : 3 Vector__XXX
2 | SG_ s0 : 0|12@1+ (1,0) [0|0] "unit" Vector__XXX
3 | SG_ s1 : 23|8@0+ (1,0) [0|0] "" Vector__XXX
4 |
--------------------------------------------------------------------------------
/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | add_subdirectory(serialbus)
5 | add_subdirectory(plugins)
6 | add_subdirectory(tools)
7 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/valid_message_and_signals.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test : 3 Vector__XXX
2 | SG_ s0 : 0|12@1+ (1,0) [0|0] "unit" Vector__XXX
3 | SG_ s1 : 12|12@1+ (1,0) [0|0] "unit1" Vector__XXX
4 |
--------------------------------------------------------------------------------
/tests/manual/modbus/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | if(QT_FEATURE_modbus_serialport)
5 | add_subdirectory(adueditor)
6 | endif()
7 |
--------------------------------------------------------------------------------
/tests/manual/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | if(TARGET Qt::Widgets AND TARGET Qt::SerialBus)
5 | add_subdirectory(modbus)
6 | endif()
7 |
--------------------------------------------------------------------------------
/dependencies.yaml:
--------------------------------------------------------------------------------
1 | dependencies:
2 | ../qtbase:
3 | ref: df1292e2b96aab02ad6df778d8336e7958ad5d1c
4 | required: true
5 | ../qtserialport:
6 | ref: 38edf821bfa509398941d543caf2e673e4541c94
7 | required: false
8 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/images.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | images/connect.png
4 | images/disconnect.png
5 | images/settings.png
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/multiple_files_1.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test : 4 Vector__XXX
2 | SG_ Signal0 : 0|32@1+ (1,0) [0|0] "unit" Vector__XXX
3 | SG_ Singal%1 : 0|8@1+ (1,0) [0|0] "unit" Vector__XXX
4 |
5 | SIG_VALTYPE_ 1234 Signal0: 1;
6 |
--------------------------------------------------------------------------------
/examples/serialbus/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | if(TARGET Qt::Widgets)
5 | qt_internal_add_example(can)
6 | add_subdirectory(modbus)
7 | endif()
8 |
--------------------------------------------------------------------------------
/config.tests/socketcan/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2015 The Qt Company Ltd.
2 | // SPDX-License-Identifier: BSD-3-Clause
3 | #include
4 | #include
5 |
6 | int main()
7 | {
8 | can_frame frame;
9 | return 0;
10 | }
11 |
12 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | qt_internal_add_example(client)
5 | qt_internal_add_example(server)
6 | qt_internal_add_example(custom)
7 |
--------------------------------------------------------------------------------
/.cmake.conf:
--------------------------------------------------------------------------------
1 | set(QT_REPO_MODULE_VERSION "6.12.0")
2 | set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
3 | set(QT_EXTRA_INTERNAL_TARGET_DEFINES
4 | "QT_NO_CONTEXTLESS_CONNECT=1"
5 | "QT_NO_FOREACH=1"
6 | "QT_NO_QASCONST=1"
7 | "QT_NO_URL_CAST_FROM_STRING=1"
8 | )
9 |
--------------------------------------------------------------------------------
/examples/serialbus/can/can.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | images/connect.png
4 | images/disconnect.png
5 | images/application-exit.png
6 | images/clear.png
7 |
8 |
9 |
--------------------------------------------------------------------------------
/dist/REUSE.toml:
--------------------------------------------------------------------------------
1 | version = 1
2 |
3 | [[annotations]]
4 | path = ["*"]
5 | precedence = "override"
6 | comment = "Licensed as documentation."
7 | SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd."
8 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"
9 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/client.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | images/application-exit.png
4 | images/connect.png
5 | images/disconnect.png
6 | images/settings.png
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/server.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | images/application-exit.png
4 | images/connect.png
5 | images/disconnect.png
6 | images/settings.png
7 |
8 |
9 |
--------------------------------------------------------------------------------
/tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | if(QT_BUILD_STANDALONE_TESTS)
5 | # Add qt_find_package calls for extra dependencies that need to be found when building
6 | # the standalone tests here.
7 | endif()
8 | qt_build_tests()
9 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/invalid_signal_pos.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test : 7 Vector__XXX
2 | SG_ s0 : 0|12@1+ (1,0) [0|0] "unit" Vector__XXX
3 | SG_ s1 : 12|12@1- (1,0) [0|0] "unit" Vector__XXX
4 |
5 | SIG_VALTYPE_ 1234 s1 : 0;
6 |
7 | SG_ s2 : 24|32@1- (1,0) [0|0] "unit" Vector__XXX
8 |
9 | SIG_VALTYPE_ 1234 s2: 1;
10 |
--------------------------------------------------------------------------------
/tests/auto/qmodbusrtuserialclient/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | qt_internal_add_test(tst_qmodbusrtuserialclient
5 | SOURCES
6 | tst_qmodbusrtuserialclient.cpp
7 | LIBRARIES
8 | Qt::Network
9 | Qt::SerialBus
10 | )
11 |
--------------------------------------------------------------------------------
/src/tools/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | if(android_app OR
5 | (QT_FEATURE_commandlineparser
6 | AND NOT ANDROID
7 | AND NOT UIKIT
8 | AND NOT WASM
9 | AND NOT rtems))
10 | add_subdirectory(canbusutil)
11 | endif()
12 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/char_string_test.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test : 8 Vector__XXX
2 | SG_ s0 : 0|8@1+ (1,0) [0|0] " !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~°" Vector__XXX
3 | SG_ s1 : 0|8@1+ (1,0) [0|0] "double quote: "" Vector__XXX
4 | SG_ s2 : 0|8@1+ (1,0) [0|0] "backslash: \" Vector__XXX
5 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/multiple_receivers.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test : 4 Vector__XXX
2 | SG_ s0 : 0|8@1+ (1,0) [0|0] "unit" Rcv_1
3 | SG_ s1 : 8|8@1+ (1,0) [0|0] "unit" Rcv2, otherRcv
4 | SG_ s2 : 16|8@1+ (1,0) [0|0] "unit" RCV_3 , other_RCV, one_moreRcv
5 | SG_ s3 : 24|8@1+ (1,0) [0|0] "unit" rcv4,otherRcv,yetAnotherRcv,one_more_rcv
6 |
--------------------------------------------------------------------------------
/tests/auto/qcanframeprocessor/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | qt_internal_add_test(tst_qcanframeprocessor
5 | SOURCES
6 | tst_qcanframeprocessor.cpp
7 | LIBRARIES
8 | Qt::Network
9 | Qt::SerialBus
10 | Qt::SerialBusPrivate
11 | )
12 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/random_whitespaces.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test:5 Vector__XXX
2 | SG_ s0 : 0 | 8 @ 1 + ( 1 , 0 ) [ 0 | 0 ] "unit" Vector__XXX
3 | SG_ s1:8|8@1+ (1,0) [0|0] "unit" Vector__XXX
4 | SG_ s2:16 | 8@1+ (1,0) [0|0] "unit" Vector__XXX
5 | SG_ s3 : 24|8 @ 1+ (1,0) [0|0] "unit" Vector__XXX
6 | SG_ s4 : 32|8@1 + (1,0) [0|0] "unit" Vector__XXX
7 |
--------------------------------------------------------------------------------
/config.tests/socketcan_fd/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2015 The Qt Company Ltd.
2 | // SPDX-License-Identifier: BSD-3-Clause
3 | #include
4 | #include
5 |
6 | int main()
7 | {
8 | canfd_frame frame;
9 | int fd_payload = CANFD_MAX_DLEN;
10 | fd_payload = CAN_RAW_FD_FRAMES;
11 | fd_payload = CANFD_MTU;
12 | return 0;
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/examples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | qt_examples_build_begin(EXTERNAL_BUILD)
5 |
6 | if(NOT TARGET Qt::Widgets)
7 | return()
8 | endif()
9 | if(NOT TARGET Qt::SerialBus)
10 | return()
11 | endif()
12 | add_subdirectory(serialbus)
13 |
14 | qt_examples_build_end()
15 |
--------------------------------------------------------------------------------
/tests/manual/modbus/adueditor/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 |
4 | #include "mainwindow.h"
5 |
6 | #include
7 |
8 | QT_USE_NAMESPACE
9 |
10 | int main(int argc, char *argv[])
11 | {
12 | QApplication a(argc, argv);
13 |
14 | MainWindow w;
15 | w.show();
16 |
17 | return a.exec();
18 | }
19 |
--------------------------------------------------------------------------------
/src/serialbus/doc/src/examples/qtserialbus-examples.qdoc:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3 |
4 | /*!
5 | \group qtserialbus-examples
6 | \title Qt SerialBus Examples
7 | \brief Examples for the Qt SerialBus module
8 | \ingroup qtserialbus
9 |
10 | These are the \l{Qt Serial Bus} examples.
11 |
12 | */
13 |
--------------------------------------------------------------------------------
/src/serialbus/qtserialbusglobal.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QTSERIALBUSGLOBAL_H
5 | #define QTSERIALBUSGLOBAL_H
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | #endif // QTSERIALBUSGLOBAL_H
12 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/message_signals_in_one_line.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test : 7 Vector__XXX SG_ s0 : 0|12@1+ (1,0) [0|0] "unit" Vector__XXX SG_ s1 : 12|12@1- (1,0) [0|0] "unit" Vector__XXX SG_ s2 : 24|32@1- (1,0) [0|0] "unit" Vector__XXX
2 |
3 | BO_ 2566844926 Test1: 8 Vector__XXX SG_ s3: 0|64@1+ (1,0) [0|0] "unit" Vector__XXX
4 |
5 | SIG_VALTYPE_ 1234 s1 : 0;
6 | SIG_VALTYPE_ 1234 s2 : 1 ;
7 | SIG_VALTYPE_ 2566844926 s3 : 2;
8 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/different_data_types.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test : 7 Vector__XXX
2 | SG_ s0 : 0|12@1+ (1,0) [0|0] "unit" Vector__XXX
3 | SG_ s1 : 12|12@1- (1,0) [0|0] "unit" Vector__XXX
4 | SG_ s2 : 24|32@1- (1,0) [0|0] "unit" Vector__XXX
5 |
6 | BO_ 2566844926 Test1: 8 Vector__XXX
7 | SG_ s3: 0|64@1+ (1,0) [0|0] "unit" Vector__XXX
8 |
9 | SIG_VALTYPE_ 1234 s1 : 0;
10 | SIG_VALTYPE_ 1234 s2: 1;
11 | SIG_VALTYPE_ 2566844926 s3:2 ;
12 |
--------------------------------------------------------------------------------
/src/serialbus/doc/src/external-resources.qdoc:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2022 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3 |
4 | /*!
5 | \externalpage https://docs.openvehicles.com/en/stable/components/vehicle_dbc/docs/dbc-primer.html
6 | \title OpenVehicles DBC Intro
7 | */
8 |
9 | /*!
10 | \externalpage https://www.csselectronics.com/pages/can-dbc-file-database-intro
11 | \title CSSElectronics DBC Intro
12 | */
13 |
--------------------------------------------------------------------------------
/tests/auto/qmodbuspdu/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## tst_qmodbuspdu Test:
6 | #####################################################################
7 |
8 | qt_internal_add_test(tst_qmodbuspdu
9 | SOURCES
10 | tst_qmodbuspdu.cpp
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | )
15 |
--------------------------------------------------------------------------------
/tests/auto/qcanbusframe/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## tst_qcanbusframe Test:
6 | #####################################################################
7 |
8 | qt_internal_add_test(tst_qcanbusframe
9 | SOURCES
10 | tst_qcanbusframe.cpp
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | )
15 |
--------------------------------------------------------------------------------
/tests/auto/qmodbusreply/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## tst_qmodbusreply Test:
6 | #####################################################################
7 |
8 | qt_internal_add_test(tst_qmodbusreply
9 | SOURCES
10 | tst_qmodbusreply.cpp
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | )
15 |
--------------------------------------------------------------------------------
/src/serialbus/doc/src/qtserialbus-module-use.qdocinc:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3 |
4 | //! [cmakebuild]
5 | \code
6 | find_package(Qt6 COMPONENTS SerialBus REQUIRED)
7 | target_link_libraries(mytarget PRIVATE Qt6::SerialBus)
8 | \endcode
9 | //! [cmakebuild]
10 |
11 | //! [qmakebuild]
12 | \code
13 | QT += serialbus
14 | \endcode
15 | //! [qmakebuild]
16 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/signal_names.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test : 3 Vector__XXX
2 | SG_ Signal0 : 0|8@1+ (1,0) [0|0] "unit" Vector__XXX
3 | SG_ _sIgnal_1 : 8|8@1+ (1,0) [0|0] "unit" Vector__XXX
4 | SG_ s_Ig_nAl2_ : 16|8@1+ (1,0) [0|0] "unit" Vector__XXX
5 | SG_ Singal%1 : 0|8@1+ (1,0) [0|0] "unit" Vector__XXX
6 | SG_ 1Signal : 0|8@1+ (1,0) [0|0] "unit" Vector__XXX
7 | SG_ Signal name : 0|8@1+ (1,0) [0|0] "unit" Vector__XXX
8 | SG_ "Signal name" : 0|8@1+ (1,0) [0|0] "unit" Vector__XXX
9 |
--------------------------------------------------------------------------------
/tests/auto/qmodbusdevice/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## tst_qmodbusdevice Test:
6 | #####################################################################
7 |
8 | qt_internal_add_test(tst_qmodbusdevice
9 | SOURCES
10 | tst_qmodbusdevice.cpp
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | )
15 |
--------------------------------------------------------------------------------
/tests/auto/qmodbusserver/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## tst_qmodbusserver Test:
6 | #####################################################################
7 |
8 | qt_internal_add_test(tst_qmodbusserver
9 | SOURCES
10 | tst_qmodbusserver.cpp
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | )
15 |
--------------------------------------------------------------------------------
/tests/auto/qmodbusdataunit/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## tst_qmodbusdataunit Test:
6 | #####################################################################
7 |
8 | qt_internal_add_test(tst_qmodbusdataunit
9 | SOURCES
10 | tst_qmodbusdataunit.cpp
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | )
15 |
--------------------------------------------------------------------------------
/tests/auto/qcansignaldescription/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | get_filename_component(SHARED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../shared ABSOLUTE)
5 |
6 | qt_internal_add_test(tst_qcansignaldescription
7 | SOURCES
8 | tst_qcansignaldescription.cpp
9 | INCLUDE_DIRECTORIES
10 | ${SHARED_DIR}
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | Qt::SerialBusPrivate
15 | )
16 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/different_ranges.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test : 7 Vector__XXX
2 | SG_ s0 : 0|8@1+ (1,0) [0.0|0] "unit" Vector__XXX
3 | SG_ s1 : 8|8@1+ (1,0) [1|5 ] "unit" Vector__XXX
4 | SG_ s2 : 16|8@1+ (1,0) [ -0.625|0.125] "unit" Vector__XXX
5 | SG_ s3 : 24|8@1+ (1,0) [-1.234e-05 |1.234e05] "unit" Vector__XXX
6 | SG_ s4 : 32|8@1+ (1,0) [-1 | 0.333] "unit" Vector__XXX
7 | SG_ s5 : 40|8@1+ (1,0) [ 2.5 | 1.000123e01] "unit" Vector__XXX
8 | SG_ s6 : 48|8@1+ (1,0) [ 0.333 | -0.333 ] "unit" Vector__XXX
9 |
--------------------------------------------------------------------------------
/tests/auto/qcanmessagedescription/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | get_filename_component(SHARED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../shared ABSOLUTE)
5 |
6 | qt_internal_add_test(tst_qcanmessagedescription
7 | SOURCES
8 | tst_qcanmessagedescription.cpp
9 | INCLUDE_DIRECTORIES
10 | ${SHARED_DIR}
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | Qt::SerialBusPrivate
15 | )
16 |
--------------------------------------------------------------------------------
/tests/auto/qmodbusadu/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## tst_qmodbusadu Test:
6 | #####################################################################
7 |
8 | qt_internal_add_test(tst_qmodbusadu
9 | SOURCES
10 | tst_qmodbusadu.cpp
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | Qt::SerialBusPrivate
15 | )
16 |
--------------------------------------------------------------------------------
/tests/auto/qcanuniqueiddescription/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | get_filename_component(SHARED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../shared ABSOLUTE)
5 |
6 | qt_internal_add_test(tst_qcanuniqueiddescription
7 | SOURCES
8 | tst_qcanuniqueiddescription.cpp
9 | INCLUDE_DIRECTORIES
10 | ${SHARED_DIR}
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | Qt::SerialBusPrivate
15 | )
16 |
--------------------------------------------------------------------------------
/LICENSES/LicenseRef-Qt-Commercial.txt:
--------------------------------------------------------------------------------
1 | Licensees holding valid commercial Qt licenses may use this software in
2 | accordance with the the terms contained in a written agreement between
3 | you and The Qt Company. Alternatively, the terms and conditions that were
4 | accepted by the licensee when buying and/or downloading the
5 | software do apply.
6 |
7 | For the latest licensing terms and conditions, see https://www.qt.io/terms-conditions.
8 | For further information use the contact form at https://www.qt.io/contact-us.
9 |
--------------------------------------------------------------------------------
/coin/module_config.yaml:
--------------------------------------------------------------------------------
1 | version: 2
2 | accept_configuration:
3 | condition: property
4 | property: features
5 | not_contains_value: Disable
6 |
7 | instructions:
8 | Build:
9 | - type: EnvironmentVariable
10 | variableName: VERIFY_SOURCE_SBOM
11 | variableValue: "ON"
12 | - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml"
13 |
14 | Test:
15 | - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml"
16 | - !include "{{qt/qtbase}}/coin_module_test_docs.yaml"
17 |
--------------------------------------------------------------------------------
/examples/serialbus/can/common.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 Evgeny Shtanov
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef COMMON_H
5 | #define COMMON_H
6 |
7 | #include
8 |
9 | enum ReceivedFramesModelColumns {
10 | Number = 0,
11 | Timestamp,
12 | Flags,
13 | CanID,
14 | DLC,
15 | Data,
16 | Count
17 | };
18 |
19 | enum : int {
20 | ClipboardTextRole = Qt::UserRole + 1
21 | };
22 |
23 | #endif // COMMON_H
24 |
--------------------------------------------------------------------------------
/examples/serialbus/can/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #include "mainwindow.h"
5 |
6 | #include
7 | #include
8 |
9 | using namespace Qt::StringLiterals;
10 |
11 | int main(int argc, char *argv[])
12 | {
13 | QLoggingCategory::setFilterRules(u"qt.canbus* = true"_s);
14 | QApplication a(argc, argv);
15 | MainWindow w;
16 | w.show();
17 |
18 | return a.exec();
19 | }
20 |
--------------------------------------------------------------------------------
/tests/auto/qmodbuscommevent/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## tst_qmodbuscommevent Test:
6 | #####################################################################
7 |
8 | qt_internal_add_test(tst_qmodbuscommevent
9 | SOURCES
10 | tst_qmodbuscommevent.cpp
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | Qt::SerialBusPrivate
15 | )
16 |
--------------------------------------------------------------------------------
/tests/auto/qmodbusdeviceidentification/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## tst_qmodbusdeviceidentification Test:
6 | #####################################################################
7 |
8 | qt_internal_add_test(tst_qmodbusdeviceidentification
9 | SOURCES
10 | tst_qmodbusdeviceidentification.cpp
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | )
15 |
--------------------------------------------------------------------------------
/configure.cmake:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 |
5 |
6 | #### Inputs
7 |
8 |
9 |
10 | #### Libraries
11 |
12 |
13 |
14 | #### Tests
15 |
16 |
17 |
18 | #### Features
19 |
20 |
21 | qt_extra_definition("QT_VERSION_STR" "\"${PROJECT_VERSION}\"" PUBLIC)
22 | qt_extra_definition("QT_VERSION_MAJOR" ${PROJECT_VERSION_MAJOR} PUBLIC)
23 | qt_extra_definition("QT_VERSION_MINOR" ${PROJECT_VERSION_MINOR} PUBLIC)
24 | qt_extra_definition("QT_VERSION_PATCH" ${PROJECT_VERSION_PATCH} PUBLIC)
25 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #include "mainwindow.h"
5 |
6 | #include
7 | #include
8 |
9 | int main(int argc, char *argv[])
10 | {
11 | // Uncomment the following line to enable logging
12 | // QLoggingCategory::setFilterRules(QStringLiteral("qt.modbus* = true"));
13 | QApplication a(argc, argv);
14 | MainWindow w;
15 | w.show();
16 |
17 | return a.exec();
18 | }
19 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #include "mainwindow.h"
5 |
6 | #include
7 | #include
8 |
9 | int main(int argc, char *argv[])
10 | {
11 | // Uncomment the following line to enable logging
12 | // QLoggingCategory::setFilterRules(QStringLiteral("qt.modbus* = true"));
13 |
14 | QApplication a(argc, argv);
15 | MainWindow w;
16 | w.show();
17 |
18 | return a.exec();
19 | }
20 |
--------------------------------------------------------------------------------
/src/plugins/canbus/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | add_subdirectory(virtualcan)
5 | if(QT_FEATURE_socketcan)
6 | add_subdirectory(socketcan)
7 | endif()
8 | if(QT_FEATURE_library)
9 | add_subdirectory(passthrucan)
10 | add_subdirectory(peakcan)
11 | add_subdirectory(tinycan)
12 | endif()
13 | if(QT_FEATURE_library AND WIN32)
14 | add_subdirectory(systeccan)
15 | endif()
16 | if(QT_FEATURE_library AND WIN32 AND NOT WINRT)
17 | add_subdirectory(vectorcan)
18 | endif()
19 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/custom.pro:
--------------------------------------------------------------------------------
1 | QT += serialbus widgets
2 |
3 | TARGET = customcommand
4 | TEMPLATE = app
5 | CONFIG += c++11
6 |
7 | SOURCES += main.cpp \
8 | mainwindow.cpp \
9 | modbusclient.cpp \
10 | modbusserver.cpp \
11 | registermodel.cpp
12 |
13 | HEADERS += \
14 | mainwindow.h \
15 | modbusclient.h \
16 | modbusserver.h \
17 | registermodel.h
18 |
19 | FORMS += \
20 | mainwindow.ui
21 |
22 | RESOURCES += images.qrc
23 |
24 | target.path = $$[QT_INSTALL_EXAMPLES]/serialbus/modbus/custom
25 | INSTALLS += target
26 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/different_factor_offset.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 Test : 8 Vector__XXX
2 | SG_ s0 : 0|8@1+ (0.0,0) [0|0] "unit" Vector__XXX
3 | SG_ s1 : 8|8@1+ (1,-5 ) [0|0] "unit" Vector__XXX
4 | SG_ s2 : 16|8@1+ ( 0.625,-5.567) [0|0] "unit" Vector__XXX
5 | SG_ s3 : 24|8@1+ (1.234e-05 ,-1.056E02) [0|0] "unit" Vector__XXX
6 | SG_ s4 : 32|8@1+ (0.625 , -5) [0|0] "unit" Vector__XXX
7 | SG_ s5 : 40|8@1+ ( 2.5 , 1.000123e01 ) [0|0] "unit" Vector__XXX
8 | SG_ s6 : 48|8@1+ ( 2e-003 , 1E02 ) [0|0] "unit" Vector__XXX
9 | SG_ s7 : 56|8@1+ (1.e4, 2.E-02) [0|0] "unit" Vector__XXX
10 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/server.pro:
--------------------------------------------------------------------------------
1 | QT += serialbus widgets
2 | requires(qtConfig(combobox))
3 |
4 | qtConfig(modbus-serialport): QT += serialport
5 |
6 | TARGET = modbusserver
7 | TEMPLATE = app
8 | CONFIG += c++11
9 |
10 | SOURCES += \
11 | main.cpp \
12 | mainwindow.cpp \
13 | settingsdialog.cpp
14 |
15 | HEADERS += \
16 | mainwindow.h \
17 | settingsdialog.h
18 |
19 | FORMS += \
20 | mainwindow.ui \
21 | settingsdialog.ui
22 |
23 | RESOURCES += server.qrc
24 |
25 | target.path = $$[QT_INSTALL_EXAMPLES]/serialbus/modbus/server
26 | INSTALLS += target
27 |
--------------------------------------------------------------------------------
/src/plugins/canbus/virtualcan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## VirtualCanBusPlugin Plugin:
6 | #####################################################################
7 |
8 | qt_internal_add_plugin(VirtualCanBusPlugin
9 | OUTPUT_NAME qtvirtualcanbus
10 | PLUGIN_TYPE canbus
11 | SOURCES
12 | main.cpp
13 | virtualcanbackend.cpp virtualcanbackend.h
14 | LIBRARIES
15 | Qt::Core
16 | Qt::Network
17 | Qt::SerialBus
18 | )
19 |
--------------------------------------------------------------------------------
/tests/auto/qmodbusclient/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | if(NOT QT_FEATURE_private_tests)
5 | return()
6 | endif()
7 |
8 | #####################################################################
9 | ## tst_qmodbusclient Test:
10 | #####################################################################
11 |
12 | qt_internal_add_test(tst_qmodbusclient
13 | SOURCES
14 | tst_qmodbusclient.cpp
15 | LIBRARIES
16 | Qt::CorePrivate
17 | Qt::Network
18 | Qt::SerialBus
19 | Qt::SerialBusPrivate
20 | )
21 |
22 |
--------------------------------------------------------------------------------
/examples/serialbus/can/receivedframesview.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 Evgeny Shtanov
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef RECEIVEDFRAMESVIEW_H
5 | #define RECEIVEDFRAMESVIEW_H
6 |
7 | #include
8 |
9 | class ReceivedFramesView final: public QTableView
10 | {
11 | public:
12 | explicit ReceivedFramesView(QWidget *parent = nullptr);
13 | void setModel(QAbstractItemModel *model) final;
14 |
15 | protected:
16 | void keyPressEvent(QKeyEvent *event) final;
17 | void copyRow();
18 | };
19 |
20 | #endif // RECEIVEDFRAMESVIEW_H
21 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/modbusserver.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #include
5 |
6 | #ifndef MODBUSSERVER_H
7 | #define MODBUSSERVER_H
8 |
9 | //! [custom_server]
10 | class ModbusServer : public QModbusTcpServer
11 | {
12 | Q_OBJECT
13 | Q_DISABLE_COPY_MOVE(ModbusServer)
14 |
15 | public:
16 | ModbusServer(QObject *parent = nullptr);
17 |
18 | private:
19 | QModbusResponse processPrivateRequest(const QModbusPdu &request) override;
20 | };
21 | //! [custom_server]
22 |
23 | #endif // MODBUSSERVER_H
24 |
--------------------------------------------------------------------------------
/src/tools/canbusutil/sigtermhandler.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3 |
4 | #ifndef SIGTERMHANDLER_H
5 | #define SIGTERMHANDLER_H
6 |
7 | #include
8 |
9 | class SigTermHandler : public QObject
10 | {
11 | Q_OBJECT
12 | public:
13 | static SigTermHandler *instance();
14 | static void handle(int s);
15 |
16 | virtual ~SigTermHandler();
17 | signals:
18 | void sigTermSignal();
19 |
20 | private:
21 | explicit SigTermHandler(QObject *parent = nullptr);
22 | };
23 |
24 | #endif // SIGTERMHANDLER_H
25 |
--------------------------------------------------------------------------------
/tests/auto/plugins/testcanbus/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## TestCanBusPlugin Plugin:
6 | #####################################################################
7 |
8 | qt_internal_add_plugin(TestCanBusPlugin
9 | OUTPUT_NAME qttestcanbus
10 | PLUGIN_TYPE canbus
11 | DEFAULT_IF FALSE
12 | STATIC
13 | SOURCES
14 | testcanbackend.cpp testcanbackend.h
15 | main.cpp
16 | LIBRARIES
17 | Qt::Core
18 | Qt::Network
19 | Qt::SerialBus
20 | )
21 |
--------------------------------------------------------------------------------
/src/plugins/canbus/peakcan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## PeakCanBusPlugin Plugin:
6 | #####################################################################
7 |
8 | qt_internal_add_plugin(PeakCanBusPlugin
9 | OUTPUT_NAME qtpeakcanbus
10 | PLUGIN_TYPE canbus
11 | SOURCES
12 | main.cpp
13 | peakcan_symbols_p.h
14 | peakcanbackend.cpp peakcanbackend.h peakcanbackend_p.h
15 | LIBRARIES
16 | Qt::Core
17 | Qt::Network
18 | Qt::SerialBus
19 | )
20 |
--------------------------------------------------------------------------------
/src/plugins/canbus/tinycan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## TinyCanBusPlugin Plugin:
6 | #####################################################################
7 |
8 | qt_internal_add_plugin(TinyCanBusPlugin
9 | OUTPUT_NAME qttinycanbus
10 | PLUGIN_TYPE canbus
11 | SOURCES
12 | main.cpp
13 | tinycan_symbols_p.h
14 | tinycanbackend.cpp tinycanbackend.h tinycanbackend_p.h
15 | LIBRARIES
16 | Qt::Core
17 | Qt::Network
18 | Qt::SerialBus
19 | )
20 |
--------------------------------------------------------------------------------
/tests/auto/qcanbus/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## tst_qcanbus Test:
6 | #####################################################################
7 |
8 | qt_internal_add_test(tst_qcanbus
9 | SOURCES
10 | tst_qcanbus.cpp
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | )
15 |
16 | # should be
17 | # qt6_import_plugins(tst_qcanbus INCLUDE TestCanBusPlugin)
18 | # but qt6_import_plugins does not work here
19 | target_link_libraries(tst_qcanbus PRIVATE TestCanBusPlugin)
20 |
--------------------------------------------------------------------------------
/src/plugins/canbus/socketcan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## SocketCanBusPlugin Plugin:
6 | #####################################################################
7 |
8 | qt_internal_add_plugin(SocketCanBusPlugin
9 | OUTPUT_NAME qtsocketcanbus
10 | PLUGIN_TYPE canbus
11 | SOURCES
12 | libsocketcan.cpp libsocketcan.h
13 | main.cpp
14 | socketcanbackend.cpp socketcanbackend.h
15 | LIBRARIES
16 | Qt::Core
17 | Qt::Network
18 | Qt::SerialBus
19 | )
20 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/client.pro:
--------------------------------------------------------------------------------
1 | QT += serialbus widgets
2 | requires(qtConfig(combobox))
3 |
4 | qtConfig(modbus-serialport): QT += serialport
5 |
6 | TARGET = modbusclient
7 | TEMPLATE = app
8 | CONFIG += c++11
9 |
10 | SOURCES += \
11 | main.cpp\
12 | mainwindow.cpp \
13 | settingsdialog.cpp \
14 | writeregistermodel.cpp
15 |
16 | HEADERS += \
17 | mainwindow.h \
18 | settingsdialog.h \
19 | writeregistermodel.h
20 |
21 | FORMS += \
22 | mainwindow.ui \
23 | settingsdialog.ui
24 |
25 | RESOURCES += \
26 | client.qrc
27 |
28 | target.path = $$[QT_INSTALL_EXAMPLES]/serialbus/modbus/client
29 | INSTALLS += target
30 |
--------------------------------------------------------------------------------
/src/plugins/canbus/systeccan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## SystecCanBusPlugin Plugin:
6 | #####################################################################
7 |
8 | qt_internal_add_plugin(SystecCanBusPlugin
9 | OUTPUT_NAME qtsysteccanbus
10 | PLUGIN_TYPE canbus
11 | SOURCES
12 | main.cpp
13 | systeccan_symbols_p.h
14 | systeccanbackend.cpp systeccanbackend.h systeccanbackend_p.h
15 | LIBRARIES
16 | Qt::Core
17 | Qt::Network
18 | Qt::SerialBus
19 | )
20 |
--------------------------------------------------------------------------------
/src/plugins/canbus/vectorcan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## VectorCanBusPlugin Plugin:
6 | #####################################################################
7 |
8 | qt_internal_add_plugin(VectorCanBusPlugin
9 | OUTPUT_NAME qtvectorcanbus
10 | PLUGIN_TYPE canbus
11 | SOURCES
12 | main.cpp
13 | vectorcan_symbols_p.h
14 | vectorcanbackend.cpp vectorcanbackend.h vectorcanbackend_p.h
15 | LIBRARIES
16 | Qt::Core
17 | Qt::Network
18 | Qt::SerialBus
19 | )
20 |
--------------------------------------------------------------------------------
/tests/manual/modbus/adueditor/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | qt_internal_add_manual_test(adueditor
5 | GUI
6 | SOURCES
7 | interface.ui
8 | main.cpp
9 | mainwindow.cpp mainwindow.h
10 | modbustcpclient.cpp modbustcpclient.h modbustcpclient_p.h
11 | plaintextedit.h
12 | LIBRARIES
13 | Qt::Core
14 | Qt::CorePrivate
15 | Qt::Gui
16 | Qt::Network
17 | Qt::SerialBus
18 | Qt::SerialBusPrivate
19 | Qt::SerialPort
20 | Qt::Widgets
21 | ENABLE_AUTOGEN_TOOLS
22 | uic
23 | )
24 |
--------------------------------------------------------------------------------
/src/tools/canbusutil/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## canbusutil Tool:
6 | #####################################################################
7 |
8 | qt_internal_add_app(canbusutil
9 | TARGET_DESCRIPTION "Qt CAN Bus Util"
10 | SOURCES
11 | canbusutil.cpp canbusutil.h
12 | main.cpp
13 | readtask.cpp readtask.h
14 | sigtermhandler.cpp sigtermhandler.h
15 | LIBRARIES
16 | Qt::Network
17 | Qt::SerialBus
18 | )
19 | set_target_properties(canbusutil PROPERTIES WIN32_EXECUTABLE FALSE)
20 |
--------------------------------------------------------------------------------
/tests/auto/qcanbusdevice/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## tst_qcanbusdevice Test:
6 | #####################################################################
7 |
8 | qt_internal_add_test(tst_qcanbusdevice
9 | SOURCES
10 | tst_qcanbusdevice.cpp
11 | LIBRARIES
12 | Qt::Network
13 | Qt::SerialBus
14 | )
15 |
16 | # should be
17 | # qt6_import_plugins(tst_qcanbusdevice INCLUDE TestCanBusPlugin)
18 | # but qt6_import_plugins does not work here
19 | target_link_libraries(tst_qcanbusdevice PRIVATE TestCanBusPlugin)
20 |
--------------------------------------------------------------------------------
/src/plugins/canbus/passthrucan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | #####################################################################
5 | ## PassThruCanBusPlugin Plugin:
6 | #####################################################################
7 |
8 | qt_internal_add_plugin(PassThruCanBusPlugin
9 | OUTPUT_NAME qtpassthrucanbus
10 | PLUGIN_TYPE canbus
11 | SOURCES
12 | j2534passthru.cpp j2534passthru.h
13 | main.cpp
14 | passthrucanbackend.cpp passthrucanbackend.h
15 | passthrucanio.cpp passthrucanio.h
16 | LIBRARIES
17 | Qt::Network
18 | Qt::SerialBus
19 | )
20 |
--------------------------------------------------------------------------------
/src/tools/canbusutil/sigtermhandler.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3 |
4 | #include "sigtermhandler.h"
5 |
6 | #include
7 |
8 | SigTermHandler *SigTermHandler::instance()
9 | {
10 | static auto inst = new SigTermHandler();
11 | return inst;
12 | }
13 |
14 | void SigTermHandler::handle(int s)
15 | {
16 | QTextStream out(stdout);
17 | out << " Caught signal " << s << Qt::endl;
18 | emit instance()->sigTermSignal();
19 | }
20 |
21 | SigTermHandler::~SigTermHandler() { }
22 |
23 | SigTermHandler::SigTermHandler(QObject *parent) : QObject(parent) { }
24 |
--------------------------------------------------------------------------------
/examples/serialbus/can/canbusdeviceinfodialog.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #include "canbusdeviceinfodialog.h"
5 | #include "ui_canbusdeviceinfodialog.h"
6 |
7 | #include
8 |
9 | CanBusDeviceInfoDialog::CanBusDeviceInfoDialog(const QCanBusDeviceInfo &info, QWidget *parent) :
10 | QDialog(parent),
11 | m_ui(new Ui::CanBusDeviceInfoDialog)
12 | {
13 | m_ui->setupUi(this);
14 | m_ui->deviceInfoBox->setDeviceInfo(info);
15 |
16 | connect(m_ui->okButton, &QPushButton::pressed, this, &QDialog::close);
17 | }
18 |
19 | CanBusDeviceInfoDialog::~CanBusDeviceInfoDialog()
20 | {
21 | delete m_ui;
22 | }
23 |
--------------------------------------------------------------------------------
/tests/auto/shared/qcanuniqueiddescription_helpers.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2023 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 |
4 | #ifndef QCANUNIQUEIDDESCRIPTION_HELPERS_H
5 | #define QCANUNIQUEIDDESCRIPTION_HELPERS_H
6 |
7 | #include
8 |
9 | QT_BEGIN_NAMESPACE
10 |
11 | inline bool equals(const QCanUniqueIdDescription &lhs, const QCanUniqueIdDescription &rhs) noexcept
12 | {
13 | return lhs.source() == rhs.source()
14 | && lhs.startBit() == rhs.startBit()
15 | && lhs.bitLength() == rhs.bitLength()
16 | && lhs.endian() == rhs.endian();
17 | }
18 |
19 | QT_END_NAMESPACE
20 |
21 | #endif // QCANUNIQUEIDDESCRIPTION_HELPERS_H
22 |
--------------------------------------------------------------------------------
/tests/manual/modbus/adueditor/modbustcpclient.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 |
4 | #ifndef MODBUSTCPCLIENT_H
5 | #define MODBUSTCPCLIENT_H
6 |
7 | #include
8 |
9 | QT_USE_NAMESPACE
10 |
11 | class ModbusTcpClientPrivate;
12 | class ModbusTcpClient : public QModbusTcpClient
13 | {
14 | Q_OBJECT
15 | Q_DISABLE_COPY(ModbusTcpClient)
16 | Q_DECLARE_PRIVATE(ModbusTcpClient)
17 |
18 | public:
19 | ModbusTcpClient(QObject *parent = nullptr);
20 |
21 | public slots:
22 | void valueChanged(int value);
23 |
24 | private:
25 | ModbusTcpClient(ModbusTcpClientPrivate &dd, QObject *parent = nullptr);
26 | };
27 |
28 | #endif // MODBUSTCPCLIENT_H
29 |
--------------------------------------------------------------------------------
/examples/serialbus/can/canbusdeviceinfodialog.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef CANBUSDEVICEINFODIALOG_H
5 | #define CANBUSDEVICEINFODIALOG_H
6 |
7 | #include
8 |
9 | QT_BEGIN_NAMESPACE
10 |
11 | class QCanBusDeviceInfo;
12 |
13 | namespace Ui {
14 | class CanBusDeviceInfoDialog;
15 | }
16 |
17 | QT_END_NAMESPACE
18 |
19 | class CanBusDeviceInfoDialog : public QDialog
20 | {
21 | Q_OBJECT
22 |
23 | public:
24 | explicit CanBusDeviceInfoDialog(const QCanBusDeviceInfo &info, QWidget *parent = nullptr);
25 | ~CanBusDeviceInfoDialog();
26 |
27 | private:
28 | Ui::CanBusDeviceInfoDialog *m_ui = nullptr;
29 | };
30 |
31 | #endif // CANBUSDEVICEINFODIALOG_H
32 |
--------------------------------------------------------------------------------
/examples/serialbus/can/canbusdeviceinfobox.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef CANBUSDEVICEINFOBOX_H
5 | #define CANBUSDEVICEINFOBOX_H
6 |
7 | #include
8 |
9 | QT_BEGIN_NAMESPACE
10 |
11 | class QCanBusDeviceInfo;
12 |
13 | namespace Ui {
14 | class CanBusDeviceInfoBox;
15 | }
16 |
17 | QT_END_NAMESPACE
18 |
19 | class CanBusDeviceInfoBox : public QGroupBox
20 | {
21 | Q_OBJECT
22 |
23 | public:
24 | explicit CanBusDeviceInfoBox(QWidget *parent = nullptr);
25 | ~CanBusDeviceInfoBox();
26 | void clear();
27 | void setDeviceInfo(const QCanBusDeviceInfo &info);
28 |
29 | private:
30 | Ui::CanBusDeviceInfoBox *m_ui = nullptr;
31 | };
32 |
33 | #endif // CANBUSDEVICEINFOBOX_H
34 |
--------------------------------------------------------------------------------
/dist/changes-5.12.1:
--------------------------------------------------------------------------------
1 | Qt 5.12.1 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.12.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.12 series is binary compatible with the 5.11.x series.
10 | Applications compiled for 5.11 will continue to run with 5.12.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | - This release contains only minor code improvements.
21 |
--------------------------------------------------------------------------------
/dist/changes-5.13.1:
--------------------------------------------------------------------------------
1 | Qt 5.13.1 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.13.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | https://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.13 series is binary compatible with the 5.12.x series.
10 | Applications compiled for 5.12 will continue to run with 5.13.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | - This release contains only minor code improvements.
21 |
--------------------------------------------------------------------------------
/dist/changes-5.14.1:
--------------------------------------------------------------------------------
1 | Qt 5.14.1 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.14.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | https://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.14 series is binary compatible with the 5.13.x series.
10 | Applications compiled for 5.13 will continue to run with 5.14.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | - This release contains only minor code improvements.
21 |
--------------------------------------------------------------------------------
/dist/changes-5.15.1:
--------------------------------------------------------------------------------
1 | Qt 5.15.1 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.15.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | https://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.15 series is binary compatible with the 5.14.x series.
10 | Applications compiled for 5.14 will continue to run with 5.15.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | - This release contains only minor code improvements.
21 |
--------------------------------------------------------------------------------
/dist/changes-5.12.2:
--------------------------------------------------------------------------------
1 | Qt 5.12.2 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.12.0 through 5.12.1.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | https://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.12 series is binary compatible with the 5.11.x series.
10 | Applications compiled for 5.11 will continue to run with 5.12.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | - This release contains only minor code improvements.
21 |
--------------------------------------------------------------------------------
/dist/changes-5.12.3:
--------------------------------------------------------------------------------
1 | Qt 5.12.3 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.12.0 through 5.12.2.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | https://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.12 series is binary compatible with the 5.11.x series.
10 | Applications compiled for 5.11 will continue to run with 5.12.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | - This release contains only minor code improvements.
21 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/modbusclient.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #include
5 |
6 | #ifndef MODBUSCLIENT_H
7 | #define MODBUSCLIENT_H
8 |
9 | //! [custom_client]
10 | class ModbusClient : public QModbusTcpClient
11 | {
12 | Q_OBJECT
13 | Q_DISABLE_COPY_MOVE(ModbusClient)
14 |
15 | public:
16 | ModbusClient(QObject *parent = nullptr);
17 |
18 | static constexpr QModbusPdu::FunctionCode CustomRead {QModbusPdu::FunctionCode(0x41)};
19 | static constexpr QModbusPdu::FunctionCode CustomWrite {QModbusPdu::FunctionCode(0x42)};
20 |
21 | private:
22 | bool processPrivateResponse(const QModbusResponse &response, QModbusDataUnit *data) override;
23 | };
24 | //! [custom_client]
25 |
26 | #endif // MODBUSCLIENT_H
27 |
--------------------------------------------------------------------------------
/src/serialbus/qmodbustcpclient.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QMODBUSTCPCLIENT_H
5 | #define QMODBUSTCPCLIENT_H
6 |
7 | #include
8 |
9 | QT_BEGIN_NAMESPACE
10 |
11 | class QModbusTcpClientPrivate;
12 |
13 | class Q_SERIALBUS_EXPORT QModbusTcpClient : public QModbusClient
14 | {
15 | Q_OBJECT
16 | Q_DECLARE_PRIVATE(QModbusTcpClient)
17 |
18 | public:
19 | explicit QModbusTcpClient(QObject *parent = nullptr);
20 | ~QModbusTcpClient();
21 |
22 | protected:
23 | QModbusTcpClient(QModbusTcpClientPrivate &dd, QObject *parent = nullptr);
24 |
25 | bool open() override;
26 | void close() override;
27 | };
28 |
29 | QT_END_NAMESPACE
30 |
31 | #endif // QMODBUSTCPCLIENT_H
32 |
--------------------------------------------------------------------------------
/tests/auto/plugins/testcanbus/testcanbackend.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 |
4 | #ifndef TESTCANBACKEND_H
5 | #define TESTCANBACKEND_H
6 |
7 | #include
8 |
9 | QT_BEGIN_NAMESPACE
10 |
11 | class QTimer;
12 |
13 | class TestCanBackend : public QCanBusDevice
14 | {
15 | Q_OBJECT
16 | public:
17 | explicit TestCanBackend();
18 |
19 | bool open() override;
20 | void close() override;
21 |
22 | bool writeFrame(const QCanBusFrame &data) override;
23 |
24 | QString interpretErrorFrame(const QCanBusFrame &) override;
25 |
26 | static QList interfaces();
27 |
28 | private:
29 | QTimer *simulateReceivingTimer = nullptr;
30 | };
31 |
32 | QT_END_NAMESPACE
33 |
34 | #endif // TESTCANBACKEND_H
35 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/invalid_signals.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1234 MessageName : 8 Vector__XXX
2 | SG_ : 0|8@1+ (1,0) [0|0] "unit" Vector__XXX
3 | SG_ SignalName 0|8@1+ (1,0) [0|0] "unit" Vector__XXX
4 | SG_ SignalName : |8@1+ (1,0) [0|0] "unit" Vector__XXX
5 | SG_ SignalName : 08@1+ (1,0) [0|0] "unit" Vector__XXX
6 | SG_ SignalName : 0|@1+ (1,0) [0|0] "unit" Vector__XXX
7 | SG_ SignalName : 0|81+ (1,0) [0|0] "unit" Vector__XXX
8 | SG_ SignalName : 0|8@+ (1,0) [0|0] "unit" Vector__XXX
9 | SG_ SignalName : 0|8@1 (1,0) [0|0] "unit" Vector__XXX
10 | SG_ SignalName : 0|8@1+ [0|0] "unit" Vector__XXX
11 | SG_ SignalName : 0|8@1+ (0) [0|0] "unit" Vector__XXX
12 | SG_ SignalName : 0|8@1+ (1,0) "unit" Vector__XXX
13 | SG_ SignalName : 0|8@1+ (1,0) [0] "unit" Vector__XXX
14 | SG_ SignalName : 0|8@1+ (1,0) [0|0] Vector__XXX
15 | SG_ SignalName : 0|8@1+ (1,0) [0|0] "unit"
16 |
--------------------------------------------------------------------------------
/src/tools/canbusutil/readtask.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3 |
4 | #ifndef READTASK_H
5 | #define READTASK_H
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | class ReadTask : public QObject
12 | {
13 | Q_OBJECT
14 | public:
15 | explicit ReadTask(QTextStream &m_output, QObject *parent = nullptr);
16 | void setShowTimeStamp(bool showStamp);
17 | bool isShowFlags() const;
18 | void setShowFlags(bool isShowFlags);
19 |
20 | public slots:
21 | void handleFrames();
22 | void handleError(QCanBusDevice::CanBusError /*error*/);
23 |
24 | private:
25 | QTextStream &m_output;
26 | bool m_showTimeStamp = false;
27 | bool m_showFlags = false;
28 | };
29 |
30 | #endif // READTASK_H
31 |
--------------------------------------------------------------------------------
/examples/serialbus/can/bitratebox.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef BITRATEBOX_H
5 | #define BITRATEBOX_H
6 |
7 | #include
8 |
9 | QT_BEGIN_NAMESPACE
10 | class QIntValidator;
11 | QT_END_NAMESPACE
12 |
13 | class BitRateBox : public QComboBox
14 | {
15 | public:
16 | explicit BitRateBox(QWidget *parent = nullptr);
17 | ~BitRateBox();
18 |
19 | int bitRate() const;
20 |
21 | bool isFlexibleDataRateEnabled() const;
22 | void setFlexibleDateRateEnabled(bool enabled);
23 |
24 | private slots:
25 | void checkCustomSpeedPolicy(int idx);
26 |
27 | private:
28 | void fillBitRates();
29 |
30 | bool m_isFlexibleDataRateEnabled = false;
31 | QIntValidator *m_customSpeedValidator = nullptr;
32 | };
33 |
34 | #endif // BITRATEBOX_H
35 |
--------------------------------------------------------------------------------
/src/serialbus/doc/src/qtserialbus-toc.qdoc:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2024 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3 |
4 | /*!
5 | \page qtserialbus-toc.html
6 | \title Qt Serial Bus module topics
7 |
8 | The following list has links to all the individual topics (HTML files)
9 | in the Qt Serial Bus module.
10 |
11 | \list
12 | \li \l {Qt CAN Bus}
13 | \list
14 | \li \l{Using SocketCAN Plugin}
15 | \li \l{Using PassThruCAN Plugin}
16 | \li \l{Using SystecCAN Plugin}
17 | \li \l{Using PeakCAN Plugin}
18 | \li \l{Using TinyCAN Plugin}
19 | \li \l{Using VectorCAN Plugin}
20 | \li \l{Using VirtualCAN Plugin}
21 | \endlist
22 | \li \l {Qt Modbus}
23 | \li \l {Changes to Qt SerialBus}{Updating to Qt 5}
24 | \endlist
25 |
26 | */
27 |
--------------------------------------------------------------------------------
/tests/auto/qmodbusrtuserialclient/tst_qmodbusrtuserialclient.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 |
4 | #include
5 |
6 | #include
7 |
8 | class tst_QModbusRtuSerialClient : public QObject
9 | {
10 | Q_OBJECT
11 |
12 | private slots:
13 | void testInterFrameDelay()
14 | {
15 | QModbusRtuSerialClient qmrsm;
16 | QCOMPARE(qmrsm.interFrameDelay(), 2000);
17 | qmrsm.setInterFrameDelay(1000);
18 | QCOMPARE(qmrsm.interFrameDelay(), 2000);
19 | qmrsm.setInterFrameDelay(3000);
20 | QCOMPARE(qmrsm.interFrameDelay(), 3000);
21 | qmrsm.setInterFrameDelay(-1);
22 | QCOMPARE(qmrsm.interFrameDelay(), 2000);
23 | }
24 | };
25 |
26 | QTEST_MAIN(tst_QModbusRtuSerialClient)
27 |
28 | #include "tst_qmodbusrtuserialclient.moc"
29 |
--------------------------------------------------------------------------------
/tests/auto/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | add_subdirectory(cmake)
5 | add_subdirectory(qcanbusframe)
6 | add_subdirectory(qcanbusdevice)
7 | add_subdirectory(qcandbcfileparser)
8 | add_subdirectory(qcanframeprocessor)
9 | add_subdirectory(qcanmessagedescription)
10 | add_subdirectory(qcansignaldescription)
11 | add_subdirectory(qcanuniqueiddescription)
12 | add_subdirectory(qmodbusdataunit)
13 | add_subdirectory(qmodbusreply)
14 | add_subdirectory(qmodbusdevice)
15 | add_subdirectory(qmodbuspdu)
16 | add_subdirectory(qmodbusclient)
17 | add_subdirectory(qmodbusserver)
18 | add_subdirectory(qmodbuscommevent)
19 | add_subdirectory(qmodbusadu)
20 | add_subdirectory(qmodbusdeviceidentification)
21 | add_subdirectory(plugins)
22 | if(QT_FEATURE_modbus_serialport)
23 | add_subdirectory(qmodbusrtuserialclient)
24 | endif()
25 | if(NOT ANDROID)
26 | add_subdirectory(qcanbus)
27 | endif()
28 |
--------------------------------------------------------------------------------
/examples/serialbus/can/can.pro:
--------------------------------------------------------------------------------
1 | QT += serialbus widgets
2 | requires(qtConfig(combobox))
3 |
4 | TARGET = can
5 | TEMPLATE = app
6 |
7 | SOURCES += \
8 | bitratebox.cpp \
9 | canbusdeviceinfobox.cpp \
10 | canbusdeviceinfodialog.cpp \
11 | connectdialog.cpp \
12 | main.cpp \
13 | mainwindow.cpp \
14 | receivedframesmodel.cpp \
15 | receivedframesview.cpp \
16 | sendframebox.cpp
17 |
18 | HEADERS += \
19 | bitratebox.h \
20 | canbusdeviceinfobox.h \
21 | canbusdeviceinfodialog.h \
22 | common.h \
23 | connectdialog.h \
24 | mainwindow.h \
25 | receivedframesmodel.h \
26 | receivedframesview.h \
27 | sendframebox.h
28 |
29 | FORMS += \
30 | canbusdeviceinfobox.ui \
31 | canbusdeviceinfodialog.ui \
32 | connectdialog.ui \
33 | mainwindow.ui \
34 | sendframebox.ui
35 |
36 | RESOURCES += can.qrc
37 |
38 | target.path = $$[QT_INSTALL_EXAMPLES]/serialbus/can
39 | INSTALLS += target
40 |
--------------------------------------------------------------------------------
/src/serialbus/qcanbusfactory.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QCANBUSFACTORY_H
5 | #define QCANBUSFACTORY_H
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | QT_BEGIN_NAMESPACE
13 |
14 | class Q_SERIALBUS_EXPORT QCanBusFactory
15 | {
16 | public:
17 | virtual QCanBusDevice *createDevice(const QString &interfaceName,
18 | QString *errorMessage) const = 0;
19 | virtual QList availableDevices(QString *errorMessage) const = 0;
20 |
21 | protected:
22 | virtual ~QCanBusFactory();
23 | };
24 |
25 | Q_DECLARE_INTERFACE(QCanBusFactory, "org.qt-project.Qt.QCanBusFactory")
26 |
27 | QT_END_NAMESPACE
28 |
29 | #endif // QCANBUSFACTORY_H
30 |
31 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #include "mainwindow.h"
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | using namespace Qt::StringLiterals;
12 |
13 | int main(int argc, char *argv[])
14 | {
15 | QApplication a(argc, argv);
16 |
17 | QCommandLineParser parser;
18 | parser.setApplicationDescription(u"Modbus Client Example"_s);
19 | parser.addHelpOption();
20 | parser.addVersionOption();
21 | QCommandLineOption verboseOption(u"verbose"_s, u"Verbose mode"_s);
22 | parser.addOption(verboseOption);
23 | parser.process(a);
24 |
25 | if (parser.isSet(verboseOption))
26 | QLoggingCategory::setFilterRules(u"qt.modbus* = true"_s);
27 |
28 | MainWindow w;
29 | w.show();
30 |
31 | return a.exec();
32 | }
33 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | file(GLOB_RECURSE test_data_glob
5 | RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
6 | data/*)
7 | list(APPEND test_data ${test_data_glob})
8 |
9 | get_filename_component(SHARED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../shared ABSOLUTE)
10 |
11 | qt_internal_add_test(tst_qcandbcfileparser
12 | SOURCES
13 | tst_qcandbcfileparser.cpp
14 | INCLUDE_DIRECTORIES
15 | ${SHARED_DIR}
16 | LIBRARIES
17 | Qt::Network
18 | Qt::SerialBus
19 | Qt::SerialBusPrivate
20 | TESTDATA
21 | ${test_data}
22 | )
23 |
24 | qt_internal_extend_target(tst_qcandbcfileparser CONDITION NOT ANDROID AND NOT IOS
25 | DEFINES
26 | QT_TEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
27 | )
28 |
29 | qt_internal_extend_target(tst_qcandbcfileparser CONDITION ANDROID OR IOS
30 | DEFINES
31 | QT_TEST_DATADIR=":/data"
32 | )
33 |
--------------------------------------------------------------------------------
/dist/changes-5.9.5:
--------------------------------------------------------------------------------
1 | Qt 5.9.5 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.9.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.9 series is binary compatible with the 5.8.x series.
10 | Applications compiled for 5.9 will continue to run with 5.9.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.9.5 Changes *
22 | ****************************************************************************
23 |
24 | - This release contains only minor code improvements.
25 |
--------------------------------------------------------------------------------
/dist/changes-5.11.1:
--------------------------------------------------------------------------------
1 | Qt 5.11.1 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.11.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.11 series is binary compatible with the 5.10.x series.
10 | Applications compiled for 5.10 will continue to run with 5.11.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.11.1 Changes *
22 | ****************************************************************************
23 |
24 | - This release contains only minor code improvements.
25 |
--------------------------------------------------------------------------------
/LICENSES/Qt-GPL-exception-1.0.txt:
--------------------------------------------------------------------------------
1 | The Qt Company GPL Exception 1.0
2 |
3 | Exception 1:
4 |
5 | As a special exception you may create a larger work which contains the
6 | output of this application and distribute that work under terms of your
7 | choice, so long as the work is not otherwise derived from or based on
8 | this application and so long as the work does not in itself generate
9 | output that contains the output from this application in its original
10 | or modified form.
11 |
12 | Exception 2:
13 |
14 | As a special exception, you have permission to combine this application
15 | with Plugins licensed under the terms of your choice, to produce an
16 | executable, and to copy and distribute the resulting executable under
17 | the terms of your choice. However, the executable must be accompanied
18 | by a prominent notice offering all users of the executable the entire
19 | source code to this application, excluding the source code of the
20 | independent modules, but including any changes you have made to this
21 | application, under the terms of this license.
22 |
23 |
--------------------------------------------------------------------------------
/config.tests/socketcan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | cmake_minimum_required(VERSION 3.16)
5 | project(config_test_socketcan LANGUAGES C CXX)
6 |
7 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH)
8 | set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH}")
9 | endif()
10 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH)
11 | set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}")
12 | endif()
13 |
14 | foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES})
15 | find_package(${p})
16 | endforeach()
17 |
18 | if(QT_CONFIG_COMPILE_TEST_LIBRARIES)
19 | link_libraries(${QT_CONFIG_COMPILE_TEST_LIBRARIES})
20 | endif()
21 | if(QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS)
22 | foreach(lib ${QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS})
23 | if(TARGET ${lib})
24 | link_libraries(${lib})
25 | endif()
26 | endforeach()
27 | endif()
28 |
29 | add_executable(${PROJECT_NAME}
30 | main.cpp
31 | )
32 |
--------------------------------------------------------------------------------
/config.tests/socketcan_fd/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | cmake_minimum_required(VERSION 3.16)
5 | project(config_test_socketcan_fd LANGUAGES C CXX)
6 |
7 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH)
8 | set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH}")
9 | endif()
10 | if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH)
11 | set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}")
12 | endif()
13 |
14 | foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES})
15 | find_package(${p})
16 | endforeach()
17 |
18 | if(QT_CONFIG_COMPILE_TEST_LIBRARIES)
19 | link_libraries(${QT_CONFIG_COMPILE_TEST_LIBRARIES})
20 | endif()
21 | if(QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS)
22 | foreach(lib ${QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS})
23 | if(TARGET ${lib})
24 | link_libraries(${lib})
25 | endif()
26 | endforeach()
27 | endif()
28 |
29 | add_executable(${PROJECT_NAME}
30 | main.cpp
31 | )
32 |
--------------------------------------------------------------------------------
/dist/changes-5.11.2:
--------------------------------------------------------------------------------
1 | Qt 5.11.2 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.11.0 through 5.11.1.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.11 series is binary compatible with the 5.10.x series.
10 | Applications compiled for 5.10 will continue to run with 5.11.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.11.2 Changes *
22 | ****************************************************************************
23 |
24 | - This release contains only minor code improvements.
25 |
--------------------------------------------------------------------------------
/dist/changes-5.14.2:
--------------------------------------------------------------------------------
1 | Qt 5.14.2 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.14.0 through 5.14.1.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | https://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.14 series is binary compatible with the 5.13.x series.
10 | Applications compiled for 5.13 will continue to run with 5.14.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.14.2 Changes *
22 | ****************************************************************************
23 |
24 | - Fixed a crash in CAN-Example when opening the CAN bus device failed.
25 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/multiple_files_2.dbc:
--------------------------------------------------------------------------------
1 | BO_ 1235 Test1: 3 Vector__XXX
2 | SG_ s4 m2 : 8|8@1- (1,0) [0|0] "" Vector__XXX
3 | SG_ s3 m1 : 8|8@1- (1,0) [0|0] "" Vector__XXX
4 | SG_ s2 m2 : 4|12@1- (1,0) [0|0] "" Vector__XXX
5 | SG_ s1 m1M : 4|4@1+ (1,0) [0|0] "" Vector__XXX
6 | SG_ s0 M : 0|4@1+ (1,0) [0|0] "" Vector__XXX
7 | SG_ s5 : 16|8@1- (1,0) [0|0] "" Vector__XXX
8 |
9 | BO_ 1236 Test2: 3 Vector__XXX
10 | SG_ s4 m2 : 8|8@1- (1,0) [0|0] "" Vector__XXX
11 | SG_ s3 m1 : 8|8@1- (1,0) [0|0] "" Vector__XXX
12 | SG_ s2 m2 : 4|12@1- (1,0) [0|0] "" Vector__XXX
13 | SG_ s1 m1M : 4|4@1+ (1,0) [0|0] "" Vector__XXX
14 | SG_ s0 M : 0|4@1+ (1,0) [0|0] "" Vector__XXX
15 | SG_ s5 : 16|8@1- (1,0) [0|0] "" Vector__XXX
16 |
17 | SG_MUL_VAL_ 1235 s4 s1 2-3, 5-5 ;
18 | SG_MUL_VAL_ 1235 s3 s1 1 - 1;
19 | SG_MUL_VAL_ 1235 s2 s0 2 -4 , 6- 8 , 10 -10 ;
20 | SG_MUL_VAL_ 1235 s1 s0 1-1, 5-5, 9-9;
21 |
22 | CM_ "Typo in multiplexed signal name";
23 | SG_MUL_VAL_ 1236 s6 s1 2-3, 5-5;
24 | SG_MUL_VAL_ 1236 s3 s1 1-1;
25 | SG_MUL_VAL_ 1236 s2 s0 2-4, 6-8, 10-10;
26 | SG_MUL_VAL_ 1236 s1 s0 1-1, 5-5, 9-9;
27 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/settingsdialog.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef SETTINGSDIALOG_H
5 | #define SETTINGSDIALOG_H
6 |
7 | #include
8 | #include
9 | #if QT_CONFIG(modbus_serialport)
10 | #include
11 | #endif
12 |
13 | QT_BEGIN_NAMESPACE
14 |
15 | namespace Ui {
16 | class SettingsDialog;
17 | }
18 |
19 | QT_END_NAMESPACE
20 |
21 | class SettingsDialog : public QDialog
22 | {
23 | Q_OBJECT
24 |
25 | public:
26 | struct Settings {
27 | #if QT_CONFIG(modbus_serialport)
28 | int parity = QSerialPort::EvenParity;
29 | int baud = QSerialPort::Baud19200;
30 | int dataBits = QSerialPort::Data8;
31 | int stopBits = QSerialPort::OneStop;
32 | #endif
33 | };
34 |
35 | explicit SettingsDialog(QWidget *parent = nullptr);
36 | ~SettingsDialog();
37 |
38 | Settings settings() const;
39 |
40 | private:
41 | Settings m_settings;
42 | Ui::SettingsDialog *ui;
43 | };
44 |
45 | #endif // SETTINGSDIALOG_H
46 |
--------------------------------------------------------------------------------
/tests/manual/modbus/adueditor/modbustcpclient.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 |
4 | #include "mainwindow.h"
5 | #include "modbustcpclient.h"
6 | #include "modbustcpclient_p.h"
7 |
8 | QT_USE_NAMESPACE
9 |
10 | ModbusTcpClient::ModbusTcpClient(QObject *parent)
11 | : QModbusTcpClient(*new ModbusTcpClientPrivate, parent)
12 | {
13 | }
14 |
15 | ModbusTcpClient::ModbusTcpClient(ModbusTcpClientPrivate &dd, QObject *parent)
16 | : QModbusTcpClient(dd, parent)
17 | {
18 | }
19 |
20 | void ModbusTcpClient::valueChanged(int value)
21 | {
22 | Q_UNUSED(value);
23 | Q_D(ModbusTcpClient);
24 |
25 | if (auto instance = MainWindow::instance()) {
26 | d->m_tId = quint16(instance->ti1Spin->value() << 8) | quint8(instance->ti2Spin->value());
27 | d->m_pId = quint16(instance->pi1Spin->value() << 8) | quint8(instance->pi2Spin->value());
28 | d->m_length = quint16(instance->l1Spin->value() << 8) | quint8(instance->l2Spin->value());
29 | d->m_uId = quint8(instance->ui1Spin->value());
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/simple_multiplexing.dbc:
--------------------------------------------------------------------------------
1 | VERSION ""
2 |
3 |
4 | NS_ :
5 | NS_DESC_
6 | CM_
7 | BA_DEF_
8 | BA_
9 | VAL_
10 | CAT_DEF_
11 | CAT_
12 | FILTER
13 | BA_DEF_DEF_
14 | EV_DATA_
15 | ENVVAR_DATA_
16 | SGTYPE_
17 | SGTYPE_VAL_
18 | BA_DEF_SGTYPE_
19 | BA_SGTYPE_
20 | SIG_TYPE_REF_
21 | VAL_TABLE_
22 | SIG_GROUP_
23 | SIG_VALTYPE_
24 | SIGTYPE_VALTYPE_
25 | BO_TX_BU_
26 | BA_DEF_REL_
27 | BA_REL_
28 | BA_DEF_DEF_REL_
29 | BU_SG_REL_
30 | BU_EV_REL_
31 | BU_BO_REL_
32 | SG_MUL_VAL_
33 |
34 | BS_:
35 |
36 | BU_:
37 |
38 |
39 | BO_ 1234 Test: 5 Vector__XXX
40 | SG_ s3 m2 : 8|32@1- (1,0) [0|0] "" Vector__XXX
41 | SG_ s2 m1 : 8|32@1- (1,0) [0|0] "" Vector__XXX
42 | SG_ s1 : 2|6@1+ (1,0) [0|0] "" Vector__XXX
43 | SG_ s0 M : 0|2@1+ (1,0) [0|0] "" Vector__XXX
44 |
45 | BO_ 1235 Test1: 4 Vector__XXX
46 | SG_ s4 M : 0|8@1+ (1,0) [0|0] "" Vector__XXX
47 | SG_ s5 M : 8|8@1+ (1,0) [0|0] "" Vector__XXX
48 | SG_ s6 m1 : 16|8@1+ (1,0) [0|0] "" Vector__XXX
49 | SG_ s7 m2 : 24|8@1+ (1,0) [0|0] "" Vector__XXX
50 |
51 | BA_DEF_ "BusType" STRING ;
52 | BA_DEF_DEF_ "BusType" "CAN";
53 | SIG_VALTYPE_ 1234 s3 : 1;
54 |
55 |
--------------------------------------------------------------------------------
/dist/changes-5.11.3:
--------------------------------------------------------------------------------
1 | Qt 5.11.3 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.11.0 through 5.11.2.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.11 series is binary compatible with the 5.10.x series.
10 | Applications compiled for 5.10 will continue to run with 5.11.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.11.2 Changes *
22 | ****************************************************************************
23 |
24 | - Fixed documentation for QModbusClient::timeoutChanged().
25 |
26 | - [QTBUG-65684] Fixed memory leak in QModbusRtuSerialMaster.
27 |
--------------------------------------------------------------------------------
/dist/changes-5.13.2:
--------------------------------------------------------------------------------
1 | Qt 5.13.2 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.13.0 through 5.13.1.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | https://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.13 series is binary compatible with the 5.12.x series.
10 | Applications compiled for 5.12 will continue to run with 5.13.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.13.2 Changes *
22 | ****************************************************************************
23 |
24 | - [QTBUG-78546] Fixed problems on static builds where an arbitrary version
25 | of resolveSymbol() was used instead of the correct one.
26 |
--------------------------------------------------------------------------------
/src/serialbus/qcanbus.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QCANBUS_H
5 | #define QCANBUS_H
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | QT_BEGIN_NAMESPACE
13 |
14 | class Q_SERIALBUS_EXPORT QCanBus : public QObject
15 | {
16 | Q_OBJECT
17 |
18 | public:
19 | static QCanBus *instance();
20 | QStringList plugins() const;
21 |
22 | QList availableDevices(const QString &plugin, QString *errorMessage = nullptr) const;
23 | QList availableDevices(QString *errorMessage = nullptr) const;
24 |
25 | QCanBusDevice *createDevice(const QString &plugin,
26 | const QString &interfaceName,
27 | QString *errorMessage = nullptr) const;
28 |
29 | private:
30 | QCanBus(QObject *parent = nullptr);
31 |
32 | Q_DISABLE_COPY(QCanBus)
33 | };
34 |
35 | QT_END_NAMESPACE
36 |
37 | #endif // QSERIALBUS_H
38 |
--------------------------------------------------------------------------------
/src/plugins/canbus/passthrucan/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Ford Motor Company.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #include "passthrucanbackend.h"
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | QT_BEGIN_NAMESPACE
11 |
12 | class PassThruCanBusPlugin : public QObject, public QCanBusFactory
13 | {
14 | Q_OBJECT
15 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QCanBusFactory" FILE "plugin.json")
16 | Q_INTERFACES(QCanBusFactory)
17 |
18 | public:
19 | PassThruCanBusPlugin()
20 | {
21 | qRegisterMetaType();
22 | qRegisterMetaType>();
23 | }
24 |
25 | QList availableDevices(QString *) const override
26 | {
27 | return PassThruCanBackend::interfaces();
28 | }
29 |
30 | QCanBusDevice *createDevice(const QString &interfaceName, QString *) const override
31 | {
32 | return new PassThruCanBackend(interfaceName);
33 | }
34 | };
35 |
36 | QT_END_NAMESPACE
37 |
38 | #include "main.moc"
39 |
--------------------------------------------------------------------------------
/dist/changes-5.9.6:
--------------------------------------------------------------------------------
1 | Qt 5.9.6 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.9.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.9 series is binary compatible with the 5.8.x series.
10 | Applications compiled for 5.8 will continue to run with 5.9.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.9.6 Changes *
22 | ****************************************************************************
23 |
24 | CAN bus
25 | -------
26 |
27 | - [QTBUG-67030] Fixed a receive problem in the VectorCAN plugin. When
28 | multiple channels were open, only the first one could receive frames.
29 |
--------------------------------------------------------------------------------
/src/serialbus/qcanbusdeviceinfo_p.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QCANBUSDEVICEINFO_P_H
5 | #define QCANBUSDEVICEINFO_P_H
6 |
7 | //
8 | // W A R N I N G
9 | // -------------
10 | //
11 | // This file is not part of the Qt API. It exists purely as an
12 | // implementation detail. This header file may change from version to
13 | // version without notice, or even be removed.
14 | //
15 | // We mean it.
16 | //
17 |
18 | #include
19 | #include
20 | #include
21 |
22 | QT_BEGIN_NAMESPACE
23 |
24 | class QCanBusDeviceInfoPrivate : public QSharedData {
25 | public:
26 | QCanBusDeviceInfoPrivate() { }
27 |
28 | ~QCanBusDeviceInfoPrivate()
29 | {
30 | }
31 |
32 | QString plugin;
33 | QString name;
34 | QString description;
35 | QString serialNumber;
36 | QString alias;
37 | int channel = 0;
38 | bool hasFlexibleDataRate = false;
39 | bool isVirtual = false;
40 | };
41 |
42 | QT_END_NAMESPACE
43 |
44 | #endif // QCANBUSDEVICEINFO_P_H
45 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/settingsdialog.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef SETTINGSDIALOG_H
5 | #define SETTINGSDIALOG_H
6 |
7 | #include
8 | #include
9 | #if QT_CONFIG(modbus_serialport)
10 | #include
11 | #endif
12 |
13 | QT_BEGIN_NAMESPACE
14 |
15 | namespace Ui {
16 | class SettingsDialog;
17 | }
18 |
19 | QT_END_NAMESPACE
20 |
21 | class SettingsDialog : public QDialog
22 | {
23 | Q_OBJECT
24 |
25 | public:
26 | struct Settings {
27 | #if QT_CONFIG(modbus_serialport)
28 | int parity = QSerialPort::EvenParity;
29 | int baud = QSerialPort::Baud19200;
30 | int dataBits = QSerialPort::Data8;
31 | int stopBits = QSerialPort::OneStop;
32 | #endif
33 | int responseTime = 1000;
34 | int numberOfRetries = 3;
35 | };
36 |
37 | explicit SettingsDialog(QWidget *parent = nullptr);
38 | ~SettingsDialog();
39 |
40 | Settings settings() const;
41 |
42 | private:
43 | Settings m_settings;
44 | Ui::SettingsDialog *ui = nullptr;
45 | };
46 |
47 | #endif // SETTINGSDIALOG_H
48 |
--------------------------------------------------------------------------------
/dist/changes-5.12.5:
--------------------------------------------------------------------------------
1 | Qt 5.12.5 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.12.0 through 5.12.4.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | https://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.12 series is binary compatible with the 5.11.x series.
10 | Applications compiled for 5.11 will continue to run with 5.12.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.12.5 Changes *
22 | ****************************************************************************
23 |
24 | QtSerialBus
25 | -----------
26 |
27 | - CAN Plugins:
28 | * [QTBUG-76957] Fixed the compiler error "‘SIOCGSTAMP’ was not declared"
29 | in the SocketCAN plugin
30 |
31 |
--------------------------------------------------------------------------------
/src/serialbus/doc/src/qtserialbus-module-cpp.qdoc:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3 |
4 | /*!
5 |
6 | \module QtSerialBus
7 | \title Qt Serial Bus C++ Classes
8 | \ingroup modules
9 | \qtvariable serialbus
10 | \qtcmakepackage SerialBus
11 | \since 5.8
12 |
13 | \brief Provides classes to read and write serial bus data.
14 |
15 | Provides classes to access various serial buses.
16 |
17 | For C++ projects include the header appropriate for the current use case,
18 | for example applications using the CAN bus device may use
19 |
20 | \code
21 | #include
22 | \endcode
23 |
24 | To use the module with CMake, use the \c{find_package()} command to locate
25 | the needed module components in the \c{Qt6} package:
26 | \include qtserialbus-module-use.qdocinc cmakebuild
27 |
28 | To use the module for building with qmake, add the module as a value of the
29 | \c QT variable in the project's .pro file:
30 | \include qtserialbus-module-use.qdocinc qmakebuild
31 |
32 | See more in the \l {Qt Serial Bus} {Qt Serial Bus Overview}.
33 | */
34 |
--------------------------------------------------------------------------------
/src/serialbus/qcanuniqueiddescription_p.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2022 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QCANUNIQUEIDDESCRIPTION_P_H
5 | #define QCANUNIQUEIDDESCRIPTION_P_H
6 |
7 | //
8 | // W A R N I N G
9 | // -------------
10 | //
11 | // This file is not part of the Qt API. It exists purely as an
12 | // implementation detail. This header file may change from version to
13 | // version without notice, or even be removed.
14 | //
15 | // We mean it.
16 | //
17 |
18 | #include "qtserialbusexports.h"
19 | #include "qcanuniqueiddescription.h"
20 |
21 | QT_BEGIN_NAMESPACE
22 |
23 | class Q_SERIALBUS_EXPORT QCanUniqueIdDescriptionPrivate : public QSharedData
24 | {
25 | public:
26 | QtCanBus::DataSource source = QtCanBus::DataSource::FrameId;
27 | QSysInfo::Endian endian = QSysInfo::Endian::LittleEndian;
28 | quint16 startBit = 0;
29 | quint8 bitLength = 0;
30 |
31 | inline bool isShared() const { return ref.loadRelaxed() != 1; }
32 | static QCanUniqueIdDescriptionPrivate *get(const QCanUniqueIdDescription &desc);
33 | };
34 |
35 | QT_END_NAMESPACE
36 |
37 | #endif // QCANUNIQUEIDDESCRIPTION_P_H
38 |
--------------------------------------------------------------------------------
/dist/changes-5.10.1:
--------------------------------------------------------------------------------
1 | Qt 5.10.1 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.10.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.10 series is binary compatible with the 5.9.x series.
10 | Applications compiled for 5.9 will continue to run with 5.10.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | This release contains all fixes included in the Qt 5.9.4 release.
21 |
22 | ****************************************************************************
23 | * Qt 5.10.1 Changes *
24 | ****************************************************************************
25 |
26 | QtSerialBus
27 | -----------
28 |
29 | - Fixed build failure in socketcanbackend.h due to missing struct timeval
30 | include.
31 |
32 |
--------------------------------------------------------------------------------
/dist/changes-5.12.4:
--------------------------------------------------------------------------------
1 | Qt 5.12.4 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.12.0 through 5.12.3.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | https://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.12 series is binary compatible with the 5.11.x series.
10 | Applications compiled for 5.11 will continue to run with 5.12.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.12.4 Changes *
22 | ****************************************************************************
23 |
24 | QtSerialBus
25 | -----------
26 |
27 | - CAN Plugins
28 | * Fixed the error message "Cannot configure TxEcho for open device"
29 | when QCanBusDevice::ReceiveOwnKey was used in the SystecCAN plugin
30 |
--------------------------------------------------------------------------------
/tests/auto/plugins/testcanbus/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 |
4 | #include "testcanbackend.h"
5 |
6 | #include
7 | #include
8 |
9 | QT_BEGIN_NAMESPACE
10 |
11 | class TestCanBusPlugin : public QObject, public QCanBusFactory
12 | {
13 | Q_OBJECT
14 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QCanBusFactory" FILE "plugin.json")
15 | Q_INTERFACES(QCanBusFactory)
16 |
17 | public:
18 | QList availableDevices(QString *errorMessage) const override
19 | {
20 | Q_UNUSED(errorMessage);
21 |
22 | return TestCanBackend::interfaces();
23 | }
24 |
25 | QCanBusDevice *createDevice(const QString &interfaceName, QString *errorMessage) const override
26 | {
27 | if (interfaceName == QStringLiteral("invalid")) {
28 | if (errorMessage)
29 | *errorMessage = tr("No such interface: '%1'").arg(interfaceName);
30 |
31 | return nullptr;
32 | }
33 | auto device = new TestCanBackend();
34 | return device;
35 | }
36 | };
37 |
38 | QT_END_NAMESPACE
39 |
40 | #include "main.moc"
41 |
--------------------------------------------------------------------------------
/src/serialbus/qcanmessagedescription_p.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2022 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QCANMESSAGEDESCRIPTION_P_H
5 | #define QCANMESSAGEDESCRIPTION_P_H
6 |
7 | //
8 | // W A R N I N G
9 | // -------------
10 | //
11 | // This file is not part of the Qt API. It exists purely as an
12 | // implementation detail. This header file may change from version to
13 | // version without notice, or even be removed.
14 | //
15 | // We mean it.
16 | //
17 |
18 | #include "qtserialbusexports.h"
19 | #include "qcanmessagedescription.h"
20 |
21 | QT_BEGIN_NAMESPACE
22 |
23 | class Q_SERIALBUS_EXPORT QCanMessageDescriptionPrivate : public QSharedData
24 | {
25 | public:
26 | QString name;
27 | QString transmitter;
28 | QString comment;
29 | QtCanBus::UniqueId id{0};
30 | quint8 size = 0; // even CAN FD has max 64 bytes
31 | QHash messageSignals;
32 |
33 | inline bool isShared() const { return ref.loadRelaxed() != 1; }
34 | static QCanMessageDescriptionPrivate *get(const QCanMessageDescription &desc);
35 | };
36 |
37 | QT_END_NAMESPACE
38 |
39 | #endif // QCANMESSAGEDESCRIPTION_P_H
40 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/registermodel.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef REGISTERMODEL_H
5 | #define REGISTERMODEL_H
6 |
7 | #include
8 |
9 | class RegisterModel : public QAbstractTableModel
10 | {
11 | Q_OBJECT
12 |
13 | public:
14 | RegisterModel(QObject *parent = nullptr);
15 |
16 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
17 | int columnCount(const QModelIndex &parent = QModelIndex()) const override;
18 |
19 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
20 | QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
21 | bool setData(const QModelIndex &index, const QVariant &value, int role) override;
22 |
23 | Qt::ItemFlags flags(const QModelIndex &index) const override;
24 |
25 | public slots:
26 | void setStartAddress(int address);
27 | void setNumberOfValues(const QString &number);
28 |
29 | signals:
30 | void updateViewport();
31 |
32 | public:
33 | int m_number = 0;
34 | int m_address = 0;
35 | QList m_registers;
36 | };
37 |
38 | #endif // REGISTERMODEL_H
39 |
--------------------------------------------------------------------------------
/src/plugins/canbus/socketcan/libsocketcan.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2019 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef LIBSOCKETCAN_H
5 | #define LIBSOCKETCAN_H
6 |
7 | #include
8 | #include
9 |
10 | //
11 | // W A R N I N G
12 | // -------------
13 | //
14 | // This file is not part of the Qt API. It exists purely as an
15 | // implementation detail. This header file may change from version to
16 | // version without notice, or even be removed.
17 | //
18 | // We mean it.
19 | //
20 |
21 | QT_BEGIN_NAMESPACE
22 |
23 | class QString;
24 |
25 | class LibSocketCan final
26 | {
27 | public:
28 | explicit LibSocketCan(QString *errorString = nullptr);
29 |
30 | bool start(const QString &interface);
31 | bool stop(const QString &interface);
32 | bool restart(const QString &interface);
33 |
34 | quint32 bitrate(const QString &interface) const;
35 | bool setBitrate(const QString &interface, quint32 bitrate);
36 |
37 | bool hasBusStatus() const;
38 | QCanBusDevice::CanBusStatus busStatus(const QString &interface) const;
39 | };
40 |
41 | QT_END_NAMESPACE
42 |
43 | #endif // LIBSOCKETCAN_H
44 |
--------------------------------------------------------------------------------
/dist/changes-5.12.10:
--------------------------------------------------------------------------------
1 | Qt 5.12.10 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.12.9.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | https://doc.qt.io/qt-5.12/index.html
8 |
9 | The Qt version 5.12 series is binary compatible with the 5.11.x series.
10 | Applications compiled for 5.11 will continue to run with 5.12.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Important Behavior Changes *
22 | ****************************************************************************
23 |
24 | ****************************************************************************
25 | * Library *
26 | ****************************************************************************
27 |
28 |
29 |
--------------------------------------------------------------------------------
/dist/changes-5.7.0:
--------------------------------------------------------------------------------
1 | QtSerialBus 5.7 introduces a few new features and improvements as well as
2 | bugfixes over the 5.6.x series. For more details, refer to the online
3 | documentation included in this distribution. The documentation is also available
4 | online:
5 |
6 | http://doc.qt.io/qt-5/index.html
7 |
8 | The QtSerialBus version 5.7 series is binary compatible with the 5.6.x series.
9 | Applications compiled for 5.6 will continue to run with 5.7.
10 |
11 | Some of the changes listed in this file include issue tracking numbers
12 | corresponding to tasks in the Qt Bug Tracker:
13 |
14 | http://bugreports.qt.io/
15 |
16 | Each of these identifiers can be entered in the bug tracker to obtain more
17 | information about a particular change.
18 |
19 | ****************************************************************************
20 | * Library *
21 | ****************************************************************************
22 |
23 | QtSerialBus
24 | -----------
25 |
26 | - Added Qt QtSerialBus as a new module to Qt 5.7 supporting CAN and Modbus
27 | development
28 | - Released the Qt SerialBus module as Technology Preview. This means that the
29 | API may still change in subsequent releases.
30 |
31 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/messages_with_comments.dbc:
--------------------------------------------------------------------------------
1 | VERSION ""
2 |
3 |
4 | NS_ :
5 | NS_DESC_
6 | CM_
7 | BA_DEF_
8 | BA_
9 | VAL_
10 | CAT_DEF_
11 | CAT_
12 | FILTER
13 | BA_DEF_DEF_
14 | EV_DATA_
15 | ENVVAR_DATA_
16 | SGTYPE_
17 | SGTYPE_VAL_
18 | BA_DEF_SGTYPE_
19 | BA_SGTYPE_
20 | SIG_TYPE_REF_
21 | VAL_TABLE_
22 | SIG_GROUP_
23 | SIG_VALTYPE_
24 | SIGTYPE_VALTYPE_
25 | BO_TX_BU_
26 | BA_DEF_REL_
27 | BA_REL_
28 | BA_DEF_DEF_REL_
29 | BU_SG_REL_
30 | BU_EV_REL_
31 | BU_BO_REL_
32 | SG_MUL_VAL_
33 |
34 | BS_:
35 |
36 | BU_:
37 |
38 |
39 | BO_ 2566844926 Test1: 1 Vector__XXX
40 | SG_ s2 : 7|8@0+ (1,0) [0|0] "unit" Vector__XXX
41 |
42 | BO_ 1234 Test: 2 Vector__XXX
43 | SG_ s1 : 8|8@1- (1,0) [0|0] "unit" Vector__XXX
44 | SG_ s0 : 0|8@1- (1,0) [0|0] "unit" Vector__XXX
45 |
46 |
47 |
48 | CM_ BO_ 2566844926 "comment for Test1." ;
49 | CM_ SG_ 2566844926 s2 "comment for s2" ;
50 | CM_ BO_ 1234 "Comment for message Test";
51 | CM_ SG_ 1234 s1 "comment for s1" ;
52 | CM_ SG_ 1234 s0 "Comment for s0";
53 | BA_DEF_ "MultiplexExtEnabled" ENUM "No","Yes";
54 | BA_DEF_ "BusType" STRING ;
55 | BA_DEF_DEF_ "MultiplexExtEnabled" "No";
56 | BA_DEF_DEF_ "BusType" "CAN";
57 |
--------------------------------------------------------------------------------
/coin/axivion/ci_config_linux.json:
--------------------------------------------------------------------------------
1 | {
2 | "Project": {
3 | "BuildSystemIntegration": {
4 | "child_order": [
5 | "GCCSetup",
6 | "CMake",
7 | "LinkLibraries"
8 | ]
9 | },
10 | "CMake": {
11 | "_active": true,
12 | "_copy_from": "CMakeIntegration",
13 | "build_environment": {},
14 | "build_options": "-j4",
15 | "generate_options": "--fresh",
16 | "generator": "Ninja"
17 | },
18 | "GCCSetup": {
19 | "_active": true,
20 | "_copy_from": "Command",
21 | "build_command": "gccsetup --cc gcc --cxx g++ --config ../../../axivion/"
22 | },
23 | "LinkLibraries": {
24 | "_active": true,
25 | "_copy_from": "AxivionLinker",
26 | "input_files": [
27 | "build/lib/lib*.so*.ir"
28 | ],
29 | "ir": "build/$(env:TESTED_MODULE_COIN).ir",
30 | "plugin_files": [
31 | "build/plugins/*/lib*.so*.ir"
32 | ]
33 | }
34 | },
35 | "_Format": "1.0",
36 | "_Version": "7.6.2",
37 | "_VersionNum": [
38 | 7,
39 | 6,
40 | 2,
41 | 12725
42 | ]
43 | }
44 |
--------------------------------------------------------------------------------
/src/plugins/canbus/socketcan/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #include "socketcanbackend.h"
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include
11 |
12 | QT_BEGIN_NAMESPACE
13 |
14 | Q_LOGGING_CATEGORY(QT_CANBUS_PLUGINS_SOCKETCAN, "qt.canbus.plugins.socketcan")
15 |
16 | //! [SocketCanFactory]
17 | class SocketCanBusPlugin : public QObject, public QCanBusFactory
18 | {
19 | Q_OBJECT
20 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QCanBusFactory" FILE "plugin.json")
21 | Q_INTERFACES(QCanBusFactory)
22 |
23 | public:
24 | QList availableDevices(QString *errorMessage) const override
25 | {
26 | Q_UNUSED(errorMessage);
27 | return SocketCanBackend::interfaces();
28 | }
29 |
30 | QCanBusDevice *createDevice(const QString &interfaceName, QString *errorMessage) const override
31 | {
32 | Q_UNUSED(errorMessage);
33 | auto device = new SocketCanBackend(interfaceName);
34 | return device;
35 | }
36 | };
37 | //! [SocketCanFactory]
38 |
39 | QT_END_NAMESPACE
40 |
41 | #include "main.moc"
42 |
--------------------------------------------------------------------------------
/tests/auto/shared/qcanmessagedescription_helpers.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2023 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 |
4 | #ifndef QCANMESSAGEDESCRIPTION_HELPERS_H
5 | #define QCANMESSAGEDESCRIPTION_HELPERS_H
6 |
7 | #include
8 |
9 | #include "qcansignaldescription_helpers.h"
10 |
11 | QT_BEGIN_NAMESPACE
12 |
13 | inline bool equals(const QCanMessageDescription &lhs, const QCanMessageDescription &rhs) noexcept
14 | {
15 | return lhs.uniqueId() == rhs.uniqueId()
16 | && lhs.name() == rhs.name()
17 | && lhs.size() == rhs.size()
18 | && lhs.transmitter() == rhs.transmitter()
19 | && lhs.comment() == rhs.comment()
20 | && equals(lhs.signalDescriptions(), rhs.signalDescriptions());
21 | }
22 |
23 | inline bool equals(const QList &lhs,
24 | const QList &rhs) noexcept
25 | {
26 | if (lhs.size() != rhs.size())
27 | return false;
28 |
29 | for (qsizetype idx = 0; idx < lhs.size(); ++idx) {
30 | if (!equals(lhs.at(idx), rhs.at(idx)))
31 | return false;
32 | }
33 |
34 | return true;
35 | }
36 |
37 | QT_END_NAMESPACE
38 |
39 | #endif // QCANMESSAGEDESCRIPTION_HELPERS_H
40 |
--------------------------------------------------------------------------------
/dist/changes-5.9.1:
--------------------------------------------------------------------------------
1 | Qt 5.9.1 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.9.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.9 series is binary compatible with the 5.8.x series.
10 | Applications compiled for 5.8 will continue to run with 5.9.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Library *
22 | ****************************************************************************
23 |
24 | QCanBus
25 | -------
26 |
27 | - Added a menu to open plugins online documentation to the CAN Example.
28 | - Updated the documentation with runtime requirements for the various CAN plugins.
29 | - PeakCAN: Updated the supported channels documentation. It supports up to
30 | 16 USB and 16 PCI CAN channels since 5.9.0.
31 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/writeregistermodel.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef WRITEREGISTERMODEL_H
5 | #define WRITEREGISTERMODEL_H
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | class WriteRegisterModel : public QAbstractTableModel
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | WriteRegisterModel(QObject *parent = nullptr);
17 |
18 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
19 | int columnCount(const QModelIndex &parent = QModelIndex()) const override;
20 |
21 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
22 | QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
23 | bool setData(const QModelIndex &index, const QVariant &value, int role) override;
24 |
25 | Qt::ItemFlags flags(const QModelIndex &index) const override;
26 |
27 | public slots:
28 | void setStartAddress(int address);
29 | void setNumberOfValues(const QString &number);
30 |
31 | signals:
32 | void updateViewport();
33 |
34 | public:
35 | int m_number = 0;
36 | int m_address = 0;
37 | QBitArray m_coils;
38 | QList m_holdingRegisters;
39 | };
40 |
41 | #endif // WRITEREGISTERMODEL_H
42 |
--------------------------------------------------------------------------------
/src/plugins/canbus/virtualcan/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2018 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #include "virtualcanbackend.h"
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include
11 |
12 | QT_BEGIN_NAMESPACE
13 |
14 | Q_LOGGING_CATEGORY(QT_CANBUS_PLUGINS_VIRTUALCAN, "qt.canbus.plugins.virtualcan")
15 |
16 | class VirtualCanBusPlugin : public QObject, public QCanBusFactory
17 | {
18 | Q_OBJECT
19 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QCanBusFactory" FILE "plugin.json")
20 | Q_INTERFACES(QCanBusFactory)
21 |
22 | public:
23 | QList availableDevices(QString *errorMessage) const override
24 | {
25 | if (errorMessage != nullptr)
26 | errorMessage->clear();
27 |
28 | return VirtualCanBackend::interfaces();
29 | }
30 |
31 | QCanBusDevice *createDevice(const QString &interfaceName, QString *errorMessage) const override
32 | {
33 | if (errorMessage)
34 | errorMessage->clear();
35 |
36 | auto device = new VirtualCanBackend(interfaceName);
37 | return device;
38 | }
39 | };
40 |
41 | QT_END_NAMESPACE
42 |
43 | #include "main.moc"
44 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/mainwindow.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef MAINWINDOW_H
5 | #define MAINWINDOW_H
6 |
7 | #include
8 | #include
9 |
10 | QT_BEGIN_NAMESPACE
11 |
12 | class QModbusClient;
13 |
14 | namespace Ui {
15 | class MainWindow;
16 | }
17 |
18 | QT_END_NAMESPACE
19 |
20 | class SettingsDialog;
21 | class WriteRegisterModel;
22 |
23 | class MainWindow : public QMainWindow
24 | {
25 | Q_OBJECT
26 |
27 | public:
28 | explicit MainWindow(QWidget *parent = nullptr);
29 | ~MainWindow();
30 |
31 | private:
32 | void initActions();
33 | QModbusDataUnit readRequest() const;
34 | QModbusDataUnit writeRequest() const;
35 |
36 | private slots:
37 | void onConnectButtonClicked();
38 | void onModbusStateChanged(int state);
39 |
40 | void onReadButtonClicked();
41 | void onReadReady();
42 |
43 | void onWriteButtonClicked();
44 | void onReadWriteButtonClicked();
45 |
46 | void onConnectTypeChanged(int);
47 | void onWriteTableChanged(int);
48 |
49 | private:
50 | Ui::MainWindow *ui = nullptr;
51 | QModbusClient *modbusDevice = nullptr;
52 | SettingsDialog *m_settingsDialog = nullptr;
53 | WriteRegisterModel *writeModel = nullptr;
54 | };
55 |
56 | #endif // MAINWINDOW_H
57 |
--------------------------------------------------------------------------------
/src/serialbus/qmodbustcpserver.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QMODBUSTCPSERVER_H
5 | #define QMODBUSTCPSERVER_H
6 |
7 | #include
8 | #include
9 |
10 | QT_BEGIN_NAMESPACE
11 |
12 | class QModbusTcpServerPrivate;
13 | class QTcpSocket;
14 |
15 | class Q_SERIALBUS_EXPORT QModbusTcpConnectionObserver
16 | {
17 | public:
18 | virtual ~QModbusTcpConnectionObserver();
19 |
20 | virtual bool acceptNewConnection(QTcpSocket *newClient) = 0;
21 | };
22 |
23 | class Q_SERIALBUS_EXPORT QModbusTcpServer : public QModbusServer
24 | {
25 | Q_OBJECT
26 | Q_DECLARE_PRIVATE(QModbusTcpServer)
27 |
28 | public:
29 | explicit QModbusTcpServer(QObject *parent = nullptr);
30 | ~QModbusTcpServer();
31 |
32 | void installConnectionObserver(QModbusTcpConnectionObserver *observer);
33 |
34 | Q_SIGNALS:
35 | void modbusClientDisconnected(QTcpSocket *modbusClient);
36 |
37 | protected:
38 | QModbusTcpServer(QModbusTcpServerPrivate &dd, QObject *parent = nullptr);
39 |
40 | bool open() override;
41 | void close() override;
42 |
43 | QModbusResponse processRequest(const QModbusPdu &request) override;
44 | };
45 |
46 | QT_END_NAMESPACE
47 |
48 | #endif // QMODBUSTCPSERVER_H
49 |
--------------------------------------------------------------------------------
/dist/changes-5.9.2:
--------------------------------------------------------------------------------
1 | Qt 5.9.2 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.9.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.9 series is binary compatible with the 5.8.x series.
10 | Applications compiled for 5.8 will continue to run with 5.9.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.9.2 Changes *
22 | ****************************************************************************
23 |
24 | QtSerialBus
25 | ------
26 |
27 | - Modbus:
28 | * [QTBUG-62421] Fixed the address counter for received Modbus register
29 | entries in the Modbus Master Example.
30 | * [QTBUG-62144] [QTBUG-62299] Fixed a crash due to unexpected state in
31 | Modbus process queued element.
32 |
33 | - CanBus:
34 | * Improved the connect/disconnect documentation for QCanBusDevice.
35 |
--------------------------------------------------------------------------------
/dist/changes-5.7.1:
--------------------------------------------------------------------------------
1 | Qt 5.7.1 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.7.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.7 series is binary compatible with the 5.6.x series.
10 | Applications compiled for 5.6 will continue to run with 5.7.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | QtSerialBus
21 | ---------
22 |
23 | - Build system improvements
24 | - Documentation improvements
25 | - Several fixes to CAN-Examples
26 | - Several PeakCAN and SocketCAN implementation improvements
27 | - Expand license scope from "Qt GUI Toolkit" to "Qt Toolkit"
28 |
29 | - QTBUG-53171: CAN: Fix displaying extended identifiers below 0x800
30 | - QTBUG-53171: CAN: Fix displaying data bytes for remote request frames
31 | - QTBUG-53767: Fix Modbus timeout on Windows.
32 | - QTBUG-53277: Make adueditor compile on platforms with QT_NO_CLIPBOARD
33 | - QTBUG-56009: Fix ModbusRtuSerialMaster stack overflow on close
34 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/mainwindow.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef MAINWINDOW_H
5 | #define MAINWINDOW_H
6 |
7 | #include "modbusclient.h"
8 | #include "modbusserver.h"
9 |
10 | #include
11 | #include
12 |
13 | QT_BEGIN_NAMESPACE
14 |
15 | class QLineEdit;
16 |
17 | namespace Ui {
18 | class MainWindow;
19 | }
20 |
21 | QT_END_NAMESPACE
22 |
23 | class RegisterModel;
24 |
25 | class MainWindow : public QMainWindow
26 | {
27 | Q_OBJECT
28 |
29 | public:
30 | explicit MainWindow(QWidget *parent = nullptr);
31 | ~MainWindow();
32 |
33 | private Q_SLOTS:
34 | void onConnectButtonClicked();
35 | void onStateChanged(int state);
36 |
37 | void onReadReady();
38 | void onReadButtonClicked();
39 | void onWriteButtonClicked();
40 |
41 | void setRegister(const QString &value);
42 | void updateWidgets(QModbusDataUnit::RegisterType table, int address, int size);
43 |
44 | private:
45 | void setupConnections();
46 | void setupClientContainer();
47 | void setupServerContainer();
48 |
49 | private:
50 | Ui::MainWindow *ui = nullptr;
51 | RegisterModel *m_model = nullptr;
52 |
53 | ModbusClient m_client;
54 | ModbusServer m_server;
55 | QHash m_registers;
56 | };
57 |
58 | #endif // MAINWINDOW_H
59 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/settingsdialog.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #include "settingsdialog.h"
5 | #include "ui_settingsdialog.h"
6 |
7 | SettingsDialog::SettingsDialog(QWidget *parent) :
8 | QDialog(parent),
9 | ui(new Ui::SettingsDialog)
10 | {
11 | ui->setupUi(this);
12 |
13 | ui->parityCombo->setCurrentIndex(1);
14 | #if QT_CONFIG(modbus_serialport)
15 | ui->baudCombo->setCurrentText(QString::number(m_settings.baud));
16 | ui->dataBitsCombo->setCurrentText(QString::number(m_settings.dataBits));
17 | ui->stopBitsCombo->setCurrentText(QString::number(m_settings.stopBits));
18 | #endif
19 |
20 | connect(ui->applyButton, &QPushButton::clicked, this, [this]() {
21 | #if QT_CONFIG(modbus_serialport)
22 | m_settings.parity = ui->parityCombo->currentIndex();
23 | if (m_settings.parity > 0)
24 | m_settings.parity++;
25 | m_settings.baud = ui->baudCombo->currentText().toInt();
26 | m_settings.dataBits = ui->dataBitsCombo->currentText().toInt();
27 | m_settings.stopBits = ui->stopBitsCombo->currentText().toInt();
28 | #endif
29 | hide();
30 | });
31 | }
32 |
33 | SettingsDialog::~SettingsDialog()
34 | {
35 | delete ui;
36 | }
37 |
38 | SettingsDialog::Settings SettingsDialog::settings() const
39 | {
40 | return m_settings;
41 | }
42 |
--------------------------------------------------------------------------------
/src/serialbus/qcanbusfactory.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #include "qcanbusfactory.h"
5 |
6 | QT_BEGIN_NAMESPACE
7 |
8 | /*!
9 | \class QCanBusFactory
10 | \inmodule QtSerialBus
11 | \since 5.9
12 |
13 | \brief The QCanBusFactory class is a factory class used as the
14 | plugin interface for CAN bus plugins.
15 |
16 | All plugins must implement the functions provided by this factory class.
17 | */
18 |
19 | /*!
20 | \fn QCanBusDevice *QCanBusFactory::createDevice(const QString &interfaceName,
21 | QString *errorMessage) const
22 |
23 | Creates a new QCanBusDevice. The caller must take ownership of the returned pointer.
24 |
25 | \a interfaceName is the CAN interface name and
26 | \a errorMessage contains an error description in case of failure.
27 |
28 | If the factory cannot create a plugin, it returns \c nullptr.
29 | */
30 |
31 | /*!
32 | \fn QList QCanBusFactory::availableDevices(QString *errorMessage) const
33 |
34 | Returns the list of available devices and their capabilities for the QCanBusDevice.
35 |
36 | \a errorMessage contains an error description in case of failure.
37 | */
38 |
39 | /*!
40 | * \internal
41 | */
42 | QCanBusFactory::~QCanBusFactory()
43 | {
44 | }
45 |
46 | QT_END_NAMESPACE
47 |
--------------------------------------------------------------------------------
/LICENSES/BSD-3-Clause.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) .
2 |
3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4 |
5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
8 |
9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/invalid_message_pos.dbc:
--------------------------------------------------------------------------------
1 | VERSION ""
2 |
3 |
4 | NS_ :
5 | NS_DESC_
6 | CM_
7 | BA_DEF_
8 | BA_
9 | VAL_
10 | CAT_DEF_
11 | CAT_
12 | FILTER
13 | BA_DEF_DEF_
14 | EV_DATA_
15 | ENVVAR_DATA_
16 | SGTYPE_
17 | SGTYPE_VAL_
18 | BA_DEF_SGTYPE_
19 | BA_SGTYPE_
20 | SIG_TYPE_REF_
21 | VAL_TABLE_
22 | SIG_GROUP_
23 | SIG_VALTYPE_
24 | SIGTYPE_VALTYPE_
25 | BO_TX_BU_
26 | BA_DEF_REL_
27 | BA_REL_
28 | BA_DEF_DEF_REL_
29 | BU_SG_REL_
30 | BU_EV_REL_
31 | BU_BO_REL_
32 | SG_MUL_VAL_
33 |
34 | BS_:
35 |
36 | BU_:
37 |
38 |
39 | BO_ 1234 Test: 3 Vector__XXX
40 | SG_ s4 m2 : 8|8@1- (1,0) [0|0] "" Vector__XXX
41 | SG_ s3 m1 : 8|8@1- (1,0) [0|0] "" Vector__XXX
42 | SG_ s2 m2 : 4|12@1- (1,0) [0|0] "" Vector__XXX
43 | SG_ s1 m1M : 4|4@1+ (1,0) [0|0] "" Vector__XXX
44 | SG_ s0 M : 0|4@1+ (1,0) [0|0] "" Vector__XXX
45 | SG_ s5 : 16|8@1- (1,0) [0|0] "" Vector__XXX
46 |
47 | SG_MUL_VAL_ 1234 s4 s1 2-3, 5-5 ;
48 | SG_MUL_VAL_ 1234 s3 s1 1 - 1;
49 | SG_MUL_VAL_ 1234 s2 s0 2 -4 , 6- 8 , 10 -10 ;
50 | SG_MUL_VAL_ 1234 s1 s0 1-1, 5-5, 9-9;
51 |
52 | BO_ 1235 Test: 3 Vector__XXX
53 | SG_ s4 m2 : 8|8@1- (1,0) [0|0] "" Vector__XXX
54 | SG_ s3 m1 : 8|8@1- (1,0) [0|0] "" Vector__XXX
55 | SG_ s2 m2 : 4|12@1- (1,0) [0|0] "" Vector__XXX
56 | SG_ s1 m1M : 4|4@1+ (1,0) [0|0] "" Vector__XXX
57 | SG_ s0 M : 0|4@1+ (1,0) [0|0] "" Vector__XXX
58 | SG_ s5 : 16|8@1- (1,0) [0|0] "" Vector__XXX
59 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/custom/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | cmake_minimum_required(VERSION 3.16)
5 | project(customcommand LANGUAGES CXX)
6 |
7 | if(NOT DEFINED INSTALL_EXAMPLESDIR)
8 | set(INSTALL_EXAMPLESDIR "examples")
9 | endif()
10 |
11 | set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/serialbus/modbus/custom")
12 |
13 | find_package(Qt6 REQUIRED COMPONENTS Core Gui Network SerialBus Widgets)
14 |
15 | qt_standard_project_setup()
16 |
17 | qt_add_executable(customcommand
18 | main.cpp
19 | mainwindow.cpp mainwindow.h mainwindow.ui
20 | modbusclient.cpp modbusclient.h
21 | modbusserver.cpp modbusserver.h
22 | registermodel.cpp registermodel.h
23 | )
24 |
25 | set_target_properties(customcommand PROPERTIES
26 | WIN32_EXECUTABLE TRUE
27 | MACOSX_BUNDLE TRUE
28 | )
29 |
30 | target_link_libraries(customcommand PRIVATE
31 | Qt::Core
32 | Qt::Gui
33 | Qt::Network
34 | Qt::SerialBus
35 | Qt::Widgets
36 | )
37 |
38 | set(custom_resource_files
39 | "images/connect.png"
40 | "images/disconnect.png"
41 | "images/settings.png"
42 | )
43 |
44 | qt_add_resources(customcommand "custom"
45 | PREFIX
46 | "/"
47 | FILES
48 | ${custom_resource_files}
49 | )
50 |
51 | install(TARGETS customcommand
52 | RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
53 | BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
54 | LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
55 | )
56 |
--------------------------------------------------------------------------------
/src/plugins/canbus/tinycan/tinycanbackend.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Denis Shienkov
2 | // Copyright (C) 2017 The Qt Company Ltd.
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4 |
5 | #ifndef TINYCANBACKEND_H
6 | #define TINYCANBACKEND_H
7 |
8 | #include
9 | #include
10 | #include
11 |
12 | #include
13 | #include
14 |
15 | QT_BEGIN_NAMESPACE
16 |
17 | class TinyCanBackendPrivate;
18 |
19 | class TinyCanBackend : public QCanBusDevice
20 | {
21 | Q_OBJECT
22 | Q_DECLARE_PRIVATE(TinyCanBackend)
23 | Q_DISABLE_COPY(TinyCanBackend)
24 | public:
25 | explicit TinyCanBackend(const QString &name, QObject *parent = nullptr);
26 | ~TinyCanBackend();
27 |
28 | bool open() override;
29 | void close() override;
30 |
31 | void setConfigurationParameter(ConfigurationKey key, const QVariant &value) override;
32 |
33 | bool writeFrame(const QCanBusFrame &newData) override;
34 |
35 | QString interpretErrorFrame(const QCanBusFrame &errorFrame) override;
36 |
37 | static bool canCreate(QString *errorReason);
38 | static QList interfaces();
39 |
40 | void resetController() override;
41 | QCanBusDeviceInfo deviceInfo() const override;
42 |
43 | private:
44 | TinyCanBackendPrivate * const d_ptr;
45 | };
46 |
47 | QT_END_NAMESPACE
48 |
49 | #endif // TINYCANBACKEND_H
50 |
--------------------------------------------------------------------------------
/tests/manual/modbus/adueditor/mainwindow.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 |
4 | #ifndef MAINWINDOW_H
5 | #define MAINWINDOW_H
6 |
7 | #include "ui_interface.h"
8 |
9 | #include
10 | #include
11 |
12 | QT_BEGIN_NAMESPACE
13 | class QModbusClient;
14 | QT_END_NAMESPACE;
15 |
16 | class DebugHandler
17 | {
18 | public:
19 | explicit DebugHandler(QtMessageHandler newMessageHandler)
20 | : oldMessageHandler(qInstallMessageHandler(newMessageHandler))
21 | {}
22 | ~DebugHandler() { qInstallMessageHandler(oldMessageHandler); }
23 |
24 | private:
25 | QtMessageHandler oldMessageHandler;
26 | };
27 |
28 | class MainWindow : public QMainWindow, private Ui::MainWindow
29 | {
30 | Q_OBJECT
31 | Q_DISABLE_COPY(MainWindow)
32 | friend class ModbusTcpClient;
33 |
34 | public:
35 | explicit MainWindow(QWidget *parent = nullptr);
36 | ~MainWindow();
37 |
38 | static MainWindow *instance();
39 | void appendToLog(const QString &msg) {
40 | logTextEdit->appendPlainText(msg);
41 | }
42 |
43 | private slots:
44 | void on_sendButton_clicked();
45 | void on_connectButton_clicked();
46 | void on_disconnectButton_clicked();
47 | void on_serialPortCombo_currentIndexChanged(int index);
48 |
49 | private:
50 | void disconnectAndDelete();
51 |
52 | private:
53 | DebugHandler m_debugHandler;
54 | QModbusClient *m_device = nullptr;
55 | };
56 |
57 | #endif // MAINWINDOW_H
58 |
--------------------------------------------------------------------------------
/src/serialbus/qmodbusrtuserialclient.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QMODBUSRTUSERIALCLIENT_H
5 | #define QMODBUSRTUSERIALCLIENT_H
6 |
7 | // The pragma is required to generate proper headers for source compatibility.
8 | #if 0
9 | #pragma qt_deprecates(QModbusRtuSerialMaster, 7.0)
10 | #endif
11 |
12 | #include
13 |
14 | QT_BEGIN_NAMESPACE
15 |
16 | class QModbusRtuSerialClientPrivate;
17 |
18 | class Q_SERIALBUS_EXPORT QModbusRtuSerialClient : public QModbusClient
19 | {
20 | Q_OBJECT
21 | Q_DECLARE_PRIVATE(QModbusRtuSerialClient)
22 |
23 | public:
24 | explicit QModbusRtuSerialClient(QObject *parent = nullptr);
25 | ~QModbusRtuSerialClient();
26 |
27 | int interFrameDelay() const;
28 | void setInterFrameDelay(int microseconds);
29 |
30 | int turnaroundDelay() const;
31 | void setTurnaroundDelay(int turnaroundDelay);
32 |
33 | protected:
34 | QModbusRtuSerialClient(QModbusRtuSerialClientPrivate &dd, QObject *parent = nullptr);
35 |
36 | void close() override;
37 | bool open() override;
38 | };
39 |
40 | #if QT_DEPRECATED_SINCE(6, 2)
41 | QT_WARNING_PUSH
42 | QT_WARNING_DISABLE_GCC("-Wattributes")
43 | using QModbusRtuSerialMaster
44 | Q_DECL_DEPRECATED_X("Please port your application to QModbusRtuSerialClient.") = QModbusRtuSerialClient;
45 | #endif
46 | QT_WARNING_POP
47 | QT_END_NAMESPACE
48 |
49 | #endif // QMODBUSRTUSERIALCLIENT_H
50 |
--------------------------------------------------------------------------------
/dist/changes-5.6.3:
--------------------------------------------------------------------------------
1 | Qt 5.6.3 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.6.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.6 series is binary compatible with the 5.5.x series.
10 | Applications compiled for 5.5 will continue to run with 5.6.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Library *
22 | ****************************************************************************
23 |
24 | QtSerialBus
25 | ------
26 |
27 | - Modbus:
28 | * [QTBUG-54834] Fixed handling of packets with payloads longer than 127
29 | bytes.
30 | * [QTBUG-56009] Fixed stack overflow in QModbusRtuSerialMaster on close.
31 | * [QTBUG-59050] Fixed use case when QModbusRtuSerialMaster would not close.
32 | This was introduced by the fix for QTBUG-56009.
33 |
34 | - CanBus:
35 | * [QTBUG-51845] Ensured that QCanBusFrame integer members are initialised
36 | with zero.
37 | * Set unused can{fd}_frame fields to zero when writing.
38 |
--------------------------------------------------------------------------------
/src/plugins/canbus/vectorcan/vectorcanbackend.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Denis Shienkov
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef VECTORCANBACKEND_H
5 | #define VECTORCANBACKEND_H
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | #include
12 | #include
13 |
14 | QT_BEGIN_NAMESPACE
15 |
16 | class VectorCanBackendPrivate;
17 |
18 | class VectorCanBackend : public QCanBusDevice
19 | {
20 | Q_OBJECT
21 | Q_DECLARE_PRIVATE(VectorCanBackend)
22 | Q_DISABLE_COPY(VectorCanBackend)
23 | public:
24 | explicit VectorCanBackend(const QString &name, QObject *parent = nullptr);
25 | ~VectorCanBackend();
26 |
27 | bool open() override;
28 | void close() override;
29 |
30 | void setConfigurationParameter(ConfigurationKey key, const QVariant &value) override;
31 |
32 | bool writeFrame(const QCanBusFrame &newData) override;
33 |
34 | QString interpretErrorFrame(const QCanBusFrame &errorFrame) override;
35 |
36 | static bool canCreate(QString *errorReason);
37 | static QList interfaces();
38 |
39 | bool hasBusStatus() const override;
40 | CanBusStatus busStatus() override;
41 | QCanBusDeviceInfo deviceInfo() const override;
42 |
43 | private:
44 | VectorCanBackendPrivate * const d_ptr;
45 | };
46 |
47 | QT_END_NAMESPACE
48 |
49 | #endif // VECTORCANBACKEND_H
50 |
--------------------------------------------------------------------------------
/examples/serialbus/can/sendframebox.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef SENDFRAMEBOX_H
5 | #define SENDFRAMEBOX_H
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | QT_BEGIN_NAMESPACE
13 | namespace Ui {
14 | class SendFrameBox;
15 | }
16 | QT_END_NAMESPACE
17 |
18 | class HexIntegerValidator : public QValidator
19 | {
20 | Q_OBJECT
21 | public:
22 | explicit HexIntegerValidator(QObject *parent = nullptr);
23 |
24 | QValidator::State validate(QString &input, int &) const;
25 |
26 | void setMaximum(uint maximum);
27 |
28 | private:
29 | uint m_maximum = 0;
30 | };
31 |
32 | class HexStringValidator : public QValidator
33 | {
34 | Q_OBJECT
35 |
36 | public:
37 | explicit HexStringValidator(QObject *parent = nullptr);
38 |
39 | QValidator::State validate(QString &input, int &pos) const;
40 |
41 | void setMaxLength(int maxLength);
42 |
43 | private:
44 | int m_maxLength = 0;
45 | };
46 |
47 | class SendFrameBox : public QGroupBox
48 | {
49 | Q_OBJECT
50 |
51 | public:
52 | explicit SendFrameBox(QWidget *parent = nullptr);
53 | ~SendFrameBox();
54 |
55 | signals:
56 | void sendFrame(const QCanBusFrame &frame);
57 |
58 | private:
59 | Ui::SendFrameBox *m_ui = nullptr;
60 |
61 | HexIntegerValidator *m_hexIntegerValidator = nullptr;
62 | HexStringValidator *m_hexStringValidator = nullptr;
63 | };
64 |
65 | #endif // SENDFRAMEBOX_H
66 |
--------------------------------------------------------------------------------
/dist/changes-5.6.2:
--------------------------------------------------------------------------------
1 | Qt 5.6.2 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.6.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.6 series is binary compatible with the 5.5.x series.
10 | Applications compiled for 5.5 will continue to run with 5.6.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Library *
22 | ****************************************************************************
23 |
24 | QtSerialBus
25 | ---------
26 |
27 | - Build system improvements
28 | - Documentation improvements
29 | - Several fixes to CAN-Examples
30 | - Several PeakCAN and SocketCAN implementation improvements
31 | - Expand license scope from "Qt GUI Toolkit" to "Qt Toolkit"
32 |
33 | - QTBUG-53171: CAN: Fix displaying extended identifiers below 0x800
34 | - QTBUG-53171: CAN: Fix displaying data bytes for remote request frames
35 | - QTBUG-53767: Fix Modbus timeout on Windows.
36 | - QTBUG-53277: Make adueditor compile on platforms with QT_NO_CLIPBOARD
37 |
--------------------------------------------------------------------------------
/src/serialbus/qmodbusrtuserialserver.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QMODBUSRTUSERIALSERVER_H
5 | #define QMODBUSRTUSERIALSERVER_H
6 |
7 | // The pragma is required to generate proper headers for source compatibility.
8 | #if 0
9 | #pragma qt_deprecates(QModbusRtuSerialSlave, 7.0)
10 | #endif
11 |
12 | #include
13 |
14 | QT_BEGIN_NAMESPACE
15 |
16 | class QModbusRtuSerialServerPrivate;
17 |
18 | class Q_SERIALBUS_EXPORT QModbusRtuSerialServer : public QModbusServer
19 | {
20 | Q_OBJECT
21 | Q_DECLARE_PRIVATE(QModbusRtuSerialServer)
22 |
23 | public:
24 | explicit QModbusRtuSerialServer(QObject *parent = nullptr);
25 | ~QModbusRtuSerialServer();
26 |
27 | bool processesBroadcast() const override;
28 |
29 | int interFrameDelay() const;
30 | void setInterFrameDelay(int microseconds);
31 |
32 | protected:
33 | QModbusRtuSerialServer(QModbusRtuSerialServerPrivate &dd, QObject *parent = nullptr);
34 |
35 | bool open() override;
36 | void close() override;
37 |
38 | QModbusResponse processRequest(const QModbusPdu &request) override;
39 | };
40 |
41 | #if QT_DEPRECATED_SINCE(6, 2)
42 | QT_WARNING_PUSH
43 | QT_WARNING_DISABLE_GCC("-Wattributes")
44 | using QModbusRtuSerialSlave
45 | Q_DECL_DEPRECATED_X("Please port your application to QModbusRtuSerialServer.") = QModbusRtuSerialServer;
46 | #endif
47 | QT_WARNING_POP
48 | QT_END_NAMESPACE
49 |
50 | #endif // QMODBUSRTUSERIALSERVER_H
51 |
--------------------------------------------------------------------------------
/src/serialbus/qcanbusdevice_p.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QCANBUSDEVICE_P_H
5 | #define QCANBUSDEVICE_P_H
6 |
7 | #include
8 | #include
9 |
10 | #include
11 |
12 | //
13 | // W A R N I N G
14 | // -------------
15 | //
16 | // This file is not part of the Qt API. It exists purely as an
17 | // implementation detail. This header file may change from version to
18 | // version without notice, or even be removed.
19 | //
20 | // We mean it.
21 | //
22 |
23 | QT_BEGIN_NAMESPACE
24 |
25 | typedef QPair ConfigEntry;
26 |
27 | class QCanBusDevicePrivate : public QObjectPrivate
28 | {
29 | Q_DECLARE_PUBLIC(QCanBusDevice)
30 | public:
31 | QCanBusDevicePrivate() {}
32 |
33 | QCanBusDevice::CanBusError lastError = QCanBusDevice::CanBusError::NoError;
34 | QCanBusDevice::CanBusDeviceState state = QCanBusDevice::UnconnectedState;
35 | QString errorText;
36 |
37 | QList incomingFrames;
38 | mutable QMutex incomingFramesGuard;
39 | QList outgoingFrames;
40 | QList configOptions;
41 |
42 | bool waitForReceivedEntered = false;
43 | bool waitForWrittenEntered = false;
44 |
45 | std::function m_resetControllerFunction;
46 | std::function m_busStatusGetter;
47 | };
48 |
49 | QT_END_NAMESPACE
50 |
51 | #endif // QCANBUSDEVICE_P_H
52 |
--------------------------------------------------------------------------------
/src/plugins/canbus/tinycan/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Denis Shienkov
2 | // Copyright (C) 2017 The Qt Company Ltd.
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4 |
5 | #include "tinycanbackend.h"
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | #include
12 |
13 | QT_BEGIN_NAMESPACE
14 |
15 | Q_LOGGING_CATEGORY(QT_CANBUS_PLUGINS_TINYCAN, "qt.canbus.plugins.tinycan")
16 |
17 | class TinyCanBusPlugin : public QObject, public QCanBusFactory
18 | {
19 | Q_OBJECT
20 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QCanBusFactory" FILE "plugin.json")
21 | Q_INTERFACES(QCanBusFactory)
22 |
23 | public:
24 | QList availableDevices(QString *errorMessage) const override
25 | {
26 | Q_UNUSED(errorMessage);
27 | return TinyCanBackend::interfaces();
28 | }
29 |
30 | QCanBusDevice *createDevice(const QString &interfaceName, QString *errorMessage) const override
31 | {
32 | QString errorReason;
33 | if (!TinyCanBackend::canCreate(&errorReason)) {
34 | qCWarning(QT_CANBUS_PLUGINS_TINYCAN, "%ls", qUtf16Printable(errorReason));
35 | if (errorMessage)
36 | *errorMessage = errorReason;
37 | return nullptr;
38 | }
39 |
40 | auto device = new TinyCanBackend(interfaceName);
41 | return device;
42 | }
43 | };
44 |
45 | QT_END_NAMESPACE
46 |
47 | #include "main.moc"
48 |
--------------------------------------------------------------------------------
/src/serialbus/qmodbus_symbols_p.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QMODBUS_SYMBOLS_P_H
5 | #define QMODBUS_SYMBOLS_P_H
6 |
7 | //
8 | // W A R N I N G
9 | // -------------
10 | //
11 | // This file is not part of the Qt API. It exists purely as an
12 | // implementation detail. This header file may change from version to
13 | // version without notice, or even be removed.
14 | //
15 | // We mean it.
16 | //
17 |
18 | enum Coil {
19 | On = 0xff00,
20 | Off = 0x0000
21 | };
22 |
23 | namespace Diagnostics {
24 |
25 | enum SubFunctionCode {
26 | ReturnQueryData = 0x0000,
27 | RestartCommunicationsOption = 0x0001,
28 | ReturnDiagnosticRegister = 0x0002,
29 | ChangeAsciiInputDelimiter = 0x0003,
30 | ForceListenOnlyMode = 0x0004,
31 | ClearCountersAndDiagnosticRegister = 0x000a,
32 | ReturnBusMessageCount = 0x000b,
33 | ReturnBusCommunicationErrorCount = 0x000c, // CRC error counter
34 | ReturnBusExceptionErrorCount = 0x000d,
35 | ReturnServerMessageCount = 0x000e,
36 | ReturnServerNoResponseCount = 0x000f,
37 | ReturnServerNAKCount = 0x0010,
38 | ReturnServerBusyCount = 0x0011,
39 | ReturnBusCharacterOverrunCount = 0x0012,
40 | ClearOverrunCounterAndFlag = 0x0014
41 | };
42 |
43 | }
44 |
45 | namespace EncapsulatedInterfaceTransport {
46 |
47 | enum SubFunctionCode {
48 | CanOpenGeneralReference = 0x0D,
49 | ReadDeviceIdentification = 0x0E
50 | };
51 |
52 | }
53 |
54 | #endif // QMODBUS_SYMBOLS_P_H
55 |
--------------------------------------------------------------------------------
/dist/changes-5.9.4:
--------------------------------------------------------------------------------
1 | Qt 5.9.4 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.9.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.9 series is binary compatible with the 5.8.x series.
10 | Applications compiled for 5.8 will continue to run with 5.9.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.9.4 Changes *
22 | ****************************************************************************
23 |
24 | QtSerialBus
25 | ------
26 |
27 | - SocketCAN
28 | * [QTBUG-64406] Fixed compiling the SocketCAN plugin with older Kernels
29 | without support for CAN FD bitrate switch and error state indicator.
30 |
31 | - TinyCAN
32 | * [QTBUG-65474] Fixed compiliation with MSVC 2013
33 | * The function availableDevices() now returns {"can0.0"} instead
34 | {"can0.0", "can0.1"} for the TinyCAN plugin. This value is
35 | hardcoded for now as available devices cannot be detected.
36 | The function will be changed in later Qt versions to return the
37 | correct values once QTBUG-62958 is solved.
38 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/mainwindow.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef MAINWINDOW_H
5 | #define MAINWINDOW_H
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | QT_BEGIN_NAMESPACE
12 |
13 | class QLineEdit;
14 |
15 | namespace Ui {
16 | class MainWindow;
17 | class SettingsDialog;
18 | }
19 |
20 | QT_END_NAMESPACE
21 |
22 | class SettingsDialog;
23 |
24 | class MainWindow : public QMainWindow
25 | {
26 | Q_OBJECT
27 |
28 | public:
29 | explicit MainWindow(QWidget *parent = nullptr);
30 | ~MainWindow();
31 |
32 | private Q_SLOTS:
33 | void onConnectButtonClicked();
34 | void onStateChanged(int state);
35 |
36 | void coilChanged(int id);
37 | void discreteInputChanged(int id);
38 | void bitChanged(int id, QModbusDataUnit::RegisterType table, bool value);
39 |
40 | void setRegister(const QString &value);
41 | void updateWidgets(QModbusDataUnit::RegisterType table, int address, int size);
42 |
43 | void onCurrentConnectTypeChanged(int);
44 |
45 | void handleDeviceError(QModbusDevice::Error newError);
46 |
47 | private:
48 | void initActions();
49 | void setupDeviceData();
50 | void setupWidgetContainers();
51 |
52 | Ui::MainWindow *ui = nullptr;
53 | QModbusServer *modbusDevice = nullptr;
54 |
55 | QButtonGroup coilButtons;
56 | QButtonGroup discreteButtons;
57 | QHash registers;
58 | SettingsDialog *m_settingsDialog = nullptr;
59 | };
60 |
61 | #endif // MAINWINDOW_H
62 |
--------------------------------------------------------------------------------
/tests/auto/plugins/testcanbus/testcanbackend.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 |
4 | #include "testcanbackend.h"
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | QT_BEGIN_NAMESPACE
11 |
12 | TestCanBackend::TestCanBackend() :
13 | simulateReceivingTimer(new QTimer(this))
14 | {
15 | connect(simulateReceivingTimer, &QTimer::timeout, this, [this]() {
16 | const quint64 timeStamp = QDateTime::currentDateTime().toMSecsSinceEpoch();
17 | QCanBusFrame dummyFrame(12, "def");
18 | dummyFrame.setTimeStamp(QCanBusFrame::TimeStamp::fromMicroSeconds(timeStamp * 1000));
19 |
20 | enqueueReceivedFrames({dummyFrame});
21 | });
22 | }
23 |
24 | bool TestCanBackend::open()
25 | {
26 | simulateReceivingTimer->start(1000);
27 | setState(QCanBusDevice::ConnectedState);
28 | return true;
29 | }
30 |
31 | void TestCanBackend::close()
32 | {
33 | simulateReceivingTimer->stop();
34 | setState(QCanBusDevice::UnconnectedState);
35 | }
36 |
37 | bool TestCanBackend::writeFrame(const QCanBusFrame &data)
38 | {
39 | qDebug("DummyBackend::writeFrame: %ls", qUtf16Printable(data.toString()));
40 | return true;
41 | }
42 |
43 | QString TestCanBackend::interpretErrorFrame(const QCanBusFrame &/*errorFrame*/)
44 | {
45 | return QString();
46 | }
47 |
48 | QList TestCanBackend::interfaces()
49 | {
50 | return {createDeviceInfo(QStringLiteral("testcan"), QStringLiteral("can0"), true, true)};
51 | }
52 |
53 | QT_END_NAMESPACE
54 |
--------------------------------------------------------------------------------
/dist/changes-5.6.1:
--------------------------------------------------------------------------------
1 | Qt 5.6.1 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.6.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.6 series is binary compatible with the 5.5.x series.
10 | Applications compiled for 5.5 will continue to run with 5.6.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Library *
22 | ****************************************************************************
23 |
24 | QtSerialBus
25 | ---------
26 |
27 | - Build system improvements
28 | - Documentation improvements
29 | - Several fixes to CAN-Examples
30 | - Several Qt coding style related fixes
31 |
32 | - QTBUG-52953: Doc: Remove repository name from examplesinstallpath
33 | - QTBUG-53171: CAN-Example: Fix not receiving empty CAN frames
34 | - QTBUG-51932: Make socketcan backend compile on pre 3.6 kernels
35 | - QTBUG-51655: Make C++11 test less restrictive
36 | - QTBUG-51745: Fix 'multiple definition' with static build (Windows)
37 | - QTBUG-51655: Update .pro file and config tests with stricter C++11 requirements
38 |
--------------------------------------------------------------------------------
/dist/changes-5.9.3:
--------------------------------------------------------------------------------
1 | Qt 5.9.3 is a bug-fix release. It maintains both forward and backward
2 | compatibility (source and binary) with Qt 5.9.0.
3 |
4 | For more details, refer to the online documentation included in this
5 | distribution. The documentation is also available online:
6 |
7 | http://doc.qt.io/qt-5/index.html
8 |
9 | The Qt version 5.9 series is binary compatible with the 5.8.x series.
10 | Applications compiled for 5.8 will continue to run with 5.9.
11 |
12 | Some of the changes listed in this file include issue tracking numbers
13 | corresponding to tasks in the Qt Bug Tracker:
14 |
15 | https://bugreports.qt.io/
16 |
17 | Each of these identifiers can be entered in the bug tracker to obtain more
18 | information about a particular change.
19 |
20 | ****************************************************************************
21 | * Qt 5.9.3 Changes *
22 | ****************************************************************************
23 |
24 | QtSerialBus
25 | ------
26 |
27 | - SystecCAN:
28 | * [QTBUG-63833] Fixed that availableDevices() could return
29 | wrong device numbers.
30 | * Fixed that availableDevices() did only return the first two
31 | channels of the first device.
32 |
33 | - PeakCAN:
34 | * [QTBUG-63428] Fixed that connect() always returned false
35 | under Linux.
36 | * Peak status frames are no longer wrongly converted into
37 | QCanBusFrame::DataFrame, they are simply dropped for now.
38 | In a later Qt version they might by converted into proper
39 | QCanBusFrame::ErrorFrame, together with an interpretErrorFrame()
40 | implementation.
41 |
--------------------------------------------------------------------------------
/src/plugins/canbus/systeccan/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #include "systeccanbackend.h"
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include
11 |
12 | QT_BEGIN_NAMESPACE
13 |
14 | Q_LOGGING_CATEGORY(QT_CANBUS_PLUGINS_SYSTECCAN, "qt.canbus.plugins.systeccan")
15 |
16 | class SystecCanBusPlugin : public QObject, public QCanBusFactory
17 | {
18 | Q_OBJECT
19 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QCanBusFactory" FILE "plugin.json")
20 | Q_INTERFACES(QCanBusFactory)
21 |
22 | public:
23 | QList availableDevices(QString *errorMessage) const override
24 | {
25 | if (Q_UNLIKELY(!SystecCanBackend::canCreate(errorMessage)))
26 | return QList();
27 |
28 | return SystecCanBackend::interfaces();
29 | }
30 |
31 | QCanBusDevice *createDevice(const QString &interfaceName, QString *errorMessage) const override
32 | {
33 | QString errorReason;
34 | if (Q_UNLIKELY(!SystecCanBackend::canCreate(&errorReason))) {
35 | qCWarning(QT_CANBUS_PLUGINS_SYSTECCAN, "%ls", qUtf16Printable(errorReason));
36 | if (errorMessage)
37 | *errorMessage = errorReason;
38 | return nullptr;
39 | }
40 |
41 | auto *device = new SystecCanBackend(interfaceName);
42 | return device;
43 | }
44 | };
45 |
46 | QT_END_NAMESPACE
47 |
48 | #include "main.moc"
49 |
--------------------------------------------------------------------------------
/tests/manual/modbus/adueditor/plaintextedit.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 |
4 | #ifndef PLAINTEXTEDIT_H
5 | #define PLAINTEXTEDIT_H
6 |
7 | #include
8 | #include
9 |
10 | class PlainTextEdit : public QPlainTextEdit
11 | {
12 | Q_OBJECT
13 | Q_DISABLE_COPY(PlainTextEdit)
14 |
15 | public Q_SLOT:
16 | void setFocus() {
17 | QWidget::setFocus();
18 | }
19 |
20 | public:
21 | explicit PlainTextEdit(QWidget *parent = nullptr)
22 | : QPlainTextEdit(parent)
23 | {}
24 |
25 | void keyPressEvent(QKeyEvent *e)
26 | {
27 | switch (e->key()) {
28 | case Qt::Key_Delete:
29 | case Qt::Key_Backspace:
30 | setTextInteractionFlags(textInteractionFlags() | Qt::TextEditable);
31 | QPlainTextEdit::keyPressEvent(e);
32 | setTextInteractionFlags(textInteractionFlags() &~ Qt::TextEditable);
33 | break;
34 | default:
35 | QPlainTextEdit::keyPressEvent(e);
36 | }
37 | }
38 |
39 | void contextMenuEvent(QContextMenuEvent *event)
40 | {
41 | QMenu menu(this);
42 | menu.addAction(tr("Clear"), this, &QPlainTextEdit::clear);
43 | #ifndef QT_NO_CLIPBOARD
44 | menu.addAction(tr("Copy"), QKeySequence::Copy, this, &QPlainTextEdit::copy);
45 | #endif
46 | menu.addSeparator();
47 | menu.addAction(tr("Select All"), QKeySequence::SelectAll,
48 | this, &QPlainTextEdit::selectAll);
49 | menu.exec(event->globalPos());
50 | }
51 | };
52 |
53 | #endif // PLAINTEXTEDIT_H
54 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/server/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | cmake_minimum_required(VERSION 3.16)
5 | project(modbusserver LANGUAGES CXX)
6 |
7 | if(NOT DEFINED INSTALL_EXAMPLESDIR)
8 | set(INSTALL_EXAMPLESDIR "examples")
9 | endif()
10 |
11 | set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/serialbus/modbus/server")
12 |
13 | find_package(Qt6 REQUIRED COMPONENTS Core Gui Network SerialBus Widgets)
14 |
15 | qt_standard_project_setup()
16 |
17 | qt_add_executable(modbusserver
18 | main.cpp
19 | mainwindow.cpp mainwindow.h mainwindow.ui
20 | settingsdialog.cpp settingsdialog.h settingsdialog.ui
21 | )
22 |
23 | set_target_properties(modbusserver PROPERTIES
24 | WIN32_EXECUTABLE TRUE
25 | MACOSX_BUNDLE TRUE
26 | )
27 |
28 | target_link_libraries(modbusserver PRIVATE
29 | Qt::Core
30 | Qt::Gui
31 | Qt::Network
32 | Qt::SerialBus
33 | Qt::Widgets
34 | )
35 |
36 | # Resources:
37 | set(server_resource_files
38 | "images/application-exit.png"
39 | "images/connect.png"
40 | "images/disconnect.png"
41 | "images/settings.png"
42 | )
43 |
44 | qt_add_resources(modbusserver "server"
45 | PREFIX
46 | "/"
47 | FILES
48 | ${server_resource_files}
49 | )
50 |
51 | if(QT_FEATURE_modbus_serialport)
52 | target_link_libraries(modbusserver PRIVATE
53 | Qt::SerialPort
54 | )
55 | endif()
56 |
57 | install(TARGETS modbusserver
58 | RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
59 | BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
60 | LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
61 | )
62 |
--------------------------------------------------------------------------------
/src/plugins/canbus/vectorcan/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Denis Shienkov
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #include "vectorcanbackend.h"
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include
11 |
12 | QT_BEGIN_NAMESPACE
13 |
14 | Q_LOGGING_CATEGORY(QT_CANBUS_PLUGINS_VECTORCAN, "qt.canbus.plugins.vectorcan")
15 |
16 | class VectorCanBusPlugin : public QObject, public QCanBusFactory
17 | {
18 | Q_OBJECT
19 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QCanBusFactory" FILE "plugin.json")
20 | Q_INTERFACES(QCanBusFactory)
21 |
22 | public:
23 | QList availableDevices(QString *errorMessage) const override
24 | {
25 | if (Q_UNLIKELY(!VectorCanBackend::canCreate(errorMessage)))
26 | return QList();
27 |
28 | return VectorCanBackend::interfaces();
29 | }
30 |
31 | QCanBusDevice *createDevice(const QString &interfaceName, QString *errorMessage) const override
32 | {
33 | QString errorReason;
34 | if (Q_UNLIKELY(!VectorCanBackend::canCreate(&errorReason))) {
35 | qCWarning(QT_CANBUS_PLUGINS_VECTORCAN, "%ls", qUtf16Printable(errorReason));
36 | if (errorMessage)
37 | *errorMessage = errorReason;
38 | return nullptr;
39 | }
40 |
41 | auto device = new VectorCanBackend(interfaceName);
42 | return device;
43 | }
44 | };
45 |
46 | QT_END_NAMESPACE
47 |
48 | #include "main.moc"
49 |
--------------------------------------------------------------------------------
/examples/serialbus/can/mainwindow.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef MAINWINDOW_H
5 | #define MAINWINDOW_H
6 |
7 | #include
8 | #include
9 |
10 | class ConnectDialog;
11 | class ReceivedFramesModel;
12 |
13 | QT_BEGIN_NAMESPACE
14 |
15 | class QCanBusFrame;
16 | class QLabel;
17 | class QTimer;
18 |
19 | namespace Ui {
20 | class MainWindow;
21 | }
22 |
23 | QT_END_NAMESPACE
24 |
25 | class MainWindow : public QMainWindow
26 | {
27 | Q_OBJECT
28 |
29 | public:
30 | explicit MainWindow(QWidget *parent = nullptr);
31 | ~MainWindow() override;
32 |
33 | private slots:
34 | void processReceivedFrames();
35 | void sendFrame(const QCanBusFrame &frame) const;
36 | void processErrors(QCanBusDevice::CanBusError) const;
37 | void connectDevice();
38 | void busStatus();
39 | void disconnectDevice();
40 | void processFramesWritten(qint64);
41 | void onAppendFramesTimeout();
42 |
43 | protected:
44 | void closeEvent(QCloseEvent *event) override;
45 |
46 | private:
47 | void initActionsConnections();
48 |
49 | qint64 m_numberFramesWritten = 0;
50 | qint64 m_numberFramesReceived = 0;
51 | Ui::MainWindow *m_ui = nullptr;
52 | QLabel *m_status = nullptr;
53 | QLabel *m_written = nullptr;
54 | QLabel *m_received = nullptr;
55 | ConnectDialog *m_connectDialog = nullptr;
56 | std::unique_ptr m_canDevice;
57 | QTimer *m_busStatusTimer = nullptr;
58 | QTimer *m_appendTimer = nullptr;
59 | ReceivedFramesModel *m_model = nullptr;
60 | };
61 |
62 | #endif // MAINWINDOW_H
63 |
--------------------------------------------------------------------------------
/src/plugins/canbus/tinycan/tinycanbackend_p.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Denis Shienkov
2 | // Copyright (C) 2017 The Qt Company Ltd.
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4 |
5 | #ifndef TINYCANBACKEND_P_H
6 | #define TINYCANBACKEND_P_H
7 |
8 | #include "tinycanbackend.h"
9 | #include "tinycan_symbols_p.h"
10 |
11 | //
12 | // W A R N I N G
13 | // -------------
14 | //
15 | // This file is not part of the Qt API. It exists purely as an
16 | // implementation detail. This header file may change from version to
17 | // version without notice, or even be removed.
18 | //
19 | // We mean it.
20 | //
21 |
22 | QT_BEGIN_NAMESPACE
23 |
24 | class QWinEventNotifier;
25 | class QTimer;
26 |
27 | class TinyCanBackendPrivate
28 | {
29 | Q_DECLARE_PUBLIC(TinyCanBackend)
30 | public:
31 | TinyCanBackendPrivate(TinyCanBackend *q);
32 | ~TinyCanBackendPrivate();
33 |
34 | bool open();
35 | void close();
36 | bool setConfigurationParameter(QCanBusDevice::ConfigurationKey key, const QVariant &value);
37 |
38 | QString systemErrorString(int errorCode);
39 | void setupChannel(const QString &interfaceName);
40 | void setupDefaultConfigurations();
41 | void startWrite();
42 | void startRead();
43 | void startupDriver();
44 | void cleanupDriver();
45 | void resetController();
46 |
47 | bool setBitRate(int bitrate);
48 |
49 | TinyCanBackend * const q_ptr;
50 |
51 | bool isOpen = false;
52 | int channelIndex = INDEX_INVALID;
53 | QTimer *writeNotifier = nullptr;
54 | };
55 |
56 | QT_END_NAMESPACE
57 |
58 | #endif // TINYCANBACKEND_P_H
59 |
--------------------------------------------------------------------------------
/examples/serialbus/can/receivedframesmodel.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2021 Evgeny Shtanov
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef RECEIVEDFRAMESMODEL_H
5 | #define RECEIVEDFRAMESMODEL_H
6 |
7 | #include "common.h"
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | class ReceivedFramesModel : public QAbstractTableModel
14 | {
15 | public:
16 | explicit ReceivedFramesModel(QObject *parent = nullptr);
17 |
18 | void appendFrame(const QStringList &slist);
19 | void appendFrames(const QList &slvector);
20 | int columnCount(const QModelIndex &parent = QModelIndex()) const override;
21 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
22 | QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
23 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
24 | void clear();
25 | void setQueueLimit(int limit = 0); // 0 - unlimited
26 | int getQueueLimit() { return m_queueLimit; }
27 | bool needUpdate() const;
28 | void update();
29 |
30 | protected:
31 | bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
32 |
33 | private:
34 | void appendFramesRingBuffer(const QList &slvector);
35 | void appendFramesUnlimited(const QList &slvector);
36 |
37 | private:
38 | QQueue m_framesQueue;
39 | QList m_framesAccumulator; // Temporary variable to insert frames data
40 | int m_queueLimit = 0;
41 | };
42 |
43 | #endif // RECEIVEDFRAMESMODEL_H
44 |
--------------------------------------------------------------------------------
/src/plugins/canbus/passthrucan/passthrucanbackend.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Ford Motor Company.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef PASSTHRUCAN_PASSTHRUCANBACKEND_H
5 | #define PASSTHRUCAN_PASSTHRUCANBACKEND_H
6 |
7 | #include
8 | #include
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | QT_BEGIN_NAMESPACE
15 |
16 | class PassThruCanIO;
17 |
18 | class PassThruCanBackend : public QCanBusDevice
19 | {
20 | Q_OBJECT
21 | Q_DISABLE_COPY(PassThruCanBackend)
22 | public:
23 | explicit PassThruCanBackend(const QString &name, QObject *parent = nullptr);
24 | virtual ~PassThruCanBackend();
25 |
26 | void setConfigurationParameter(ConfigurationKey key, const QVariant &value) override;
27 | bool writeFrame(const QCanBusFrame &frame) override;
28 | QString interpretErrorFrame(const QCanBusFrame &errorFrame) override;
29 |
30 | static QList interfaces();
31 | QCanBusDeviceInfo deviceInfo() const override;
32 |
33 | protected:
34 | bool open() override;
35 | void close() override;
36 |
37 | private:
38 | void ackOpenFinished(bool success);
39 | void ackCloseFinished();
40 | void applyConfig(QCanBusDevice::ConfigurationKey key, const QVariant &value);
41 |
42 | QString m_deviceName;
43 | QThread m_ioThread;
44 | PassThruCanIO * m_canIO;
45 | };
46 |
47 | QT_END_NAMESPACE
48 |
49 | Q_DECLARE_METATYPE(QCanBusDevice::CanBusError)
50 | Q_DECLARE_METATYPE(QList)
51 |
52 | #endif // PASSTHRUCAN_PASSTHRUCANBACKEND_H
53 |
--------------------------------------------------------------------------------
/src/plugins/canbus/peakcan/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Denis Shienkov
2 | // Copyright (C) 2017 The Qt Company Ltd.
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4 |
5 | #include "peakcanbackend.h"
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | #include
12 |
13 | QT_BEGIN_NAMESPACE
14 |
15 | Q_LOGGING_CATEGORY(QT_CANBUS_PLUGINS_PEAKCAN, "qt.canbus.plugins.peakcan")
16 |
17 | class PeakCanBusPlugin : public QObject, public QCanBusFactory
18 | {
19 | Q_OBJECT
20 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QCanBusFactory" FILE "plugin.json")
21 | Q_INTERFACES(QCanBusFactory)
22 |
23 | public:
24 | QList availableDevices(QString *errorMessage) const override
25 | {
26 | if (Q_UNLIKELY(!PeakCanBackend::canCreate(errorMessage)))
27 | return QList();
28 |
29 | return PeakCanBackend::interfaces();
30 | }
31 |
32 | QCanBusDevice *createDevice(const QString &interfaceName, QString *errorMessage) const override
33 | {
34 | QString errorReason;
35 | if (!PeakCanBackend::canCreate(&errorReason)) {
36 | qCWarning(QT_CANBUS_PLUGINS_PEAKCAN, "%ls", qUtf16Printable(errorReason));
37 | if (errorMessage)
38 | *errorMessage = errorReason;
39 | return nullptr;
40 | }
41 |
42 | auto device = new PeakCanBackend(interfaceName);
43 | return device;
44 | }
45 | };
46 |
47 | QT_END_NAMESPACE
48 |
49 | #include "main.moc"
50 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/settingsdialog.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #include "settingsdialog.h"
5 | #include "ui_settingsdialog.h"
6 |
7 | SettingsDialog::SettingsDialog(QWidget *parent) :
8 | QDialog(parent),
9 | ui(new Ui::SettingsDialog)
10 | {
11 | ui->setupUi(this);
12 |
13 | ui->parityCombo->setCurrentIndex(1);
14 | #if QT_CONFIG(modbus_serialport)
15 | ui->baudCombo->setCurrentText(QString::number(m_settings.baud));
16 | ui->dataBitsCombo->setCurrentText(QString::number(m_settings.dataBits));
17 | ui->stopBitsCombo->setCurrentText(QString::number(m_settings.stopBits));
18 | #endif
19 | ui->timeoutSpinner->setValue(m_settings.responseTime);
20 | ui->retriesSpinner->setValue(m_settings.numberOfRetries);
21 |
22 | connect(ui->applyButton, &QPushButton::clicked, this, [this]() {
23 | #if QT_CONFIG(modbus_serialport)
24 | m_settings.parity = ui->parityCombo->currentIndex();
25 | if (m_settings.parity > 0)
26 | m_settings.parity++;
27 | m_settings.baud = ui->baudCombo->currentText().toInt();
28 | m_settings.dataBits = ui->dataBitsCombo->currentText().toInt();
29 | m_settings.stopBits = ui->stopBitsCombo->currentText().toInt();
30 | #endif
31 | m_settings.responseTime = ui->timeoutSpinner->value();
32 | m_settings.numberOfRetries = ui->retriesSpinner->value();
33 |
34 | hide();
35 | });
36 | }
37 |
38 | SettingsDialog::~SettingsDialog()
39 | {
40 | delete ui;
41 | }
42 |
43 | SettingsDialog::Settings SettingsDialog::settings() const
44 | {
45 | return m_settings;
46 | }
47 |
--------------------------------------------------------------------------------
/src/serialbus/qcancommondefinitions.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2022 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QCANCOMMONDEFINITIONS_H
5 | #define QCANCOMMONDEFINITIONS_H
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | #include
13 |
14 | QT_BEGIN_NAMESPACE
15 |
16 | namespace QtCanBus {
17 |
18 | enum class DataSource : quint8 {
19 | Payload = 0,
20 | FrameId,
21 | };
22 |
23 | enum class DataFormat : quint8 {
24 | SignedInteger = 0,
25 | UnsignedInteger,
26 | Float,
27 | Double,
28 | AsciiString,
29 | };
30 |
31 | enum class MultiplexState : quint8 {
32 | None = 0x00,
33 | MultiplexorSwitch = 0x01,
34 | MultiplexedSignal = 0x02,
35 | SwitchAndSignal = MultiplexorSwitch | MultiplexedSignal,
36 | };
37 |
38 | enum class UniqueId : quint32 {};
39 |
40 | inline UniqueId qbswap(UniqueId src) noexcept
41 | {
42 | return UniqueId{qbswap_helper(qToUnderlying(src))};
43 | }
44 |
45 | } // namespace QtCanBus
46 |
47 |
48 | #ifndef QT_NO_DEBUG_STREAM
49 |
50 | class QDebug;
51 |
52 | namespace QtCanBus {
53 | Q_SERIALBUS_EXPORT QDebug operator<<(QDebug dbg, DataSource source);
54 | Q_SERIALBUS_EXPORT QDebug operator<<(QDebug dbg, DataFormat format);
55 | Q_SERIALBUS_EXPORT QDebug operator<<(QDebug dbg, MultiplexState state);
56 | Q_SERIALBUS_EXPORT QDebug operator<<(QDebug dbg, UniqueId uid);
57 | } // namespace QtCanBus
58 |
59 | #endif // QT_NO_DEBUG_STREAM
60 |
61 | QT_END_NAMESPACE
62 |
63 | #endif // QCANCOMMONDEFINITIONS_H
64 |
--------------------------------------------------------------------------------
/examples/serialbus/can/connectdialog.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #ifndef CONNECTDIALOG_H
5 | #define CONNECTDIALOG_H
6 |
7 | #include
8 | #include
9 |
10 | #include
11 |
12 | QT_BEGIN_NAMESPACE
13 |
14 | namespace Ui {
15 | class ConnectDialog;
16 | }
17 | class QSettings;
18 |
19 | QT_END_NAMESPACE
20 |
21 | class ConnectDialog : public QDialog
22 | {
23 | Q_OBJECT
24 |
25 | public:
26 | typedef QPair ConfigurationItem;
27 |
28 | struct Settings {
29 | QString pluginName;
30 | QString deviceInterfaceName;
31 | QList configurations;
32 | bool useConfigurationEnabled = false;
33 | bool useModelRingBuffer = true;
34 | int modelRingBufferSize = 1000;
35 | bool useAutoscroll = false;
36 | };
37 |
38 | explicit ConnectDialog(QWidget *parent = nullptr);
39 | ~ConnectDialog() override;
40 |
41 | Settings settings() const;
42 |
43 | private slots:
44 | void pluginChanged(const QString &plugin);
45 | void interfaceChanged(const QString &interface);
46 | void ok();
47 | void cancel();
48 |
49 | private:
50 | QString configurationValue(QCanBusDevice::ConfigurationKey key);
51 | void restoreSettings();
52 | void revertSettings();
53 | void saveSettings();
54 | void updateSettings();
55 |
56 | Ui::ConnectDialog *m_ui = nullptr;
57 | Settings m_currentSettings;
58 | QList m_interfaces;
59 | QSettings *m_settings = nullptr;
60 | };
61 |
62 | #endif // CONNECTDIALOG_H
63 |
--------------------------------------------------------------------------------
/examples/serialbus/modbus/client/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | cmake_minimum_required(VERSION 3.16)
5 | project(modbusclient LANGUAGES CXX)
6 |
7 | if(NOT DEFINED INSTALL_EXAMPLESDIR)
8 | set(INSTALL_EXAMPLESDIR "examples")
9 | endif()
10 |
11 | set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/serialbus/modbus/client")
12 |
13 | find_package(Qt6 REQUIRED COMPONENTS Core Gui Network SerialBus Widgets)
14 |
15 | qt_standard_project_setup()
16 |
17 | qt_add_executable(modbusclient
18 | main.cpp
19 | mainwindow.cpp mainwindow.h mainwindow.ui
20 | settingsdialog.cpp settingsdialog.h settingsdialog.ui
21 | writeregistermodel.cpp writeregistermodel.h
22 | )
23 |
24 | set_target_properties(modbusclient PROPERTIES
25 | WIN32_EXECUTABLE TRUE
26 | MACOSX_BUNDLE TRUE
27 | )
28 |
29 | target_link_libraries(modbusclient PRIVATE
30 | Qt::Core
31 | Qt::Gui
32 | Qt::Network
33 | Qt::SerialBus
34 | Qt::Widgets
35 | )
36 |
37 | # Resources:
38 | set(client_resource_files
39 | "images/application-exit.png"
40 | "images/connect.png"
41 | "images/disconnect.png"
42 | "images/settings.png"
43 | )
44 |
45 | qt_add_resources(modbusclient "client"
46 | PREFIX
47 | "/"
48 | FILES
49 | ${client_resource_files}
50 | )
51 |
52 | if(QT_FEATURE_modbus_serialport)
53 | target_link_libraries(modbusclient PRIVATE
54 | Qt::SerialPort
55 | )
56 | endif()
57 |
58 | install(TARGETS modbusclient
59 | RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
60 | BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
61 | LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
62 | )
63 |
--------------------------------------------------------------------------------
/src/serialbus/qcanbusdeviceinfo.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QCANBUSDEVICEINFO_H
5 | #define QCANBUSDEVICEINFO_H
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | QT_BEGIN_NAMESPACE
12 |
13 | class QCanBusDeviceInfoPrivate;
14 |
15 | QT_DECLARE_QSDP_SPECIALIZATION_DTOR(QCanBusDeviceInfoPrivate)
16 |
17 | class Q_SERIALBUS_EXPORT QCanBusDeviceInfo
18 | {
19 | public:
20 | QCanBusDeviceInfo() = delete;
21 | QCanBusDeviceInfo(const QCanBusDeviceInfo &other);
22 | QCanBusDeviceInfo(QCanBusDeviceInfo &&other) noexcept = default;
23 | ~QCanBusDeviceInfo();
24 |
25 | void swap(QCanBusDeviceInfo &other) noexcept
26 | {
27 | d_ptr.swap(other.d_ptr);
28 | }
29 |
30 | QCanBusDeviceInfo &operator=(const QCanBusDeviceInfo &other);
31 | QCanBusDeviceInfo &operator=(QCanBusDeviceInfo &&other) noexcept
32 | {
33 | swap(other);
34 | return *this;
35 | }
36 |
37 | QString plugin() const;
38 | QString name() const;
39 | QString description() const;
40 | QString serialNumber() const;
41 | QString alias() const;
42 | int channel() const;
43 |
44 | bool hasFlexibleDataRate() const;
45 | bool isVirtual() const;
46 |
47 | private:
48 | friend class QCanBusDevice;
49 |
50 | explicit QCanBusDeviceInfo(QCanBusDeviceInfoPrivate &dd);
51 |
52 | QSharedDataPointer d_ptr;
53 | };
54 |
55 | Q_DECLARE_SHARED(QCanBusDeviceInfo)
56 |
57 | QT_END_NAMESPACE
58 |
59 | #endif // QCANBUSDEVICEINFO_H
60 |
--------------------------------------------------------------------------------
/src/tools/canbusutil/canbusutil.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3 |
4 | #ifndef CANBUSUTIL_H
5 | #define CANBUSUTIL_H
6 |
7 | #include "readtask.h"
8 |
9 | #include
10 |
11 | QT_BEGIN_NAMESPACE
12 |
13 | class QCanBusFrame;
14 | class QCoreApplication;
15 | class QTextStream;
16 |
17 | QT_END_NAMESPACE
18 |
19 | class CanBusUtil : public QObject
20 | {
21 | Q_OBJECT
22 | public:
23 | explicit CanBusUtil(QTextStream &output, QCoreApplication &app, QObject *parent = nullptr);
24 |
25 | void setShowTimeStamp(bool showTimeStamp);
26 | void setShowFlags(bool showFlags);
27 | void setConfigurationParameter(QCanBusDevice::ConfigurationKey key, const QVariant &value);
28 | bool start(const QString &pluginName, const QString &deviceName, const QString &data = QString());
29 | int printPlugins();
30 | int printDevices(const QString &pluginName);
31 |
32 | private:
33 | bool parseDataField(QCanBusFrame::FrameId &id, QString &payload);
34 | bool setFrameFromPayload(QString payload, QCanBusFrame *frame);
35 | bool connectCanDevice();
36 | bool sendData();
37 |
38 | private:
39 | QCanBus *m_canBus = nullptr;
40 | QTextStream &m_output;
41 | QCoreApplication &m_app;
42 | bool m_listening = false;
43 | QString m_pluginName;
44 | QString m_deviceName;
45 | QString m_data;
46 | std::unique_ptr m_canDevice;
47 | ReadTask *m_readTask = nullptr;
48 | using ConfigurationParameter = QHash;
49 | ConfigurationParameter m_configurationParameter;
50 | };
51 |
52 | #endif // CANBUSUTIL_H
53 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | cmake_minimum_required(VERSION 3.16)
5 |
6 | include(.cmake.conf)
7 | project(QtSerialBus
8 | VERSION "${QT_REPO_MODULE_VERSION}"
9 | DESCRIPTION "Qt SerialBus Libraries"
10 | HOMEPAGE_URL "https://qt.io/"
11 | LANGUAGES CXX C
12 | )
13 |
14 | # Make sure we use the fixed BASE argument of qt_add_resource.
15 | set(QT_USE_FIXED_QT_ADD_RESOURCE_BASE TRUE)
16 |
17 | if(WASM)
18 | message(NOTICE "Skipping the build as the condition \"NOT WASM\" is not met.")
19 | return()
20 | endif()
21 | if(INTEGRITY)
22 | message(NOTICE "Skipping the build as the condition \"NOT INTEGRITY\" is not met.")
23 | return()
24 | endif()
25 | if(VXWORKS)
26 | message(NOTICE "Skipping the build as the condition \"NOT VXWORKS\" is not met.")
27 | return()
28 | endif()
29 | if(WINRT)
30 | message(NOTICE "Skipping the build as the condition \"NOT WINRT\" is not met.")
31 | return()
32 | endif()
33 | if(UIKIT)
34 | message(NOTICE "Skipping the build as the condition \"NOT UIKIT\" is not met.")
35 | return()
36 | endif()
37 | if(EMSCRIPTEN)
38 | message(NOTICE "Skipping the build as the condition \"NOT EMSCRIPTEN\" is not met.")
39 | return()
40 | endif()
41 |
42 | find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals)
43 |
44 | # This should be called as early as possible, just after find_package(BuildInternals) where it is
45 | # defined.
46 | qt_internal_project_setup()
47 |
48 | find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Core Network)
49 | find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Gui Widgets SerialPort)
50 |
51 | qt_build_repo()
52 |
--------------------------------------------------------------------------------
/src/serialbus/doc/src/qtmodbus-backends.qdoc:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3 | /*!
4 | \page qtmodbus-backends.html
5 | \title Qt Modbus
6 |
7 | \brief Implemented Qt Modbus.
8 |
9 | Modbus is a request/reply protocol that has one Modbus client in its
10 | network and may have many Modbus servers. Servers can control only
11 | their own internal states, and clients can read and write data in them.
12 |
13 | Each Modbus server has four tables in which it can store data.
14 |
15 | \table
16 | \header
17 | \li name
18 | \li data range in one field
19 | \li permissions for client
20 | \row
21 | \li Discrete Inputs
22 | \li 0-1
23 | \li Read
24 | \row
25 | \li Coils
26 | \li 0-1
27 | \li Read/Write
28 | \row
29 | \li Input Registers
30 | \li 0-65535 (0xffff)
31 | \li Read
32 | \row
33 | \li Holding Registers
34 | \li 0-65535 (0xffff)
35 | \li Read/Write
36 | \endtable
37 |
38 | The Modbus API provides some common API to access the Modbus devices:
39 |
40 | \list
41 | \li QModbusDevice provides an API for common functionality with client and server.
42 | \li QModbusClient provides an API for direct access to Modbus client.
43 | \li QModbusServer provides an API for direct access to Modbus server.
44 | \li QModbusDataUnit represents a data value.
45 | \li QModbusReply is created by QModbusClient as a handle for write/read operation.
46 | \endlist
47 | */
48 |
--------------------------------------------------------------------------------
/tests/auto/cmake/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 | # This is an automatic test for the CMake configuration files.
5 | # To run it manually,
6 | # 1) mkdir build # Create a build directory
7 | # 2) cd build
8 | # 3) # Run cmake on this directory
9 | # `$qt_prefix/bin/qt-cmake ..` or `cmake -DCMAKE_PREFIX_PATH=/path/to/qt ..`
10 | # 4) ctest # Run ctest
11 |
12 | cmake_minimum_required(VERSION 3.16)
13 | project(serialbus_cmake_tests)
14 | enable_testing()
15 |
16 | set(required_packages Core SerialBus)
17 |
18 | # Setup the test when called as a completely standalone project.
19 | if(TARGET Qt6::Core)
20 | # Tests are built as part of the repository's build tree.
21 | # Setup paths so that the Qt packages are found.
22 | qt_internal_set_up_build_dir_package_paths()
23 | endif()
24 |
25 | find_package(Qt6 REQUIRED COMPONENTS ${required_packages})
26 |
27 | # Setup common test variables which were previously set by ctest_testcase_common.prf.
28 | set(CMAKE_MODULES_UNDER_TEST "${required_packages}")
29 |
30 | foreach(qt_package ${CMAKE_MODULES_UNDER_TEST})
31 | set(package_name "${QT_CMAKE_EXPORT_NAMESPACE}${qt_package}")
32 | if(${package_name}_FOUND)
33 | set(CMAKE_${qt_package}_MODULE_MAJOR_VERSION "${${package_name}_VERSION_MAJOR}")
34 | set(CMAKE_${qt_package}_MODULE_MINOR_VERSION "${${package_name}_VERSION_MINOR}")
35 | set(CMAKE_${qt_package}_MODULE_PATCH_VERSION "${${package_name}_VERSION_PATCH}")
36 | endif()
37 | endforeach()
38 |
39 | include("${_Qt6CTestMacros}")
40 |
41 | set(module_includes
42 | SerialBus QCanBusFrame
43 | )
44 |
45 | _qt_internal_test_module_includes(
46 | ${module_includes}
47 | )
48 |
49 |
--------------------------------------------------------------------------------
/dist/changes-5.15.0:
--------------------------------------------------------------------------------
1 | Qt 5.15 introduces many new features and improvements as well as bugfixes
2 | over the 5.14.x series. For more details, refer to the online documentation
3 | included in this distribution. The documentation is also available online:
4 |
5 | https://doc.qt.io/qt-5/index.html
6 |
7 | The Qt version 5.15 series is binary compatible with the 5.14.x series.
8 | Applications compiled for 5.14 will continue to run with 5.15.
9 |
10 | Some of the changes listed in this file include issue tracking numbers
11 | corresponding to tasks in the Qt Bug Tracker:
12 |
13 | https://bugreports.qt.io/
14 |
15 | Each of these identifiers can be entered in the bug tracker to obtain more
16 | information about a particular change.
17 |
18 | ****************************************************************************
19 | * SocketCAN *
20 | ****************************************************************************
21 |
22 | - QCanBusDevice::hasBusStatus() now returns false for virtual CAN devices.
23 | - [QTBUG-82814] Fixed compiliation with old Linux Kernels.
24 |
25 | ****************************************************************************
26 | * VectorCAN *
27 | ****************************************************************************
28 |
29 | - Added CAN FD support to the VectorCAN plugin.
30 |
31 | ****************************************************************************
32 | * VirtualCAN *
33 | ****************************************************************************
34 |
35 | - Added the missing emission of the framesWritten() signal to
36 | writeFrame().
37 |
--------------------------------------------------------------------------------
/src/serialbus/qmodbusclient.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QMODBUSCLIENT_H
5 | #define QMODBUSCLIENT_H
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | QT_BEGIN_NAMESPACE
14 |
15 | class QModbusClientPrivate;
16 |
17 | class Q_SERIALBUS_EXPORT QModbusClient : public QModbusDevice
18 | {
19 | Q_OBJECT
20 | Q_DECLARE_PRIVATE(QModbusClient)
21 |
22 | public:
23 | explicit QModbusClient(QObject *parent = nullptr);
24 | ~QModbusClient();
25 |
26 | QModbusReply *sendReadRequest(const QModbusDataUnit &read, int serverAddress);
27 | QModbusReply *sendWriteRequest(const QModbusDataUnit &write, int serverAddress);
28 | QModbusReply *sendReadWriteRequest(const QModbusDataUnit &read, const QModbusDataUnit &write,
29 | int serverAddress);
30 | QModbusReply *sendRawRequest(const QModbusRequest &request, int serverAddress);
31 |
32 | int timeout() const;
33 | void setTimeout(int newTimeout);
34 |
35 | int numberOfRetries() const;
36 | void setNumberOfRetries(int number);
37 |
38 | Q_SIGNALS:
39 | void timeoutChanged(int newTimeout);
40 |
41 | protected:
42 | QModbusClient(QModbusClientPrivate &dd, QObject *parent = nullptr);
43 |
44 | virtual bool processResponse(const QModbusResponse &response, QModbusDataUnit *data);
45 | virtual bool processPrivateResponse(const QModbusResponse &response, QModbusDataUnit *data);
46 | };
47 |
48 | QT_END_NAMESPACE
49 |
50 | #endif // QMODBUSCLIENT_H
51 |
--------------------------------------------------------------------------------
/tests/auto/qcandbcfileparser/data/value_descriptions.dbc:
--------------------------------------------------------------------------------
1 | VERSION ""
2 |
3 |
4 | NS_ :
5 | NS_DESC_
6 | CM_
7 | BA_DEF_
8 | BA_
9 | VAL_
10 | CAT_DEF_
11 | CAT_
12 | FILTER
13 | BA_DEF_DEF_
14 | EV_DATA_
15 | ENVVAR_DATA_
16 | SGTYPE_
17 | SGTYPE_VAL_
18 | BA_DEF_SGTYPE_
19 | BA_SGTYPE_
20 | SIG_TYPE_REF_
21 | VAL_TABLE_
22 | SIG_GROUP_
23 | SIG_VALTYPE_
24 | SIGTYPE_VALTYPE_
25 | BO_TX_BU_
26 | BA_DEF_REL_
27 | BA_REL_
28 | BA_DEF_DEF_REL_
29 | BU_SG_REL_
30 | BU_EV_REL_
31 | BU_BO_REL_
32 | SG_MUL_VAL_
33 |
34 | BS_:
35 |
36 | BU_:
37 | VAL_TABLE_ ValueTable2 4 "Value4" 3 "Value3" 2 "Value2" 1 "Value1" 0 "Value0" ;
38 | VAL_TABLE_ ValueTable1 5 "blue" 4 "green" 3 "red" ;
39 | VAL_TABLE_ ValueTable0 2 "Description for the value '0x2'" 1 "Description for the value '0x1'" 0 "Description for the value '0x0'" ;
40 |
41 |
42 | BO_ 2566844926 Test1: 2 Vector__XXX
43 | SG_ s2 : 8|8@1+ (1,0) [0|0] "" Vector__XXX
44 | SG_ s1 : 0|8@1+ (1,0) [0|0] "" Vector__XXX
45 |
46 | BO_ 1234 Test: 2 Vector__XXX
47 | SG_ s1 : 8|8@1+ (1,0) [0|0] "" Vector__XXX
48 | SG_ s0 : 0|8@1+ (1,0) [0|0] "" Vector__XXX
49 |
50 |
51 | VAL_ 2566844926 s2 4 "Value4" 3 "Value3" 2 "Value2" 1 "Value1" 0 "Value0" ;
52 | VAL_ 2566844926 s1 5 "b" 4 "g" 3 "r" ;
53 | VAL_ 1234 s1 5 "blue" 4 "green" 3 "red" ;
54 | VAL_ 1234 s0 2 "Description for the value '0x2'" 1 "Description for the value '0x1'" 0 "Description for the value '0x0'" ;
55 |
56 | CM_ "Invalid descriptions go here";
57 | VAL_ 1236 s2 4 "Value4" 3 "Value3" 2 "Value2" 1 "Value1" 0 "Value0" ;
58 | VAL_ 2566844926 s3 4 "Value4" 3 "Value3" 2 "Value2" 1 "Value1" 0 "Value0" ;
59 | VAL_ 2566844926 s2 4 "Value4" 3 "Value3" 2 "Value2" 1 "Value1" 0 ;
60 |
61 |
--------------------------------------------------------------------------------
/dist/changes-5.13.0:
--------------------------------------------------------------------------------
1 | Qt 5.13 introduces many new features and improvements as well as bugfixes
2 | over the 5.12.x series. For more details, refer to the online documentation
3 | included in this distribution. The documentation is also available online:
4 |
5 | https://doc.qt.io/qt-5/index.html
6 |
7 | The Qt version 5.13 series is binary compatible with the 5.12.x series.
8 | Applications compiled for 5.12 will continue to run with 5.13.
9 |
10 | Some of the changes listed in this file include issue tracking numbers
11 | corresponding to tasks in the Qt Bug Tracker:
12 |
13 | https://bugreports.qt.io/
14 |
15 | Each of these identifiers can be entered in the bug tracker to obtain more
16 | information about a particular change.
17 |
18 | ****************************************************************************
19 | * Qt 5.13.0 Changes *
20 | ****************************************************************************
21 |
22 | QtSerialBus
23 | -----------
24 |
25 | - [QTBUG-70360] Removed the hard QtSerialPort dependency from QtSerialBus.
26 | The module can now be built without QtSerialPort (which in turn disables
27 | Modbus RTU support). This is especially interesting for platforms without
28 | serial port support.
29 |
30 | - CAN Plugins
31 | * Fixed the error message "Cannot configure TxEcho for open device"
32 | when QCanBusDevice::ReceiveOwnKey was used in the SystecCAN plugin
33 |
34 | - QModbusRtuSerialMaster
35 | * [QTBUG-73230][QTBUG-73965] Fixed the "response timer active" and
36 | "processQueue is in an unexpected state" assert messages
37 | * Implementend handling for sending Modbus RTU broadcast requests
38 |
39 | - QModbusClient
40 | * [QTBUG-75461] Reduce minimal Modbus response timeout to 10ms
41 |
--------------------------------------------------------------------------------
/src/serialbus/qmodbusreply.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QMODBUSREPLY_H
5 | #define QMODBUSREPLY_H
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | QT_BEGIN_NAMESPACE
13 |
14 | class QModbusReplyPrivate;
15 |
16 | class Q_SERIALBUS_EXPORT QModbusReply : public QObject
17 | {
18 | Q_OBJECT
19 | Q_DECLARE_PRIVATE(QModbusReply)
20 |
21 | public:
22 | enum ReplyType {
23 | Raw,
24 | Common,
25 | Broadcast
26 | };
27 | Q_ENUM(ReplyType)
28 |
29 | QModbusReply(ReplyType type, int serverAddress, QObject *parent = nullptr);
30 |
31 | ReplyType type() const;
32 | int serverAddress() const;
33 |
34 | bool isFinished() const;
35 |
36 | QModbusDataUnit result() const;
37 | QModbusResponse rawResult() const;
38 |
39 | QString errorString() const;
40 | QModbusDevice::Error error() const;
41 |
42 | void setResult(const QModbusDataUnit &unit);
43 | void setRawResult(const QModbusResponse &unit);
44 |
45 | void setFinished(bool isFinished);
46 | void setError(QModbusDevice::Error error, const QString &errorText);
47 |
48 | QList intermediateErrors() const;
49 | void addIntermediateError(QModbusDevice::IntermediateError error);
50 |
51 | Q_SIGNALS:
52 | void finished();
53 | void errorOccurred(QModbusDevice::Error error);
54 | void intermediateErrorOccurred(QModbusDevice::IntermediateError error);
55 | };
56 | Q_DECLARE_TYPEINFO(QModbusReply::ReplyType, Q_PRIMITIVE_TYPE);
57 |
58 | QT_END_NAMESPACE
59 |
60 | #endif // QMODBUSREPLY_H
61 |
--------------------------------------------------------------------------------
/src/serialbus/configure.cmake:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: BSD-3-Clause
3 |
4 |
5 |
6 | #### Inputs
7 |
8 |
9 |
10 | #### Libraries
11 |
12 |
13 |
14 | #### Tests
15 |
16 |
17 | qt_config_compile_test("socketcan"
18 | LABEL "Socket CAN"
19 | PROJECT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../config.tests/socketcan"
20 | )
21 |
22 | qt_config_compile_test("socketcan_fd"
23 | LABEL "Socket CAN FD"
24 | PROJECT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../config.tests/socketcan_fd"
25 | )
26 |
27 |
28 | #### Features
29 |
30 | qt_feature("socketcan" PRIVATE
31 | LABEL "Socket CAN"
32 | CONDITION LINUX AND TEST_socketcan
33 | )
34 | qt_feature("socketcan_fd" PRIVATE
35 | LABEL "Socket CAN FD"
36 | CONDITION LINUX AND QT_FEATURE_socketcan AND TEST_socketcan_fd
37 | )
38 | qt_feature("modbus-serialport" PUBLIC
39 | LABEL "SerialPort Support"
40 | PURPOSE "Enables Serial-based Modbus Support"
41 | CONDITION TARGET Qt::SerialPort
42 | )
43 | qt_configure_add_summary_section(NAME "Qt SerialBus")
44 | qt_configure_add_summary_entry(ARGS "socketcan")
45 | qt_configure_add_summary_entry(ARGS "socketcan_fd")
46 | qt_configure_add_summary_entry(ARGS "modbus-serialport")
47 | qt_configure_end_summary_section() # end of "Qt SerialBus" section
48 | qt_configure_add_report_entry(
49 | TYPE NOTE
50 | MESSAGE "QtSerialBus: Cannot find linux/can.h and linux/can/raw.h Linux headers for socketCAN support."
51 | CONDITION LINUX AND NOT QT_FEATURE_socketcan
52 | )
53 | qt_configure_add_report_entry(
54 | TYPE NOTE
55 | MESSAGE "QtSerialBus: Newer kernel needed for flexible data-rate frame support (canfd_frame)."
56 | CONDITION LINUX AND QT_FEATURE_socketcan AND NOT QT_FEATURE_socketcan_fd
57 | )
58 |
--------------------------------------------------------------------------------
/examples/serialbus/can/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2022 The Qt Company Ltd.
2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | cmake_minimum_required(VERSION 3.16)
5 | project(can LANGUAGES CXX)
6 |
7 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
8 |
9 | if(NOT DEFINED INSTALL_EXAMPLESDIR)
10 | set(INSTALL_EXAMPLESDIR "examples")
11 | endif()
12 |
13 | set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/serialbus/can")
14 |
15 | find_package(Qt6 REQUIRED COMPONENTS Core Gui Network SerialBus Widgets)
16 |
17 | qt_standard_project_setup()
18 |
19 | qt_add_executable(can
20 | bitratebox.cpp bitratebox.h
21 | canbusdeviceinfobox.h canbusdeviceinfobox.cpp canbusdeviceinfobox.ui
22 | canbusdeviceinfodialog.h canbusdeviceinfodialog.cpp canbusdeviceinfodialog.ui
23 | connectdialog.cpp connectdialog.h connectdialog.ui
24 | main.cpp
25 | mainwindow.cpp mainwindow.h mainwindow.ui
26 | sendframebox.cpp sendframebox.h sendframebox.ui
27 | receivedframesmodel.cpp receivedframesmodel.h
28 | receivedframesview.cpp receivedframesview.h
29 | )
30 |
31 | set_target_properties(can PROPERTIES
32 | WIN32_EXECUTABLE TRUE
33 | MACOSX_BUNDLE TRUE
34 | )
35 |
36 | target_link_libraries(can PRIVATE
37 | Qt::Core
38 | Qt::Gui
39 | Qt::Network
40 | Qt::SerialBus
41 | Qt::Widgets
42 | )
43 |
44 | # Resources:
45 | set(can_resource_files
46 | "images/application-exit.png"
47 | "images/clear.png"
48 | "images/connect.png"
49 | "images/disconnect.png"
50 | )
51 |
52 | qt_add_resources(can "can"
53 | PREFIX
54 | "/"
55 | FILES
56 | ${can_resource_files}
57 | )
58 |
59 | install(TARGETS can
60 | RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
61 | BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
62 | LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
63 | )
64 |
--------------------------------------------------------------------------------
/src/plugins/canbus/systeccan/systeccanbackend.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef SYSTECCANBACKEND_H
5 | #define SYSTECCANBACKEND_H
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | #include
12 | #include
13 |
14 | QT_BEGIN_NAMESPACE
15 |
16 | class SystecCanBackendPrivate;
17 |
18 | class SystecCanBackend : public QCanBusDevice
19 | {
20 | Q_OBJECT
21 | Q_DECLARE_PRIVATE(SystecCanBackend)
22 | Q_DISABLE_COPY(SystecCanBackend)
23 | public:
24 | explicit SystecCanBackend(const QString &name, QObject *parent = nullptr);
25 | ~SystecCanBackend();
26 |
27 | bool open() override;
28 | void close() override;
29 |
30 | void setConfigurationParameter(ConfigurationKey key, const QVariant &value) override;
31 |
32 | bool writeFrame(const QCanBusFrame &newData) override;
33 |
34 | QString interpretErrorFrame(const QCanBusFrame &errorFrame) override;
35 |
36 | static QList interfaces();
37 | static bool canCreate(QString *errorReason);
38 |
39 | // This function needs to be public as it is accessed by a callback
40 | static QCanBusDeviceInfo createDeviceInfo(const QString &serialNumber,
41 | const QString &description,
42 | uint deviceNumber,
43 | int channelNumber);
44 |
45 | void resetController() override;
46 | bool hasBusStatus() const override;
47 | CanBusStatus busStatus() override;
48 | QCanBusDeviceInfo deviceInfo() const override;
49 |
50 | private:
51 | SystecCanBackendPrivate * const d_ptr;
52 | };
53 |
54 | QT_END_NAMESPACE
55 |
56 | #endif // SYSTECCANBACKEND_H
57 |
--------------------------------------------------------------------------------
/examples/serialbus/can/canbusdeviceinfodialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | CanBusDeviceInfoDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 237
10 | 225
11 |
12 |
13 |
14 | CAN Interface Properties
15 |
16 |
17 | -
18 |
19 |
20 | true
21 |
22 |
23 | CAN Interface Properties
24 |
25 |
26 |
27 | -
28 |
29 |
-
30 |
31 |
32 | Qt::Orientation::Horizontal
33 |
34 |
35 |
36 | 40
37 | 20
38 |
39 |
40 |
41 |
42 | -
43 |
44 |
45 | Ok
46 |
47 |
48 | true
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | CanBusDeviceInfoBox
59 | QGroupBox
60 |
61 | 1
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/src/serialbus/qcanframeprocessor_p.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2022 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3 |
4 | #ifndef QCANFRAMEPROCESSOR_P_H
5 | #define QCANFRAMEPROCESSOR_P_H
6 |
7 | //
8 | // W A R N I N G
9 | // -------------
10 | //
11 | // This file is not part of the Qt API. It exists purely as an
12 | // implementation detail. This header file may change from version to
13 | // version without notice, or even be removed.
14 | //
15 | // We mean it.
16 | //
17 |
18 | #include "qtserialbusexports.h"
19 | #include "qcanframeprocessor.h"
20 | #include "qcanmessagedescription.h"
21 | #include "qcanuniqueiddescription.h"
22 |
23 | #include
24 | #include
25 |
26 | #include
27 |
28 | QT_BEGIN_NAMESPACE
29 |
30 | class QCanFrameProcessorPrivate
31 | {
32 | public:
33 | void resetErrors();
34 | void setError(QCanFrameProcessor::Error err, const QString &desc);
35 | void addWarning(const QString &warning);
36 | QVariant decodeSignal(const QCanBusFrame &frame, const QCanSignalDescription &signalDesc);
37 | QVariant parseData(const unsigned char *data, const QCanSignalDescription &signalDesc);
38 | void encodeSignal(unsigned char *data, const QVariant &value,
39 | const QCanSignalDescription &signalDesc);
40 | std::optional extractUniqueId(const QCanBusFrame &frame) const;
41 | bool fillUniqueId(unsigned char *data, quint16 sizeInBits, QtCanBus::UniqueId uniqueId);
42 |
43 | static QCanFrameProcessorPrivate *get(const QCanFrameProcessor &processor);
44 |
45 | QCanFrameProcessor::Error error = QCanFrameProcessor::Error::None;
46 | QString errorString;
47 | QStringList warnings;
48 | QHash messages;
49 | QCanUniqueIdDescription uidDescription;
50 | };
51 |
52 | QT_END_NAMESPACE
53 |
54 | #endif // QCANFRAMEPROCESSOR_P_H
55 |
--------------------------------------------------------------------------------
/src/plugins/canbus/peakcan/peakcanbackend_p.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Denis Shienkov
2 | // Copyright (C) 2017 The Qt Company Ltd.
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4 |
5 | #ifndef PEAKCANBACKEND_P_H
6 | #define PEAKCANBACKEND_P_H
7 |
8 | #include "peakcanbackend.h"
9 | #include "peakcan_symbols_p.h"
10 |
11 | #if defined(Q_OS_WIN32)
12 | # include
13 | #else
14 | // other stuff
15 | #endif
16 |
17 | //
18 | // W A R N I N G
19 | // -------------
20 | //
21 | // This file is not part of the Qt API. It exists purely as an
22 | // implementation detail. This header file may change from version to
23 | // version without notice, or even be removed.
24 | //
25 | // We mean it.
26 | //
27 |
28 | QT_BEGIN_NAMESPACE
29 |
30 | class QSocketNotifier;
31 | class QWinEventNotifier;
32 | class QTimer;
33 |
34 | class PeakCanBackendPrivate
35 | {
36 | Q_DECLARE_PUBLIC(PeakCanBackend)
37 | public:
38 | PeakCanBackendPrivate(PeakCanBackend *q);
39 |
40 | bool open();
41 | void close();
42 | bool setConfigurationParameter(QCanBusDevice::ConfigurationKey key, const QVariant &value);
43 | void setupChannel(const QByteArray &interfaceName);
44 | void setupDefaultConfigurations();
45 | QString systemErrorString(TPCANStatus errorCode);
46 | void startWrite();
47 | void startRead();
48 | bool verifyBitRate(int bitrate);
49 |
50 | PeakCanBackend * const q_ptr;
51 |
52 | bool isFlexibleDatarateEnabled = false;
53 | bool isOpen = false;
54 | TPCANHandle channelIndex = PCAN_NONEBUS;
55 | QTimer *writeNotifier = nullptr;
56 |
57 | #if defined(Q_OS_WIN32)
58 | QWinEventNotifier *readNotifier = nullptr;
59 | HANDLE readHandle = INVALID_HANDLE_VALUE;
60 | #else
61 | QSocketNotifier *readNotifier = nullptr;
62 | int readHandle = -1;
63 | #endif
64 | };
65 |
66 | QT_END_NAMESPACE
67 |
68 | #endif // PEAKCANBACKEND_P_H
69 |
--------------------------------------------------------------------------------
/src/plugins/canbus/peakcan/peakcanbackend.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Denis Shienkov
2 | // Copyright (C) 2017 The Qt Company Ltd.
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4 |
5 | #ifndef PEAKCANBACKEND_H
6 | #define PEAKCANBACKEND_H
7 |
8 | #include
9 | #include
10 | #include
11 |
12 | #include
13 | #include
14 |
15 | QT_BEGIN_NAMESPACE
16 |
17 | class PeakCanBackendPrivate;
18 |
19 | class PeakCanBackend : public QCanBusDevice
20 | {
21 | Q_OBJECT
22 | Q_DECLARE_PRIVATE(PeakCanBackend)
23 | Q_DISABLE_COPY(PeakCanBackend)
24 | public:
25 | explicit PeakCanBackend(const QString &name, QObject *parent = nullptr);
26 | ~PeakCanBackend();
27 |
28 | bool open() override;
29 | void close() override;
30 |
31 | void setConfigurationParameter(ConfigurationKey key, const QVariant &value) override;
32 |
33 | bool writeFrame(const QCanBusFrame &newData) override;
34 |
35 | QString interpretErrorFrame(const QCanBusFrame &errorFrame) override;
36 |
37 | static bool canCreate(QString *errorReason);
38 | static QList interfaces();
39 |
40 | void resetController() override;
41 | bool hasBusStatus() const override;
42 | CanBusStatus busStatus() override;
43 | QCanBusDeviceInfo deviceInfo() const override;
44 |
45 | private:
46 | enum class Availability {
47 | Available = 1U, // matches PCAN_CHANNEL_AVAILABLE
48 | Occupied = 2U // matches PCAN_CHANNEL_OCCUPIED
49 | };
50 | static QList interfacesByChannelCondition(Availability available);
51 | static QList interfacesByAttachedChannels(Availability available, bool *ok);
52 | static QList attachedInterfaces(Availability available);
53 |
54 | PeakCanBackendPrivate * const d_ptr;
55 | };
56 |
57 | QT_END_NAMESPACE
58 |
59 | #endif // PEAKCANBACKEND_H
60 |
--------------------------------------------------------------------------------
/examples/serialbus/can/bitratebox.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 Andre Hartmann
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #include "bitratebox.h"
5 |
6 | #include
7 |
8 | BitRateBox::BitRateBox(QWidget *parent) :
9 | QComboBox(parent),
10 | m_customSpeedValidator(new QIntValidator(0, 1000000, this))
11 | {
12 | fillBitRates();
13 |
14 | connect(this, &QComboBox::currentIndexChanged,
15 | this, &BitRateBox::checkCustomSpeedPolicy);
16 | }
17 |
18 | BitRateBox::~BitRateBox()
19 | {
20 | delete m_customSpeedValidator;
21 | }
22 |
23 | int BitRateBox::bitRate() const
24 | {
25 | if (currentIndex() == (count() - 1))
26 | return currentText().toInt();
27 |
28 | return itemData(currentIndex()).toInt();
29 | }
30 |
31 | bool BitRateBox::isFlexibleDataRateEnabled() const
32 | {
33 | return m_isFlexibleDataRateEnabled;
34 | }
35 |
36 | void BitRateBox::setFlexibleDateRateEnabled(bool enabled)
37 | {
38 | m_isFlexibleDataRateEnabled = enabled;
39 | m_customSpeedValidator->setTop(enabled ? 10000000 : 1000000);
40 | fillBitRates();
41 | }
42 |
43 | void BitRateBox::checkCustomSpeedPolicy(int idx)
44 | {
45 | const bool isCustomSpeed = !itemData(idx).isValid();
46 | setEditable(isCustomSpeed);
47 | if (isCustomSpeed) {
48 | clearEditText();
49 | lineEdit()->setValidator(m_customSpeedValidator);
50 | }
51 | }
52 |
53 | void BitRateBox::fillBitRates()
54 | {
55 | const QList rates = {
56 | 10000, 20000, 50000, 100000, 125000, 250000, 500000, 800000, 1000000
57 | };
58 | const QList