-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmainwindow.h
More file actions
104 lines (88 loc) · 2.46 KB
/
Copy pathmainwindow.h
File metadata and controls
104 lines (88 loc) · 2.46 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QTimer>
#include "softversion.h"
#include "displaydata.h"
#include "zmq_subscriber_modfd.hpp"
#include "techlogger.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void slotStart();
void slotAddDisplay();
void slotTimerTick();
void slotInputCAN();
#ifdef __WIN32
int sendCanFrame(const QString& canStr);
void pluginChanged(const QString &plugin);
void interfaceChanged(const QString &interf);
#endif
void slotInputZMQ();
void slotInputFile();
void slotLoadFile();
void slotPlayFile();
void slotStopFile();
void slotMirroring(bool checked);
void slotLogging(bool checked);
private:
Ui::MainWindow *ui;
SoftVersion* sVersion = nullptr;
DisplayData* displays[RADAR_NUM];
QString statusRadMess;
bool isAppStopped = true;
InUse inUse = InUse::nothing;
void sendToDisplay(const CanLine &canLine);
// ----- ----- ----- INPUT FROM CAN ----- ----- -----
int handle = 0;
#ifdef __WIN32
QList<QCanBusDeviceInfo> interfaces;
Settings canSets;
std::unique_ptr<QCanBusDevice> canDevice;
#else
struct sockaddr_can sockAddr;
struct ifreq ifr;
#endif
qint64 numFramesReceived = 0;
std::string deviceName;
uint16_t delayCanUs = 5000;
std::thread thrCanRcv;
bool isCanOpened = false;
#ifdef __WIN32
bool connectDevice();
void procErrors(QCanBusDevice::CanBusError) const;
void procReceivedFrames();
#else
bool openCan(const std::string &device);
#endif
void canRcv();
// ----- ----- ----- INPUT FROM ZMQ ----- ----- -----
bool isSubscrStarted = false;
uint16_t delayZmqUs = 3000;
std::thread thrZmqRcv;
Subscriber_modfd zmqSubscriber;
MessageId msgId;
QString zmqAddrRcv;
void zmqRcv();
// ----- ----- ----- INPUT FROM FILE ----- ----- -----
std::thread thrPlayFile;
bool isFileLoaded = false;
bool isPlay = false;
QString pathFileCanLog;
std::vector<CanLine> canLines;
// ----- ----- ----- LOGGER ----- ----- -----
std::thread thrLog;
TechLogger tLogger;
std::mutex mutLoc;
std::condition_variable condVar;
QTimer* timer = nullptr;
uint8_t indicCount = 9;
void fillCanLines(QFile &file, int linesAmount);
void playCanFile();
};
#endif // MAINWINDOW_H