summaryrefslogtreecommitdiffstats
path: root/examples/serialbus
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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>
* Remove usages of deprecated QLatin1LiteralSona Kurazyan2019-06-252-2/+2
| | | | | | Task-number: QTBUG-76491 Change-Id: I8e16068e04b5f04ab7873697075e19a5ec760d54 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix Qt6 buildSona Kurazyan2019-06-242-5/+5
| | | | | | | Added 'Qt::' prefixes where missing. Change-Id: I97d5d9fa78d7c1feaef4caae72b735ea0625a081 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
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-301-1/+1
| |\ | | | | | | | | | Change-Id: I1f3e5fc5e366037937f12dd2e714853865695ac8
| | * 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.13' into devLiang Qi2019-04-161-1/+1
|\| | | | | | | | | | | | | | | | | | | | Conflicts: examples/serialbus/modbus/adueditor/modbustcpclient_p.h Change-Id: I620bfce752a957fdcd068c44ff039d84b7502edc
| * | Add context information to QObject::connect(...) callsKarsten Heimrich2019-04-011-1/+1
| | | | | | | | | | | | | | | Change-Id: I3888da16e5152c479deeb3e5bfbb8d0dd587cea8 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* | | Cleanup and modernize the Modbus examplesAndre Hartmann2019-02-1315-135/+162
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | * Replace static_cast with QOverload * Fix some Clang warnings * Mark user-visible strings with tr() * Disable verbose log output * Replace auto-connect with explicit functor-style connect * Initialize members at declaration * Small style cleanup Change-Id: Idcb6c24a8733e7fd659ad4750ce0798a72c84af6 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* / Remove hard QtSerialPort dependency from QtSerialBusAlex Blasche2018-11-079-3/+47
|/ | | | | | Task-number: QTBUG-70360 Change-Id: I511e368e227a46f9eba178612c8b106f5930ee49 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-06-231-2/+3
|\ | | | | | | Change-Id: Ica7f98ed62f5374526c8d7406487f523befe83fa
| * Migrate the modbus example to use QRegularExpressionSamuel Gaist2018-06-201-2/+3
| | | | | | | | | | | | | | | | | | This patch updates the modbus example MainWindow class to use QRegularExpression in place of QRegExp which is to be considered deprecated. Change-Id: Ie030b695a1885c5e1ffc2511da2381c5df6b958a Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | 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>
* Rename master example title to "Client"Alex Blasche2018-03-011-1/+1
| | | | | | | | | | The slave example already uses the Server terminology in the same spot. This change makes the master example consistent with the slave example. The client/server terminology is much easier to understand than Modbus' Master/Slave terminology. Change-Id: Ic99cc75f223394faba8dcd62f144edd76a9dd50a Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-204-0/+4
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Ibcb5508d7f131cbeba0d047111177a8dff1e5f68
| * qtlite: Skip building examples when configured with no-feature-itemviewsRainer Keller2018-01-124-0/+4
| | | | | | | | | | | | 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-2030-68/+357
|\| | | | | | | 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-3028-62/+322
| |\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Icfbad81955ad8a7c4ddc49ac4ee952bcba6317ec
| | * Fix outdated BSD license headerKai Koehne2017-10-2026-52/+312
| | | | | | | | | | | | | | | | | | Change-Id: Ifdd8f08e12f471aee37f749b4ad911ab7b6adb2a Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
| | * Fix outdated FDL license headerKai Koehne2017-10-202-10/+10
| | | | | | | | | | | | | | | | | | Change-Id: Ib7a43e822a32f7e0c77055baeef4f0fba33092a5 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>
| * | modbus: Remove unused 'this' lambda captureDenis Shienkov2017-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes following clang warning: warning: lambda capture 'this' is not used [-Wunused-lambda-capture] connect(m_device, &QModbusDevice::stateChanged, [this] (QModbusDevice::State state) { ^ Change-Id: I487b8f024bdf8e0c18acb10dad370a230c796d92 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
| * | 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>
* | | CAN: Introduce categorized loggingAndre Hartmann2017-11-131-0/+3
|/ / | | | | | | | | | | | | | | | | | | [ChangeLog][CAN bus] Introduced categorized logging to the CAN bus module which can be enabled by the "qt.canbus" and "qt.canbus.plugins.<pluginname>" filters. Change-Id: Ib39c0b2ebcd967cd7812602190807ad3488ccb18 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | CAN-Example: Fix Clang semantic warningAndre Hartmann2017-08-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | Semantic Issue -Wimplicit-fallthrough 103:5: warning: unannotated fall-through between switch labels 103:5: note: insert 'break;' to avoid fall-through Change-Id: I191ea47160eb27d994e0a1a7435b57418a094cdf Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-08-151-1/+1
|\| | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Ib884bd5bddf08b7c03cedd6941d60f157f128912
| * Fix address counter for received modbus register entriesAlex Blasche2017-08-101-1/+1
| | | | | | | | | | | | | | | | THis happens when the number of retrieved entries is larger than 1. Task-number: QTBUG-62421 Change-Id: I250d528914d887d0c9be34cd828763f87a5099e7 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* | Fix namespace build of can bus exampleAlex Blasche2017-07-181-0/+2
| | | | | | | | | | | | Change-Id: Ia3e9fcd129cf61669bb666f32e60820c88e9c547 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* | CAN-Example: Add a dedicated send frame group boxAndre Hartmann2017-07-177-145/+514
| | | | | | | | | | | | | | | | | | | | | | | | | | | | By moving the send frame logic to a separate panel, the MainWindow gets easier to understand as it only connects signals to slots. The new SendFramesBox also does more sanity check on the parameters (options that exclude each other are checked) and forbids invalid input by using QValidators. The payload input is also prettified with spaces. This was first done by InputMasks but this had strange side effects so now the input validator is used for this task also. Change-Id: Ib95605ce4bc23b52d1cf5d082b1533b2a59f7749 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN-Example: Show errors and number of frames written in the UIAndre Hartmann2017-07-112-4/+11
| | | | | | | | | | | | Change-Id: I1a8a14abee0cb533d454f67c8fca35099d8b4c1d Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN-Example: Simplify payload handlingAndre Hartmann2017-07-111-8/+2
| | | | | | | | | | | | Change-Id: I538ec95b2465e610b19d955e2f4bd34d98e680f8 Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN-Example: Rename slots to describe their purpose betterAndre Hartmann2017-07-112-15/+12
| | | | | | | | | | Change-Id: Ic63e01635273704196b8fc6e4f00d6aff409f5ab Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN-Example: Inline very short functionAndre Hartmann2017-07-102-11/+5
| | | | | | | | | | | | | | Change-Id: Iccbf9091d138cedacc74b043db5f83b686b7c27e Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN-Example: Rename all occurrences of "backend" to "plugin"Andre Hartmann2017-07-104-18/+18
| | | | | | | | | | | | | | | | | | | | The first parameter of QCanBus::createDevice() is called "plugin", so use this term in our examples to avoid confusion. Change-Id: I2fc28731d3763e037c18a7030205dad5d54183cd Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN-Example: Init all user interface actions in one functionAndre Hartmann2017-07-071-4/+2
| | | | | | | | | | | | | | Change-Id: I7a89ad9cf150b2bacedbb3ab246d5d89c0d92e56 Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN-Example: Remove unneeded QAction::setEnabled() callsAndre Hartmann2017-07-071-2/+0
| | | | | | | | | | | | | | | | | | Both actions were already enabled in the UI file. Change-Id: I39d39f77a31c8b7b724a0c961c35caf159ed69a2 Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | QCanBusFrame: Introduce local echo flagAndre Hartmann2017-07-041-5/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | | | Inspiration for change after reading the SocketCAN mailing list thread: https://marc.info/?l=linux-can&m=147438437202356&w=2 The main usage is, to verify at application stage, that and when a frame was really sent on the bus. For architectures like SocketCAN, where multiple applications can connect to one CAN bus on the same system, this flag also indicates frames that are sent by an other local running application (i.e. not coming from the real bus). Implementations done for SystecCAN, VectorCAN and SocketCAN plugin. PCAN Basic does not seem to have support for this flag. For SocketCAN, see section "4.1.7 RAW socket returned message flags" in https://www.kernel.org/doc/Documentation/networking/can.txt for reference. [ChangeLog][QCanBusFrame] Added local echo flag to mark all echo frames that are generated by the hardware on successful transmission to CAN bus as such. Change-Id: I66d4ce1ec6dfd0a0b994a7b7a9de1a5f503fcb70 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.9.0' into 5.9Liang Qi2017-05-311-0/+2
|\ | | | | | | Change-Id: I9c93f053c5a6a7af04c79d6e2cc8ded76c906319
| * fix namespaced buildv5.9.0-rc2v5.9.0-rc1v5.9.0Oswald Buddenhagen2017-05-121-0/+2
| | | | | | | | | | Change-Id: I7daa9be5b0b21c0f94021b9a2eb139915c501049 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN Example: Add menu entry to show online documentationAndre Hartmann2017-05-292-0/+13
|/ | | | | | | | | | | | | The different plugins have varying runtime requirements, that should be described in the plugins documentation. Allow the user to open the documentation easily. [ChangeLog][QCanBus] Added a menu to open plugins online documentation to the CAN Example. Change-Id: I2ae19b439f91042c6bcb09a7db079249fb34355c Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9v5.9.0-beta1Liang Qi2017-03-3124-25/+25
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/canbus/canbus.pro src/plugins/canbus/vectorcan/vectorcanbackend.cpp Change-Id: I3625693784e88204c93479806242ae70c7ec7ff3
| * modbus master example: fix nonsensical codeMarc Mutz2017-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Pointed out by GCC 7: writeregistermodel.cpp:117:48: warning: enum constant in boolean context [-Wint-in-bool-context] if (index.column() == HoldingColumn && Qt::EditRole) { // holding registers ^~~~~~~~ Change-Id: I5d0f19c0480b027109c6a751f69852114cb634b2 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: David Faure <david.faure@kdab.com>
| * Updated copyright headersAndre Hartmann2017-02-0224-24/+24
| | | | | | | | | | Change-Id: I7d38491c7ee15a1de788375acf9144c59b507d2a Reviewed-by: Alex Blasche <alexander.blasche@qt.io>