blob: 367b5c579dc32a965793c9658dd32d787374d521 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QCanBusDevice>
#include <QMainWindow>
class ConnectDialog;
class ReceivedFramesModel;
QT_BEGIN_NAMESPACE
class QCanBusFrame;
class QLabel;
class QTimer;
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
private slots:
void processReceivedFrames();
void sendFrame(const QCanBusFrame &frame) const;
void processErrors(QCanBusDevice::CanBusError) const;
void connectDevice();
void busStatus();
void disconnectDevice();
void processFramesWritten(qint64);
void onAppendFramesTimeout();
protected:
void closeEvent(QCloseEvent *event) override;
private:
void initActionsConnections();
qint64 m_numberFramesWritten = 0;
qint64 m_numberFramesReceived = 0;
Ui::MainWindow *m_ui = nullptr;
QLabel *m_status = nullptr;
QLabel *m_written = nullptr;
QLabel *m_received = nullptr;
ConnectDialog *m_connectDialog = nullptr;
std::unique_ptr<QCanBusDevice> m_canDevice;
QTimer *m_busStatusTimer = nullptr;
QTimer *m_appendTimer = nullptr;
ReceivedFramesModel *m_model = nullptr;
};
#endif // MAINWINDOW_H
|