summaryrefslogtreecommitdiffstats
path: root/examples/serialbus/can
Commit message (Collapse)AuthorAgeFilesLines
* CAN Manager Example: extend documentationIvan Solovev2023-02-102-0/+10
| | | | | | | | | | | | | | | Extend the documentation so that it actually highlights the main features shown by the example. Also update the documentation to match the guidelines: * update screenshot * add Connectivity category Task-number: QTBUG-110890 Pick-to: 6.5 Change-Id: I9c75488440be23885c7751f6d00018e9537cdfa2 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* CAN Manager Example: fix CMakeLists.txtIvan Solovev2023-02-071-5/+4
| | | | | | | | | | | | | * Use qt_standard_project_setup() instead of enabling AUTOMOC and AUTOUIC manually * Use PRIVATE linkage * Use versionless CMake functions Task-number: QTBUG-110890 Pick-to: 6.5 Change-Id: Iecbc59c1dd9950de649f0694b66de4568131afab Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CAN Example: improve UIIvan Solovev2023-02-034-8/+11
| | | | | | | | | | | | | | * Change title to "CAN Manager" (to avoid using "Example" in the name) * Rename "Received CAN messages" -> "Received CAN frames" * Rename "CAN-ID" -> "Frame ID" in the received frames table * Rename "Data" -> "Payload" in the received frames table * Show Frame ID uppercase in the received frames table * Stretch the "Payload" section to take the rest of the available width Task-number: QTBUG-110890 Pick-to: 6.5 Change-Id: Iea57246f45918d69bb11fff78b30952e447e87b2 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* CAN Example: increase the default size of the Flags columnIvan Solovev2023-02-021-1/+1
| | | | | | | | | ... so that the column name actually fits into it. Task-number: QTBUG-110890 Pick-to: 6.5 Change-Id: Idc88f4fa0064bd52331a9142ba99c42af7429057 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* CAN Example: use bool instead of int for a flag typeIvan Solovev2023-02-021-1/+1
| | | | | | | Task-number: QTBUG-110890 Pick-to: 6.5 Change-Id: If743fc5dff7686eed4941bc68d0c4104f185f46c Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Polish the can example, take 2Friedemann Kleint2022-10-174-58/+74
| | | | | | | | | | | | - Fix the settings organization - Use modern string literals - Avoid repeated instantiations of QRegularExpression - Streamline code Pick-to: 6.4 Change-Id: Id8412d9d21e0969ef4ef4606ce0c024a8803b314 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Brush up the CAN exampleFriedemann Kleint2022-10-121-5/+5
| | | | | | | | | - Fix the documentation URL - Fix clazy warnings about multi-arg Pick-to: 6.4 6.2 Change-Id: I86589b8b57c467624ba78e81b4d099834460149d Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-061-2/+2
| | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I805f044a494f0ed3066c9c132767d541108c0e2d Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* CAN example: fix memory leakIvan Solovev2022-09-071-1/+0
| | | | | | | | | | | For some reason the connectiondialog.ui form created a layout for a custom CanBusDeviceInfoBox dialog. However this dialog already has its own layout, so the layout created by ConnectionDialog was just hanging around without being added to any class hierarchy, which resulted in a memleak, as reported by ASAN. Change-Id: Id77b06069a0c77799e6a856932eadee2d7312b39 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: Ibfa4f2f7788f83b7032406de634ca4fb635d2131 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-071-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I4702aec49e940c3a480b94cf8622155b9b688b9e Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-1018-882/+36
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: Ie17b09db5a4aa7bb0d33906360f1125e9632425c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Improve examples CMakeLists.txtKai Köhne2022-02-171-8/+4
| | | | | | | | | | | | | | | | | | - Remove "# generated from xyz.pro" comment from pro2cmake - Remove automatic use of CMAKE_AUTORCC - Only opt into CMAKE_AUTOUIC if .ui files are involved - Remove explicit setting of CMAKE_INCLUDE_CURRENT_DIR where not necessary - Combine multiple find_package(Qt6 ... calls) - use REQUIRED COMPONENTS - sort components alphabetically - Fix wrong indentations - Use (only) one empty line after multi-line commands Pick-to: 6.3 Change-Id: I66b7edaf699db528ed91f738a009aaa2423e3d80 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CAN Example: Fix coding styleAndre Hartmann2021-12-162-7/+11
| | | | | Change-Id: I447a1faff0dae423051c884037c9267696272a6a Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* CAN Example: Fix Clazy warningAndre Hartmann2021-12-151-1/+1
| | | | | | | | | receivedframesview.cpp:66:5: Pass a context object as 3rd connect parameter [clazy-connect-3arg-lambda] Pick-to: 6.3 Change-Id: I0da8f98b8f3629ca45b51a5b650115538ae3b558 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* CAN Example: Fix building with QT_NO_CLIPBOARDAndre Hartmann2021-12-151-8/+14
| | | | | | | | Pick-to: 6.2 Pick-to: 6.3 Fixes: QTBUG-96566 Change-Id: If1ada6afb9a8679da21d60a9d5b20c2282b07451 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* CAN example: Add QSettings to save and restore last settingsEvgeny Shtanov2021-11-112-7/+79
| | | | | | Task-number: QTBUG-91646 Change-Id: I26fea97b7594da1f85f72c4f08cb88958fccb476 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* CAN example, HexStringValidator: don't allow user to enter extra spacesEvgeny Shtanov2021-08-241-4/+24
| | | | | | Fixes: QTBUG-95801 Change-Id: I3ec19aae58b42450470000e6380c5d41422bd034 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-171-1/+1
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95636 Change-Id: I821f412f9dbe11ae99ffd888a7ab2ba415ed9379 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix examples to search for the Network packageAlexandru Croitor2021-08-121-0/+1
| | | | | | | | | | | | | | A previous change added an explicit link dependency to the examples without searching for the package first. Amends 4a2828a3d30fa1e4760a6778b8b58569caefb632 Pick-to: 6.2 Task-number: QTBUG-86533 Fixes: QTBUG-95387 Change-Id: I6d5fb5d3d62acc877e096951e0a6d70b5d63baa8 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CAN Example: Add CanBusDeviceInfo dialogAndre Hartmann2021-07-2712-160/+619
| | | | | | | | | | | As example for the new function QCanBusDevice::deviceInfo(). Therefore, extract the group box containing the information from the connect dialog and re-use it for the new CAN device information dialog. Change-Id: I1fd5f9b630a24c819c1fd77a4e2c05542dc15378 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* CMake: Explicitly link against the built QtNetwork libraryAlexandru Croitor2021-07-231-0/+1
| | | | | | | | | | | | | This is to ensure that the pre-existing QtNetwork library from the b2qt SDK sysroot in the CI is not picked up. This is likely a consequence of CMake not adding an -rpath-link flag when linking. See QTBUG-86533 for details. Task-number: QTBUG-86533 Pick-to: 6.2 Change-Id: Id05d49812f957c8a6c12c03f5ff633015bd63103 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CAN Example: Properly format payload hex stringEvgeny Shtanov2021-03-251-4/+49
| | | | | | | | | Insert a space after every byte (two hex digits) even when editing the string in the middle. Task-number: QTBUG-91251 Change-Id: I477c9116c74c8ff52902222ab855d331e3d78b13 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* CAN example: Replace received frames edit with proper table and modelEvgeny Shtanov2021-03-1914-275/+973
| | | | | | | | | | | Add a class based on QAbstractTableModel to show the received frames. Also add a configurable queue to buffer the frames before displaying them. This should avoid frames loss in flood traffic mode. Task-number: QTBUG-85611 Change-Id: Iac4671096c1cbfdc8297acf3c99be960b7eaf010 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Remove now superfluous QOverload invocationsKarsten Heimrich2021-03-041-1/+1
| | | | | | Task-number: QTBUG-91213 Change-Id: I0ca8f4d87fd356966a449675c7c18bc70f7c92dc Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Can example: Fix crash in payload hex editorEvgeny Shtanov2021-02-211-4/+6
| | | | | | | | | | [ChangeLog][CAN Example] Fixed a crash in the payload hex editor when deleting characters in the middle. Fixes: QTBUG-90783 Change-Id: I95d1f1826c6d19195c2538b6adf214a9d9d5f47f Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* CAN-Example: Fix clang warningsAndre Hartmann2021-02-151-5/+5
| | | | | | | | warning: Pass a context object as 3rd connect parameter [clazy-connect-3arg-lambda] Change-Id: I39b85204eeb2584d3f39ba28592b76d0b69465a6 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Port to CMakeAndreas Buhr2021-01-271-0/+59
| | | | | | | Task-number: QTBUG-90399 Change-Id: I0521231e7d61809f38c44215b5cd923b292b9e02 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-072-23/+33
|\ | | | | | | Change-Id: If9538dcb73fae46ad5206bc88da1bdc7bfb7922a
| * Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-292-23/+33
| |\ | | | | | | | | | Change-Id: Ie5256b216ed3c9d212b3a713c1d46c9275a4d139
| | * CAN-Example: Fix two issues with the status timerAndre Hartmann2020-02-272-23/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Fix a crash when device open fails If opening of m_canDevice failed, m_canDevice is reset to nullptr in line 154. Dereferencing that leads to a crash. 2. Avoid connecting multiple slots to status timer Opening and closing multiple times lead to multiple connections of the lambda slot, which triggered the call to m_canDevice->busStatus() unnecessarily often. The solution is to do the connection only once, and stop the timer when m_canDevice becomes nullptr. It is started again after a successful open. Amends f83587a9978bd212d [ChangeLog][Examples] Fixed a crash in CAN-Example when opening the CAN bus device failed. Change-Id: I4d19f382593fa26fa3b8166f7121e7ff14fd2e74 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | QCanBusDeviceInfo: Add function alias()Andre Hartmann2020-02-182-1/+12
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QCanBusDeviceInfo] Added the function alias() to query user-defineable identifiers associated with a CAN bus interface. Currently implemented for Peak CAN hardware on Windows with PCAN-Basic >= 4.4.0: It returns the PCAN_DEVICE_ID here, which can be set with PCAN-View. Fixes: QTBUG-65195 Change-Id: I70480df956498015c3f876da7c12406be045aba6 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* / CAN Example: Remove now outdated commentAndre Hartmann2020-01-301-1/+1
|/ | | | | | | | We also use QCanBusDevice in the header now. Change-Id: I3dfc54050164e5b1a5fe0d9b9bfa0ca84b1456c4 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* CAN Example: Don't destroy QCanBusDevice after disconnectAndre Hartmann2019-11-212-13/+14
| | | | | | | | | | | | | | | | | The old code could already called the destructor of the CAN plugin while the disconnect process was still running. Using deleteLater() does not help much here, e.g. the VirtualCAN plugin needs to send "disconnect" packets and then close the TCP connection afterwards. By using a unique_ptr we can keep the object alive until the program ends or the connection dialog is opened to set up a new connection. By this delay and the usage of deleteLater(), the plugin has enough time to properly shut down. Change-Id: I9e992a4b954acd82d62d058000d2108d975b1e9c Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add QCanBusDevice::busStatus()Andre Hartmann2019-07-173-2/+39
| | | | | | | | | | | | | The original terminology is Error active, Error warning, Error Passive and Bus Off. We map them to GoodStatus, WarningStatus, ErrorStatus and BusOffStatus here. [ChangeLog][QCanBusDevice] Added the function busStatus() to query the CAN bus status from the CAN bus device. Fixes: QTBUG-70766 Change-Id: I22b99e2a02a6b22509005dd177796b861d536281 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-05-041-1/+1
|\ | | | | | | Change-Id: I563668f100ffd7e39e94f109642b7d51b6b9a135
| * CAN Example: Fix entering invalid chars in CAN ID inputAndre Hartmann2019-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code returned Intermediate for invalid inputs (e.g. chars outside the A-F range or special characters), because input.toUInt() returned 0 for these cases. Fix that by checking ok from input.toUInt(&ok) first. To allow clearing an edit field containing valid input with backspace again, an additional isEmpty() check has to be added. Change-Id: I4ae28e35ca21611fc5f323b26cdeca75257f1352 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Add QCanBusDevice::resetController() for CAN controller resetAndre Hartmann2019-05-022-0/+13
|/ | | | | | | | | | | | | | | | Currently missing: * VectorCAN: no information in the documentation found * PassthroughCAN: no documentation [ChangeLog][QCanBus][QCanBusDevice] Added the function QCanBusDevice::resetController() to reset a CAN controller from bus off state, as far as supported by the various plugins. Fixes: QTBUG-54943 Change-Id: Ic098054b012726c0c69970c0ae84f434c2b3964a Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-05-121-1/+1
|\ | | | | | | Change-Id: I1ab92643c96792ee03cc3f77a6eaa1fd239890ae
| * Modernize CAN bus exampleAndre Hartmann2018-05-111-1/+1
| | | | | | | | | | Change-Id: I3f732cf739c598b7725ca43a90f98d0ac9f76750 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | CAN-Example: Show data bitrate in the status bar alsoAndre Hartmann2018-03-151-4/+14
|/ | | | | | Change-Id: Ie3b357645c8beb4d6e048d309e04f6abbe02824d Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-201-0/+1
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Ibcb5508d7f131cbeba0d047111177a8dff1e5f68
| * qtlite: Skip building examples when configured with no-feature-itemviewsRainer Keller2018-01-121-0/+1
| | | | | | | | | | | | Task-number: QTBUG-53141 Change-Id: I04c3627ca94de9277d7c09365b4de6a382187c62 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Add more info to QCanBusDeviceInfoAndre Hartmann2018-01-122-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added description, serial number and channel for SocketCAN, PeakCAN, SystecCAN, and VectorCAN plugins. For now, not all plugins do support all kind of information: SocketCAN: description and channel PeakCAN: description and channel (Windows PCANBasic >= 4.2.0) SystecCAN: description, serial number, and channel VectorCAN: description, serial number, and channel [ChangeLog][QCanBusDeviceInfo] Added description, serial number and channel to QCanBusDeviceInfo, as far as supported by the various plugins. Change-Id: Ib2292e06065eb91848f682ebf69a4cc968f4d4ba Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-209-19/+118
|\| | | | | | | Change-Id: Ia04f54eee1264b659d8928b7f08d7221f587bc54
| * Fix outdated BSD license headerLiang Qi2017-11-162-4/+24
| | | | | | | | | | Change-Id: I93a7fa404ade8b55a1410956ba9b17976fec71d0 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
| * Merge remote-tracking branch 'origin/5.9' into 5.10v5.10.0-beta4Liang Qi2017-10-307-14/+84
| |\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Icfbad81955ad8a7c4ddc49ac4ee952bcba6317ec
| | * Fix outdated BSD license headerKai Koehne2017-10-207-14/+84
| | | | | | | | | | | | | | | | | | Change-Id: Ifdd8f08e12f471aee37f749b4ad911ab7b6adb2a Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
| * | canbus: Add missed 'explicit' keyword to CAN-bus exampleDenis Shienkov2017-10-211-1/+1
| | | | | | | | | | | | | | | Change-Id: I589d1e907552a7a2cfe17d08c1c72de7a5068779 Reviewed-by: André Hartmann <aha_1980@gmx.de>
| * | CAN-Example: Disable Send button if frame id is emptyv5.10.0-beta1Andre Hartmann2017-10-041-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every CAN frame needs a CAN-ID to be sent. Disable the Send button with a informative tooltip if this condition is not met. Change-Id: I77033a36c4a45c136185135776ef79185dc548be Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>