summaryrefslogtreecommitdiffstats
path: root/src/plugins/canbus/virtualcan/virtualcanbackend.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Allow enabling QT_USE_QSTRINGBUILDER for pluginsAlexey Edelev2023-08-041-3/+5
| | | | | Change-Id: I0695f9a8f494d110894aa01a1111cfeb1d1a039f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-061-1/+1
| | | | | | | | | | | | | | | 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>
* Use SPDX license identifiersLucie Gérard2022-06-101-38/+2
| | | | | | | | | | | 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>
* Use up-to date LGPL license headerKai Köhne2021-11-301-11/+14
| | | | | | | | | Remove usages of outdated LGPL3 header that references LICENSES.LGPLv3 instead of LICENSES.LGPL3. Change-Id: I2dd25a1a7d6ad3e3cbb06753bbc839e26f4a7b26 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* CAN: Implement QCanBusDevice::deviceInfo() in the pluginsAndre Hartmann2021-08-051-7/+16
| | | | | | | | | | | | | | * PasstruCAN: Untested * PeakCAN: Tested on Windows with PCAN-USB Pro FD. * SocketCAN: Tested on Linux with virtual and real hardware. * SystecCAN: Tested on Windows with USBcanmodul2. * TinyCAN: Untested * VectorCAN: Tested with the virtual Vector interface. * VirtualCAN: Tested on Windows and Linux. Pick-to: 6.2 Change-Id: I3836a81a9cb1570a22b6264b34fca88ccc0ab57e Reviewed-by: André Hartmann <aha_1980@gmx.de>
* QCanBusDeviceInfo: Add method to obtain the plugin nameAndre Hartmann2021-07-231-0/+1
| | | | | | | | | | | | [ChangeLog][QCanBusDeviceInfo] Added the CAN bus plugin name to QCanBusDeviceInfo. Custom plugins must be adopted to the changed QCanBusDevice::createDeviceInfo() method. Pick-to: 6.2 Change-Id: I44d658aaa6f873eecce447dd9ee4539c9fbe2043 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* QCanBusDevice: Consolidate createDeviceInfo()Andre Hartmann2021-07-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | This protected function is used from the CAN plugins to create QCanBusDeviceInfo objects. We want to add another parameter (plugin) to the function in a follow-up commit, so let's first remove unneeded overloads that were created during Qt 5 times and only keep the very simple and the all-embracing one. While at it, remove the std::move calls as clang gives performance warnings here: socketcanbackend.cpp:149:23: error: moving a temporary object prevents copy elision socketcanbackend.cpp:149:23: note: remove std::move call here Pick-to: 6.2 Change-Id: Ie83db3cd3a9d6b40b2da4a9ce736861a0ee8359f Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Introduce QCanBusFrame::FrameIdAndre Hartmann2021-03-271-1/+1
| | | | | | | | | | | | | | | | | Use a dedicated type instead of quint32 to mark a CAN bus frame identifier as such. For now it is just an alias to quint32, but can be changed to some other type for Qt 7. [ChangeLog][QCanBusFrame] Introduced a specific type QCanBusFrame::FrameId for the CAN bus frames identifier. The new type is a typedef to quint32 and therefore should be source compatible. Change-Id: Ie26aa69cd48eb9cee4c11a0c8f8ba74efae24b4f Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* QCanBusDevice: Replace int parameter with ConfigurationKeyAndre Hartmann2021-02-031-1/+1
| | | | | | | | | | | | | | | | | | They only place where this might break user code, is for custom plugins using custom configuration parameters. For most users however, this type safety makes the API easier to use. [ChangeLog][QCanBusDevice] All functions dealing with configuration parameters now take a QCanBusDevice::ConfigurationKey instead an int. Fixes: QTBUG-89839 Change-Id: I0a1de5fdcfc4292b23599d4770102740a2df1601 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* VirtualCAN: Add missing framesWritten() emissionAndre Hartmann2020-03-261-0/+1
| | | | | | | | | | [ChangeLog][VirtualCAN] Added the missing emission of the framesWritten() signal to writeFrame(). Fixes: QTBUG-83044 Change-Id: I3f278519f8076a9bf638bed5565464a92b97abf7 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* VirtualCAN: Remove superfluous setting to closing stateAndre Hartmann2019-11-151-1/+1
| | | | | | | | | | | | | Because that is already done in QCanBusDevice::disconnectDevice() before calling this private implementation. Add a logging entry instead. Change-Id: I4b7e4ba31a49e2a80d92e8dc0f24a8065d465f3a Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* VirtualCAN: Fix disconnecting from busAndre Hartmann2019-11-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | While the client sent a disconnect command to the server, this was not handled on server side. Thus, the client was never really Unconnected and in turn it was not possible to connect again. Fix that by closing the socket, that leads to VirtualCanBackend::clientDisconnected() being called and that sets the plugin to Unconnected. In any case, the server keeps running until the plugin is unloaded, even after the last client is disconnected. [ChangeLog][VirtualCAN] Fixed that the plugin stayed forever in closing state and subsequent connect calls always failed. Change-Id: I7a490c55a3cb6bd193ba4783b48d1385aa85bcde Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* VirtualCAN: Slightly adopt debug outputAndre Hartmann2019-03-251-4/+4
| | | | | | | | | | | | | | | | | | | Remove the colons from a few places to make their output similar to the debug output in other lines. Example (omitting qt.canbus.plugins.virtualcan prefix): Server [0x7f19684903c0] constructed. Server [0x7f19684903c0] could not be started, port 35468 is already in use. Client [0x5586262ecaa0] socket created. Client [0x5586262ecaa0] socket connected. Client [0x5586262ecaa0] received: '0##f9ffad71e96cb5ee'. Client [0x5586262ecaa0] socket disconnected. Client [0x5586262ecaa0] socket destructed. Server [0x7f19684903c0] destructed. Change-Id: I6d91282a262c58e2c983ee6db5c030698197c9f6 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add a virtual CAN bus pluginAndre Hartmann2018-08-011-0/+362
Based on a TCP/IP server/client infrastructure, to allow testing programs against a second program without CAN hardware connected. [ChangeLog][QCanBus] Added a generic virtual CAN bus plugin. Task-number: QTBUG-61837 Change-Id: I7acf04bd476b65b4d1d04254463d61a4dc9042d5 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>