summaryrefslogtreecommitdiffstats
path: root/tests/auto/plugins/testcanbus/testcanbackend.h
blob: 8d29caa7f6006992ff4856cd07f10c203b646803 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef TESTCANBACKEND_H
#define TESTCANBACKEND_H

#include <QtSerialBus/qcanbusdevice.h>

QT_BEGIN_NAMESPACE

class QTimer;

class TestCanBackend : public QCanBusDevice
{
    Q_OBJECT
public:
    explicit TestCanBackend();

    bool open() override;
    void close() override;

    bool writeFrame(const QCanBusFrame &data) override;

    QString interpretErrorFrame(const QCanBusFrame &) override;

    static QList<QCanBusDeviceInfo> interfaces();

private:
    QTimer *simulateReceivingTimer = nullptr;
};

QT_END_NAMESPACE

#endif // TESTCANBACKEND_H