summaryrefslogtreecommitdiffstats
path: root/src/plugins/canbus/peakcan
Commit message (Collapse)AuthorAgeFilesLines
...
* | CAN: Improve checking for unsupported CAN FD framesAndre Hartmann2017-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The check for the correct data length is already done by QCanBusFrame::isValid. Plugins that don't support CAN FD should rather check for the CAN FD flag and discard CAN FD frames with payload length < 8 also. [ChangeLog][CAN bus plugins] The CAN bus plugins that don't support CAN FD now also discard CAN FD frames with payload length < 8. Change-Id: I5a699a497b79dab2b8960fadc7fa30dbda6c4a62 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Rolf Eike Beer <eb@emlix.com>
* | CAN: Introduce categorized loggingAndre Hartmann2017-11-132-3/+10
| | | | | | | | | | | | | | | | | | | | [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>
* | PeakCAN: Make global structure static and constAndre Hartmann2017-10-051-1/+1
| | | | | | | | | | | | Change-Id: I0a79a81212cf92e88e6a747b2b20e5af268c5edb Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | PeakCAN: Always compile without PCANBasic.hAndre Hartmann2017-10-051-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Keep the possibility to directly link against pcanbasic.dll/so for now, as it allows to use the PeakCAN plugin without requiring QLibrary. However, as we need to declare all symbols in peakcan_symbols_p.h anyway, there is no need to require the header file. And I need to add another symbol in a follow-up to resolve Clang warnings. Change-Id: Idb7e57d40c8074c0d14d0d1525b09663d148cb8b Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN-Plugins: Fix Clang Semantic Issue -Wold-style-castAndre Hartmann2017-10-051-1/+1
| | | | | | | | | | | | | | | | | | warning: use of old-style cast note: expanded from macro 'RESOLVE_SYMBOL' Change-Id: Icd9ae4c8543e63f1c9cf99d130bf2c26012400be Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN-Plugins: Make some more d-pointers constAndre Hartmann2017-10-051-3/+3
| | | | | | | | | | | | Change-Id: I6483232da88963f6dd46d05ebf990fe798b0b45e Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | PeakCAN: Fix Clang Semantic WarningsAndre Hartmann2017-10-053-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 261:45: warning: implicit conversion loses integer precision: 'int' to 'quint16' (aka 'unsigned short') 261:59: warning: implicit conversion loses integer precision: 'const int' to 'quint16' (aka 'unsigned short') 358:39: warning: implicit conversion changes signedness: 'int' to 'quint32' (aka 'unsigned int') qcompilerdetection.h:241:49: note: expanded from macro 'Q_UNLIKELY' 379:27: warning: implicit conversion loses integer precision: 'int' to 'quint8' (aka 'unsigned char') 419:70: warning: implicit conversion changes signedness: 'const quint64' (aka 'const unsigned long long') to 'qint64' (aka 'long long') Change-Id: Ib380145cd8775659bf0145053ac6420b3feb635e Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | PeakCAN: Indent nested includes and definesAndre Hartmann2017-10-052-5/+5
|/ | | | | | Change-Id: I881c9449b9b3594676413cb12ed966522e13f0dc Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* CAN: Remove unneded core-private dependency for pluginsv5.9.0-beta3v5.9.0-beta2Andre Hartmann2017-04-131-1/+1
| | | | | | Change-Id: I9f5c41a5c3cd0c83f3835d29de22b76ac367cdbb Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9v5.9.0-beta1Liang Qi2017-03-315-10/+10
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/canbus/canbus.pro src/plugins/canbus/vectorcan/vectorcanbackend.cpp Change-Id: I3625693784e88204c93479806242ae70c7ec7ff3
| * Updated copyright headersAndre Hartmann2017-02-025-10/+10
| | | | | | | | | | Change-Id: I7d38491c7ee15a1de788375acf9144c59b507d2a Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | QCanBusFactory: Restore binary compatibility to Qt 5.8Andre Hartmann2017-03-301-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Added a new QCanBusFactoryV2 to load plugins with the new virtual function availableDevices(). To be able to still load plugins compiled against Qt 5.8, both factories have to be considered when loading plugins and creating devices. Change-Id: I843cdd0b82193e391699daa298454c8b9522e860 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Unify endless loopsv5.9.0-alpha1Andre Hartmann2017-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Replace the macro forever with its expansion "for (;;)", as forever will be deprecated in later Qt versions. Also change the place where another pattern "while (true)" was used, to have them unique (Vector and Systec already use "for (;;)". Change-Id: I3582f7b674c17c35c6954eb359bacf81d2c1faab Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN: Improve error handling codeAndre Hartmann2017-01-241-20/+20
| | | | | | | | | | | | | | | | | | | | | | * Add Q_UNLIKELY to error handling branches * Prefers qWarning("%ls", qUtf16Printable(str)) over qWarning() << str; Task-number: QTBUG-55045 Change-Id: I3e49380bdec0edb2ea00e1b5e3421464b295aacc Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN: Use C++11 class initialization where possibleDenis Shienkov2017-01-182-16/+8
| | | | | | | | | | Change-Id: I2aeeb762297707337273b0a1ecba8b3d13ed923f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Eradicate Q_FOREACH loops and mark the module as Q_FOREACH-freeAndre Hartmann2017-01-111-1/+2
| | | | | | | | | | Change-Id: I4ec52799514b750c158e3cb8e6c38d1f1063c6c5 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN: Add QCanBusDeviceInfoAndre Hartmann2017-01-104-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Returns: * a list of available devices for the chosen plugin * if the device is virtual * if the device is CAN FD capable Use this list in the CAN Example for interface selection. If information about virtual channels or CAN FD capabability is not available, false is returned. For SocketCAN, PeakCAN, VectorCAN and SystecCAN, the implementation is completed. TinyCAN only return the list of possible interfaces for now. This is can be changed later, but needs quite some refactoring of the TinyCAN plugin. [ChangeLog][QtCanBus] Added the new class QCanBusDeviceInfo for enumeration of available CAN interfaces and more information about them. Task-number: QTBUG-54298 Change-Id: I851bcc3b9ee41aaaf1164c6b4a5aaf6503cd8746 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-121-1/+1
|\| | | | | | | | | | | | | Conflicts: examples/serialbus/can/mainwindow.cpp Change-Id: I8d821a832bc5bf966230b4f66f0113929b3114dc
| * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-161-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/canbus/peakcan/main.cpp src/plugins/canbus/tinycan/main.cpp src/serialbus/qcanbusframe.h Change-Id: I7a38350688086b5f5cd7072acccb3fa38af76f88
| | * CAN-Backends: Port qUtf8Printable to qUtf16PrintableAndre Hartmann2016-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This amends commit 0c63b3a441437a8bc42770d360a6696bbf11cd2d Change-Id: I934f90384ad9ec7d42e9437cb023b0c5edeb0437 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-09-232-5/+7
|\| | | | | | | | | | | Change-Id: Iab1b4ac1c44d161a91f7f51cd0da4fc4a674964d
| * | PeakCAN: Create TimeStamp with fromMicroSecondsAndre Hartmann2016-09-231-2/+2
| | | | | | | | | | | | | | | | | | Change-Id: I6810460e0ac2b6e9042476b48b662938d792e737 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-09-192-4/+6
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/canbus/peakcan/main.cpp src/plugins/canbus/tinycan/main.cpp Change-Id: Ia2dac20ddfc27ba96bb36cd70ba011e2d3764f2f
| | * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-172-4/+6
| | |\ | | | | | | | | | | | | Change-Id: I68fd539f6065c6a8351c1d9bdf52f8b01b4ea923
| | | * PeakCAN: Avoid overflows on timestamp calculationAndre Hartmann2016-09-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the formula itself is correct, there is a chance of getting wrong values due to limited data types. Found after a hint from H.Mueller in the Peak Forum: http://www.peak-system.com/forum/viewtopic.php?f=41&t=1238 Change-Id: I0f3036c5d694bee7cc8d3fd54e206545b71344b7 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | | * PeakCAN: Fix timestampsAndre Hartmann2016-08-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TimeStamp object gets seconds and microseconds, so the milliseconds that are smaller than one second have to be transformed to microseconds. Further, add the millis_overflow to extend the range of the timestamps. Change-Id: I0b0b531a7d1f2816d24a0683a2156cb19a3f655e Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | | * PeakCAN: Do not set an error when receive buffer is emptyAndre Hartmann2016-08-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function PeakCanBackendPrivate::startRead() reads all incoming frames until the receive buffer becomes empty. When the receive buffer is empty, the function should exit silently. Otherwise, an error should be set up. The previous code simply used the wrong constant to allow this valid case. Change-Id: I325e25682d7749950d936bf715a160a2beff7d06 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | | * CAN: Use qUtf8Printable() instead qPrintable() for warningsAndre Hartmann2016-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the qPrintable() help: "Note: qDebug(), qInfo(), qWarning(), qCritical(), qFatal() expect %s arguments to be UTF-8 encoded, while qPrintable() converts to local 8-bit encoding. Therefore qUtf8Printable() should be used for logging strings instead of qPrintable()." Change-Id: I724cc61659dd4f998617eade140b273dca841b35 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | | * CAN: Better error messages when loading dynamic librariesAndre Hartmann2016-08-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make use of the detailed (and localized) error messages that QLibrary already provides. Example: Cannot load library pcanbasic: \ (pcanbasic: cannot open shared object file: No such file or directory) Change-Id: I3f4fd42d1872a00f2c4ecc6172ccc17995c7888e Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * | | CAN-Backends: Use std::move to append QCanBusFrame to QVectorAndre Hartmann2016-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For SocketCAN this was already done in 71d19b3e9ccbbfc3131fbd21d983faaca0002621 Change-Id: I734e1d83901f8ce2de189f7d873724aa4aab989f Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | | PeakCAN: Add support for more CAN channelsAndre Hartmann2016-09-153-60/+81
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend the PCI and USB interfaces to the maximum supported by the PeakCAN Basic API. The new constants are taken from a recent pcanbasic.h. [ChangeLog][QtSerialBus][PeakCAN] The PeakCAN Plugin now supports up to 16 USB and 16 PCI CAN channels. Change-Id: I02e8e003e56aafd8546cbb32816e4bd9d9c77861 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | CAN: Simplify debug error message generationAndre Hartmann2016-08-311-13/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The warning is already shown in PeakCanBusPlugin::createDevice() and TinyCanBusPlugin::createDevice() so it does not need to be done here. Change-Id: Ifac34d9b96eff5920d09f3c971caeda62d97839a Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | CAN: Unify interface namesAndre Hartmann2016-08-301-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mostly, the interfaces now simply start with can0 and the number increases for every next interface. Some vendors distinguish between e.g. PCI and USB interfaces. In this case, the interfaces are named usb0 and pci0, with increasing numbers, respectively. Multiple channels per device are accessed by adding the channel number after a dot: can0.0 for the first channel in the first device (TinyCAN). SocketCAN is still a bit different, as it allows arbitrary interface names to be mapped to the hardware or virtual CAN busses. [ChangeLog][QtSerialBus][Unify interface names] The interface names of the different backends were unified to follow a common rule: The prefixes were unified, the numbering now always starts with zero. Change-Id: Ia2ca76a9be01b9123aed1ede90debf69871bb82c Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | Merge "Merge remote-tracking branch 'gerrit/5.7' into dev" into refs/staging/devAlex Blasche2016-08-021-16/+18
|\ \ \
| * | | Merge remote-tracking branch 'gerrit/5.7' into devAlex Blasche2016-08-011-16/+18
| |\| | | | | | | | | | | | | | Change-Id: I5202af1faa3b92018747b38fe54524cc712d2f43
| | * | Merge remote-tracking branch 'origin/5.6' into 5.7Edward Welbourne2016-07-261-13/+19
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/canbus/peakcan/peakcanbackend.cpp One side renamed a member. The other changed some code using it. Change-Id: I14131122835ab9014894eadf4b529bdfd413e436
| | | * PeakCAN: Remove unneeded emitAndre Hartmann2016-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QCanBusDevice::setError() is no SIGNAL, but a protected member function. Change-Id: I10e83d189d3df93504b759729d0c4fc5caa682b0 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| | | * CAN: More information when configuration failsAndre Hartmann2016-07-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ... for PEAK and TINY backends. Change-Id: I0285107616bbfbaa91df266e2116f5d7460d60ca Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| | | * PeakCAN: Do not close interface when open failsAndre Hartmann2016-07-181-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trying to close an interface that is not open leads to errors which fill the internal error message buffer with unrelated errors like "full write buffer". Instead, the error should indicate that open failed. As QCanBusDevice::connectDevice() already sets UnconnectedState, this does not need to be done here. Change-Id: I61c73c9d51e05eb5ea80a13e1c706e4a3eca98c0 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| | | * Fix logic with the wrong priority of operationsDenis Shienkov2016-07-121-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The assignment '=' operator has a lower priority, than the comparison '==, !=' operators. Thus, the result of logical statements is wrong. Change-Id: Iab281f1f3dd95b59da94379fd68a45f75e2dd5ac Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | | QCanBusFactory: Add override to derived createDevice()Andre Hartmann2016-08-011-1/+1
|/ / / | | | | | | | | | | | | Change-Id: I78fdf3ebf0d5becd11a003596c0f3ec3aa556504 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | QCanBus: Receive an error message from createDevice()Andre Hartmann2016-06-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog] Before, createDevice() could only return nullptr if anything goes wrong. Now, an optional textual error description can be returned. Task-number: QTBUG-53642 Change-Id: Ie097e5c63096ae6a6fb9a798e4a8f23219cf1cfb Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | CAN: Simplify the code of the PeakCAN backendDenis Shienkov2016-05-312-85/+44
|/ / | | | | | | | | | | | | | | | | | | We do not need to keep separate enableWriteNotification(), acquireReadNotification() and releaseReadNotification() methods; their bodies can be moved to the open()/close() methods, that simplified a code. Change-Id: I35577d6637e879da80701658c3d8781ba891a1b8 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* | CAN: Give some methods and variables shorter namesDenis Shienkov2016-05-132-48/+51
| | | | | | | | | | | | | | | | ... that better express their purpose. Change-Id: I2a725e755695df2eab2b11289b44d90a81012f04 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* | CAN: Do not use PUBLIC(PRIVATE)_HEADERS divisionDenis Shienkov2016-05-131-6/+2
| | | | | | | | | | | | | | | | | | ... also made small cosmetic dependent refactoring of plugins project files. Change-Id: I0fbfd585c14868944a3cac8ff5bd82408a5cace6 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Use DISTFILES instead of OTHER_FILESDenis Shienkov2016-05-131-1/+1
|/ | | | | | Change-Id: Id666c7c78b159955db1b494f6997437b6ea19bc1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* CAN: Correct spelling for "CAN" and "CAN FD"Andre Hartmann2016-05-021-2/+2
| | | | | | | | | ... in comments, user and debug output, and documentation. Change-Id: I76ddf418bc1612a7310f80ee2ce596e8d6ab0721 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Replace 'Q_DECL_OVERRIDE' with 'override'Denis Shienkov2016-04-262-8/+8
| | | | | Change-Id: Iebbd61359296499600fe164429e710273a94b86d Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Use 'auto' where it is possibleDenis Shienkov2016-04-221-1/+1
| | | | | | Change-Id: I3d915a6230a1f35317abc39d6266a9d46a5d9be6 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Adjust Pointer and Reference to Qt Coding StyleAndre Hartmann2016-04-221-2/+2
| | | | | Change-Id: Ifa233b324a82209cb597b5cf555b4e290b890e10 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>