-
Notifications
You must be signed in to change notification settings - Fork 293
/
mainwindow.h
233 lines (213 loc) · 6.97 KB
/
mainwindow.h
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "config.h"
#include <QMainWindow>
#include <QSerialPort>
#include <QSerialPortInfo>
#include "canframemodel.h"
#include "can_structs.h"
#include "framefileio.h"
#include "dbc/dbchandler.h"
#include "bus_protocols/isotp_handler.h"
#include "framesenderobject.h"
#include "re/graphingwindow.h"
#include "re/frameinfowindow.h"
#include "frameplaybackwindow.h"
#include "bisectwindow.h"
#include "re/flowviewwindow.h"
#include "framesenderwindow.h"
#include "re/filecomparatorwindow.h"
#include "dbc/dbcmaineditor.h"
#include "mainsettingsdialog.h"
#include "firmwareuploaderwindow.h"
#include "re/discretestatewindow.h"
#include "scriptingwindow.h"
#include "re/rangestatewindow.h"
#include "dbc/dbcloadsavewindow.h"
#include "re/fuzzingwindow.h"
#include "re/udsscanwindow.h"
#include "re/sniffer/snifferwindow.h"
#include "re/isotp_interpreterwindow.h"
#include "motorcontrollerconfigwindow.h"
#include "signalviewerwindow.h"
#include "re/temporalgraphwindow.h"
#include "re/dbccomparatorwindow.h"
#include "canbridgewindow.h"
class CANConnection;
class ConnectionWindow;
class ISOTP_InterpreterWindow;
class ScriptingWindow;
enum SIMP_COL
{
SC_COL_EN = 0,
SC_COL_BUS = 1,
SC_COL_ID = 2,
SC_COL_EXT = 3,
SC_COL_REM = 4,
SC_COL_DATA = 5,
SC_COL_INTERVAL = 6,
SC_COL_COUNT = 7,
};
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
static QString loadedFileName;
static MainWindow *getReference();
CANFrameModel * getCANFrameModel();
~MainWindow();
void handleDroppedFile(const QString &filename);
private slots:
void handleLoadFile();
void handleSaveFile();
void handleSaveFilteredFile();
void handleSaveFilters();
void handleLoadFilters();
void handleContinousLogging();
void showGraphingWindow();
void showFrameDataAnalysis();
void clearFrames();
void expandAllRows();
void collapseAllRows();
void showPlaybackWindow();
void showFlowViewWindow();
void showFrameSenderWindow();
void showSingleMultiWindow();
void showRangeWindow();
void showFuzzyScopeWindow();
void showComparisonWindow();
void showSettingsDialog();
void showFirmwareUploaderWindow();
void showConnectionSettingsWindow();
void showScriptingWindow();
void showDBCFileWindow();
void showFuzzingWindow();
void showMCConfigWindow();
void showUDSScanWindow();
void showISOInterpreterWindow();
void showSnifferWindow();
void showBisectWindow();
void showSignalViewer();
void showTemporalGraphWindow();
void showDBCComparisonWindow();
void showCANBridgeWindow();
void exitApp();
void handleSaveDecoded();
void handleSaveDecodedCsv();
void connectionStatusUpdated(int conns);
void gridClicked(QModelIndex);
void gridDoubleClicked(QModelIndex);
void gridContextMenuRequest(QPoint pos);
void setupAddToNewGraph();
void setupSendToLatestGraphWindow();
void interpretToggled(bool);
void overwriteToggled(bool);
void presistentFiltersToggled(bool state);
void logReceivedFrame(CANConnection*, QVector<CANFrame>);
void tickGUIUpdate();
void toggleCapture();
void normalizeTiming();
void updateFilterList();
void filterListItemChanged(QListWidgetItem *item);
void busFilterListItemChanged(QListWidgetItem *item);
void filterSetAll();
void filterClearAll();
void headerClicked (int logicalIndex);
void DBCSettingsUpdated();
void onSenderCellChanged(int, int);
public slots:
void gotFrames(int);
void updateSettings();
void readUpdateableSettings();
void gotCenterTimeID(uint32_t ID, double timestamp);
void updateConnectionSettings(QString connectionType, QString port, int speed0, int speed1);
signals:
void sendCANFrame(const CANFrame *, int);
void suspendCapturing(bool);
//-1 = frames cleared, -2 = a new file has been loaded (so all frames are different), otherwise # of new frames
void framesUpdated(int numFrames); //something has updated the frame list (send at gui update frequency)
void frameUpdateRapid(int numFrames);
void settingsUpdated();
void sendCenterTimeID(uint32_t ID, double timestamp);
private:
Ui::MainWindow *ui;
static MainWindow *selfRef;
//canbus related data
CANFrameModel *model;
DBCHandler *dbcHandler;
QByteArray inputBuffer;
QTimer updateTimer;
QElapsedTimer *elapsedTime;
FrameSenderObject *frameSender;
int framesPerSec;
int rxFrames;
bool inhibitFilterUpdate;
bool useHex;
bool allowCapture;
bool ignoreDBCColors;
bool CSVAbsTime;
bool bDirty; //have frames been added or subtracted since the last save/load?
bool useFiltered; //should sub-windows use the unfiltered or filtered frames list?
bool inhibitSenderChanged;
bool continuousLogging;
int continuousLogFlushCounter;
//References to other windows we can display
//Graph window is allowed to instantiate more than once. All the rest are not (yet).
GraphingWindow *lastGraphingWindow;
QList<GraphingWindow *> graphWindows;
FrameInfoWindow *frameInfoWindow;
FramePlaybackWindow *playbackWindow;
FlowViewWindow *flowViewWindow;
FrameSenderWindow *frameSenderWindow;
DBCMainEditor *dbcMainEditor;
FileComparatorWindow *comparatorWindow;
MainSettingsDialog *settingsDialog;
DiscreteStateWindow *discreteStateWindow;
FirmwareUploaderWindow *firmwareUploaderWindow;
ConnectionWindow *connectionWindow;
ScriptingWindow *scriptingWindow;
RangeStateWindow *rangeWindow;
DBCLoadSaveWindow *dbcFileWindow;
FuzzingWindow *fuzzingWindow;
UDSScanWindow *udsScanWindow;
ISOTP_InterpreterWindow *isoWindow;
SnifferWindow* snifferWindow;
MotorControllerConfigWindow *motorctrlConfigWindow;
BisectWindow* bisectWindow;
SignalViewerWindow *signalViewerWindow;
TemporalGraphWindow *temporalGraphWindow;
DBCComparatorWindow *dbcComparatorWindow;
CANBridgeWindow *canBridgeWindow;
//various private storage
QLabel lbStatusConnected;
QLabel lbStatusFilename;
QLabel lbStatusDatabase;
QLabel lbHelp;
int normalRowHeight;
bool isConnected;
QPoint contextMenuPosition;
bool rowExpansionActive = false;
//private methods
QString getSignalNameFromPosition(QPoint pos);
uint32_t getMessageIDFromPosition(QPoint pos);
void handleSaveDecodedMethod(bool csv);
void saveDecodedTextFile(QString);
void saveDecodedTextFileAsColumns(QString);
void addFrameToDisplay(CANFrame &, bool);
void updateFileStatus();
void closeEvent(QCloseEvent *event);
void killEmAll();
void killWindow(QDialog *win);
void readSettings();
void writeSettings();
bool eventFilter(QObject *obj, QEvent *event);
void manageRowExpansion();
void disableAutoRowExpansion();
void createSenderRow();
void processSenderCellChange(int line, int col);
};
#endif // MAINWINDOW_H