-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathincludes.h
162 lines (139 loc) · 2.94 KB
/
includes.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
#ifndef INCLUDES_H
#define INCLUDES_H
/*包含头文件*/
#include <QThread>
#include <QTimer>
#include <QDebug>
#include <QMetaType>
#include <QMessageBox>
#include <QRegExp>
#include <QPalette>
#include <QDateTime>
#include "ControlCAN.h"
#include <memory>
//通用定义
/*返回宏*/
#define PRINTF_LOCATION() qDebug()<< "ret in "<< __FILE__ << " at " <<__LINE__
#define RET_VALUE_IF_NOT_EAQU(a,b,c) \
do { \
if(a!=b) \
{ \
PRINTF_LOCATION();\
return c; \
} \
} while (false)
#define RET_VALUE_IF_EAQU(a,b,c) \
do { \
if(a==b) \
{ \
PRINTF_LOCATION();\
return c; \
} \
} while (false)
#define RET_IF_NOT_EAQU(a,b) \
do { \
if(a!=b) \
{ \
PRINTF_LOCATION();\
return; \
} \
} while (false)
#define RET_IF_EAQU(a,b) \
do { \
if(a==b) \
{ \
PRINTF_LOCATION();\
return; \
} \
} while (false)
/*进制*/
#define Z_OCTAL 8
#define Z_DECIMAL 10
#define Z_HEX 16
/*返回值枚举类型*/
enum RET_VALUE{
RET_ERR = 0,
RET_OK
};
/*调试开关*/
#define OPEN_IF 1
#define CLOSE_IF 0
//项目相关的定义
/*can状态*/
enum CAN_STATUS{
UNINIT = 0,//未初始化
UNCONNECT,//未连接
OPENDED,//打开
INITED,//初始化
STARTED//就绪
};
/*can发送类型*/
enum CAN_SEND_TYPE{
CAN_SEND_NORMAL = 0,//正常
CAN_SEND_SIGNAL,//单次
CAN_SEND_SELF,//自发自收
CAN_SEND_SELF_SIGNAL//单次自发自收
};
/*can数据类型*/
enum CAN_DATA_TYPE{
CAN_DATA_INFO=0,//数据帧
CAN_DATA_REMOTE//远程帧
};
/*是否扩展帧*/
enum CAN_EXTERN_TYPE{
CAN_FRAM_STANDARD=0,//标准帧
CAN_FRAM_EXTERN//扩展帧
};
/*传输类型*/
enum CAN_TRANSMIT_TYPE{
CAN_SEND=0,//发送
CAN_RCV//接收
};
/*发送帧的结构体*/
struct CAN_SEND_FRAME_STRUCT
{
CAN_SEND_FRAME_STRUCT()
{
packetTyepStr = "";
idStr = "";
dataStr = "";
sourceStr = "";
aimStr = "";
timeStr = "";
meaningStr = "";
isSendToSelf = false;
sendCount = 0;
}
QString packetTyepStr;
QString idStr;
QString dataStr;
QString sourceStr;
QString aimStr;
QString timeStr;
QString meaningStr;
bool isSendToSelf;
int sendCount;
};
/*自发类型*/
#define SEND_SELF "是"
#define SEND_NORMAL "否"
/*报文类型*/
enum PACKET_TYPE{
GATHER_PACKET=1,//信号采集板采集报文
CONTROL_PACKET,//设备间主控箱控制报文
STATE_PACKET,//采集模块状态报文
TESTING_PACKET,//轨旁控制箱状态检测报文
INFO_PACKET,//板卡信息报文
ALL_PACKET//所有的报文
};
/*地址定义*/
enum PACKET_ADDRES{
CPU_ADDR=1,//主控板地址
GATHRE_ADDR,//采集板地址
BOTTOM_ADDR,//沉箱控制板地址
SIDE_ADDR,//侧箱控制板地址
TOP_ADDR,//车顶控制板地址
BROADCAST_ADDR,//广播地址
ALL_ADDR//所有地址
};
#endif // INCLUDES_H