-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwidget.h
196 lines (157 loc) · 6.75 KB
/
widget.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
#ifndef WIDGET_H
#define WIDGET_H
#include <controlcan.h>
#include <proceesframe.h>
#include <sentframe.h>
#include "helpform.h"
#include <QWidget>
#include <QDebug>
#include <QThread>
#include <QMessageBox>
#include <QTimer>
#include <QSettings>
#include <QShortcut>
//***
#ifdef WIN32 // for windows
# include <windows.h>
# include <process.h>
# include <stdio.h>
# include <time.h>
# include "controlcan.h"
# pragma comment(lib, "controlcan.lib")
# define msleep(ms) Sleep(ms)
typedef HANDLE pthread_t;
#else // for linux
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <strings.h>
# include <unistd.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
#endif
//***
typedef struct{
State state;
int transNum;
StateTransform * transform;
} StateMachine; // 状态机结构体
extern StateMachine stateMachine;
extern StateTransform stateTran[]; // 柔性数组必须使用extern
extern QMutex m_mutex;
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = nullptr);
~Widget();
static QByteArray Test_Array; // fresh Demand Current/Voltage
static VCI_CAN_OBJ _BCL[1]; // BCL Frame Data
static VCI_CAN_OBJ _BCLP[1]; // BCLP Frame Data
static VCI_CAN_OBJ _BCS[2]; // BCS Frame Data
static VCI_CAN_OBJ _BCP[2]; // BCP Frame Data
static VCI_CAN_OBJ _BSM[1]; // BSM Frame Data
static VCI_CAN_OBJ _BHM[1]; // BHM Frame Data
static VCI_CAN_OBJ _BRM[7]; // BRM Frame Data
static VCI_CAN_OBJ _BDC[4]; // BDC Frame Data
static VCI_CAN_OBJ _BCPP[1]; // BCPP Frame Data
static VCI_CAN_OBJ _BCSP[1]; // BCSP Frame Data
static VCI_CAN_OBJ _BST[1]; // BST Frame Data
static VCI_CAN_OBJ _BSD[1]; // BSD Frame Data
static VCI_CAN_OBJ _BEM[1]; // BEM Frame Data
static int Ready_time_ms;
static bool transFree; // CAN transmit Bus free
static bool V2G_Mode_Flag; // V2G mode : flag = true
static bool TimeoutBCL_Flag; // TimeoutBCL : flag = false
signals:
void EXE_Action(Action); // send transmit signal
private slots:
void CloseDev(unsigned Error); // function for Close USB_CAN bus
void runStateMachine(EventID evt); // StateMachine process
void on_pushButton1_1_clicked(); // function for loading Demand Voltage/Current setting
QByteArray processVoltage(QString, int); // transfer Voltages String to BMS Demand Voltage
QByteArray processCurrent(QString, int); // transfer Current String to BMS Demand Current
QByteArray processCurrentBCLP(QString, int);// transfer Current String to BMS R若echanger Current
QByteArray processTemprature(QString); // trnasfer Temprature String to BMS Tcell
void UpdateCCS_CV(QByteArray); // update CCS voltage and current
void UpdateCCD_01(QByteArray);
void UpdateCCD_00(QByteArray);
void UpdateCML_CV(QByteArray);
void UpdateCMLP_CV(QByteArray);
void BMS_Ready();
void BST_Timeout();
void SaveSetting(); // Save configure file
void ImportConf(); // import configuration
void RebootCAN(); // reboot can and initalize
void Changer_Vision(QByteArray); // show Agreement Vision V1.10/V1.12
void on_lineEdit1_6_textChanged(const QString &arg1); // VIN Code Edit
void Parser(EventID, QByteArray); // analyze can data
void Charger_Info_init(); // 充电机参数信息界面初始化
void Fault_State_ACheck(); // 故障注入所有点初始禁用
void Fault_State_AUncheck(); // 故障注入所有电初始使能
/*!***************************************************
* Description: BCS voltage & current initlize
* @param mode fault mode lock
* @return void
* @note when BMS reconnect and precharge
* @date 2021,02,06
* @author YaoLi
****************************************************/
void BCS_CV_Init(bool mode);
void on_pushButton1_2_clicked();
void on_checkBox1_2_stateChanged();
void on_pushButton1_3_clicked();
void on_checkBox1_3_stateChanged(int arg1);
void on_checkBox1_5_stateChanged(int arg1);
void on_checkBox1_4_stateChanged(int arg1);
void on_checkBox1_6_stateChanged(int arg1);
void on_checkBox1_7_stateChanged(int arg1);
void on_checkBox1_8_stateChanged(int arg1);
void on_checkBox1_9_stateChanged(int arg1);
void on_checkBox1_10_stateChanged(int arg1);
void on_checkBox1_11_stateChanged(int arg1);
void on_checkBox1_12_stateChanged(int arg1);
void on_comboBox1_1_currentIndexChanged(const QString &arg1);
void on_comboBox1_2_currentIndexChanged(const QString &arg1);
void on_comboBox1_3_currentIndexChanged(const QString &arg1);
void on_checkBox1_13_stateChanged(int arg1);
void on_checkBox1_14_stateChanged(int arg1);
void on_checkBox1_16_stateChanged(int arg1);
void on_checkBox1_15_stateChanged(int arg1);
void on_comboBox1_4_currentIndexChanged(const QString &arg1);
void on_checkBox1_18_stateChanged(int arg1);
void on_checkBox1_17_clicked();
void on_checkBox1_1_clicked();
void on_pushButton2_1_clicked();
void on_pushButton2_2_clicked();
void on_checkBox2_15_clicked();
void on_checkBox2_16_clicked();
void on_checkBox2_17_clicked();
void on_checkBox2_18_clicked();
void on_checkBox2_19_clicked();
void on_checkBox2_20_clicked();
void on_checkBox1_19_stateChanged(int arg1);
private:
Ui::Widget *ui;
QThread * Tthread;
QThread * Rthread;
proceesframe * pframe;
sentframe * sframe;
StateMachine * pSM;
int BST_BSD_time_ms;
int Vin_code_num; // Vin字节数目
QByteArray Vin_Code_Array; // Vin码储存数组
typedef void (Widget:: *func)(QByteArray); // CAN解析函数指针, Qmap插入成员函数指针
QMap<EventID,func> ParseTable; // Map 函数指针映射表
QMap<QString, uchar> Battery_Type; // 电池类型
QMap<QString, uchar> BMS_Version_Set; // BMS协议版本
QMap<QString, uchar> BCL_Mode_Flag; // BCL 充电标识
QMap<QString, uchar> USBCAN_ChFlag; // usb_Can 通道标识
QString fileName; // 保存文件名
VCI_INIT_CONFIG config; // vci_init_config 配置信息
};
#endif // WIDGET_H