| 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 <QtSerialBus/qcanbus.h> |
| 7 | #include <QtSerialBus/qcanbusdevice.h> |
| 8 | #include <QtSerialBus/qcanbusfactory.h> |
| 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<QCanBusDevice::CanBusError>(); |
| 22 | qRegisterMetaType<QList<QCanBusFrame>>(); |
| 23 | } |
| 24 | |
| 25 | QList<QCanBusDeviceInfo> 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 |
