-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
54 lines (47 loc) · 1.64 KB
/
main.cpp
File metadata and controls
54 lines (47 loc) · 1.64 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
#include "mainwindow.h"
#include "serialport.h"
#include "parser.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
SerialPort serial = SerialPort();
serial.readPort(); //figure out how to make sure its connected/open
QByteArrray canId = serial.getCanId(); //get CAN ID
char* data = serial.getDataAddress(); //Gets the address of the char array of message
//time to parse
if (canId == 0x200)
Throttle currObject = Throttle();
else if (canId == 0x201)
Brake currObject = Brake();
else if (canId == 0x188)
Pack currObject = Pack();
else if (canId == 0x388)
Voltage currObject = Voltage();
else if (canId == 0x488)
Temperature currObject = Temperature();
else if (canId == 0x288)
CurrentRead currObject = CurrentRead();
else if (canId == 0x626)
DashBoard currObject = DashBoard();
else if (canId == 0x466)
CurtisDebug currObject = CurtisDebug();
else if (canId == 0x566)
CurtisStatus currObject = CurtisStatus();
else if (canId == 0x666)
CurtisRecvAcknowledge currObject = CurtisRecvAcknowledge();
else if (canId == 0x766)
CurtisRecv currObject = CurtisRecv();
else if (canId == 0x223)
DLHeartbeat currObject = DLHeartbeat();
else if (canId == 0x123)
DLTime currObject = DLTime();
else if (canId == 0x247)
SensorStatus currObject = SensorStatus();
else
std::cout << "Error: No matching CAN ID" << std::endl;
currObject.parse(&data); // parse the message based on the id
return a.exec();
}