1// Copyright (C) 2017 Denis Shienkov <denis.shienkov@gmail.com>
2// Copyright (C) 2017 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef TINYCANBACKEND_H
6#define TINYCANBACKEND_H
7
8#include <QtSerialBus/qcanbusdevice.h>
9#include <QtSerialBus/qcanbusdeviceinfo.h>
10#include <QtSerialBus/qcanbusframe.h>
11
12#include <QtCore/qlist.h>
13#include <QtCore/qvariant.h>
14
15QT_BEGIN_NAMESPACE
16
17class TinyCanBackendPrivate;
18
19class TinyCanBackend : public QCanBusDevice
20{
21 Q_OBJECT
22 Q_DECLARE_PRIVATE(TinyCanBackend)
23 Q_DISABLE_COPY(TinyCanBackend)
24public:
25 explicit TinyCanBackend(const QString &name, QObject *parent = nullptr);
26 ~TinyCanBackend();
27
28 bool open() override;
29 void close() override;
30
31 void setConfigurationParameter(ConfigurationKey key, const QVariant &value) override;
32
33 bool writeFrame(const QCanBusFrame &newData) override;
34
35 QString interpretErrorFrame(const QCanBusFrame &errorFrame) override;
36
37 static bool canCreate(QString *errorReason);
38 static QList<QCanBusDeviceInfo> interfaces();
39
40 void resetController() override;
41 QCanBusDeviceInfo deviceInfo() const override;
42
43private:
44 TinyCanBackendPrivate * const d_ptr;
45};
46
47QT_END_NAMESPACE
48
49#endif // TINYCANBACKEND_H
50

source code of qtserialbus/src/plugins/canbus/tinycan/tinycanbackend.h