-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCleanView.cpp
276 lines (217 loc) · 6.88 KB
/
CleanView.cpp
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
// CleanView.cpp : 实现文件
//
#include "stdafx.h"
#include "BCGPChartExample.h"
#include "CleanView.h"
//#include "afxdialogex.h"
//#include "Includes_app.h"
// CCleanView 对话框
IMPLEMENT_DYNAMIC(CCleanView, CDialogEx)
CCleanView::CCleanView(CWnd* pParent /*=NULL*/)
: CDialogEx(CCleanView::IDD, pParent)
{
/*GetDlgItem(IDC_CLEAN_RINSEBASO)->EnableWindow(FALSE);
GetDlgItem(IDC_CLEAN_EXTERNNEEDLE)->EnableWindow(FALSE);*/
}
CCleanView::~CCleanView()
{
}
void CCleanView::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CCleanView, CDialogEx)
ON_WM_PAINT()
ON_WM_TIMER()
ON_WM_CTLCOLOR()
ON_BN_CLICKED(IDC_CLEAN_CYTO, &CCleanView::OnCleanCyto)
ON_BN_CLICKED(IDC_CLEAN_CHAMBERS, &CCleanView::OnCleanChambers)
ON_BN_CLICKED(IDC_CLEAN_DILUENTINTINE, &CCleanView::OnCleanDiluentintine)
ON_BN_CLICKED(IDC_CLEAN_DILUENTEXTINE, &CCleanView::OnCleanDiluentextine)
ON_BN_CLICKED(IDC_CLEAN_GEM, &CCleanView::OnCleanGem)
ON_BN_CLICKED(IDC_CLEAN_SHEATFLOWPIPE, &CCleanView::OnCleanSheatflowpipe)
ON_BN_CLICKED(IDC_CLEAN_RINSEBASO, &CCleanView::OnCleanRinsebaso)
ON_BN_CLICKED(IDC_CLEAN_RINSEINTINE, &CCleanView::OnCleanRinseintine)
ON_BN_CLICKED(IDC_CLEAN_RINSEEXTINE, &CCleanView::OnCleanRinseextine)
ON_BN_CLICKED(IDC_CLEAN_EXTERNNEEDLE, &CCleanView::OnCleanExternneedle)
ON_MESSAGE(WM_ACKSPI, &CCleanView::OnAckspi)
END_MESSAGE_MAP()
// CCleanView 消息处理程序
unsigned char CCleanView::ExterCleanFlag = 0;
unsigned char CCleanView::ExterCleanStep = 0;
BOOL CCleanView::OnInitDialog()
{
CDialogEx::OnInitDialog();
// TODO: 在此添加额外的初始化
GetDlgItem(IDC_CLEAN_RINSEBASO)->EnableWindow(FALSE);
GetDlgItem(IDC_CLEAN_EXTERNNEEDLE)->EnableWindow(FALSE);
if (DSP_status == Free){
SetWindowEnabled();
}
else if (DSP_status == Busy){
SetWindowDisabled();
}
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
void CCleanView::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: 在此处添加消息处理程序代码
// 不为绘图消息调用 CDialogEx::OnPaint()
CRect rect;
GetClientRect(rect);
dc.FillSolidRect(rect, RGB(255, 255, 255)); //设置为白色背景
}
void CCleanView::OnTimer(UINT_PTR nIDEvent)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
switch (nIDEvent)
{
case POLLTIME:
TRACE("MSG_TIMER:POLLTIME is due -------------#\n");
sdata_cmd[0] = SPI_CMD_REQDSP_STATUS;
PC_SEND_FRAME(sdata_cmd, SPI_TYPE_CMD);
PC_RECEIVE_FRAME(rdata_state, SPI_TYPE_STATE);
SendMessage(WM_ACKSPI, rdata_state[0], 0);
return;
default:
return;
}
CDialogEx::OnTimer(nIDEvent);
}
HBRUSH CCleanView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: 在此更改 DC 的任何特性
// TODO: 如果默认的不是所需画笔,则返回另一个画笔
return hbr;
}
void CCleanView::CleanChannel(char* Mess, uchar CMD)
{
TRACE(Mess);
sdata_cmd[0] = CMD;
if (PC_SEND_FRAME(sdata_cmd, SPI_TYPE_CMD) == 0)
{
DSP_status = Busy;
SetWindowDisabled();
key_status = FALSE;
((CMainFrame*)AfxGetMainWnd())->StartProgress(30);
SetTimer(POLLTIME, 3000, 0);
}
}
void CCleanView::OnCleanCyto()//鞘流池
{
// TODO: 在此添加控件通知处理程序代码
CleanChannel("Clean SHEATHFLOWPOOL---------#\n", SPI_CMD_CLEAN_SHEATHFLOWPOOL);
}
void CCleanView::OnCleanChambers()//鞘流排堵
{
// TODO: 在此添加控件通知处理程序代码
CleanChannel("BACKFLUSH_LMNE---------#\n", SPI_CMD_BACKFLUSH_LMNE);
}
void CCleanView::OnCleanDiluentintine()//针内壁(稀释液)
{
// TODO: 在此添加控件通知处理程序代码
CleanChannel("Clean DILUENTINTINE---------#\n", SPI_CMD_CLEAN_DILUENTINTINE);
}
void CCleanView::OnCleanDiluentextine()//针外壁(稀释液)
{
// TODO: 在此添加控件通知处理程序代码
CleanChannel("Clean DILUENTEXTINE---------#\n", SPI_CMD_CLEAN_DILUENTEXTINE);
}
void CCleanView::OnCleanGem()//清洗内鞘
{
// TODO: 在此添加控件通知处理程序代码
CleanChannel("Clean GEM---------#\n", SPI_CMD_CLEAN_GEM);
}
void CCleanView::OnCleanSheatflowpipe()//鞘流管
{
// TODO: 在此添加控件通知处理程序代码
CleanChannel("Clean SHEATFLOWPIPE---------#\n", SPI_CMD_CLEAN_SHEATFLOWPIPE);
}
void CCleanView::OnCleanRinsebaso()//BASO池(清洗剂)
{
// TODO: 在此添加控件通知处理程序代码
CleanChannel("Clean RINSEBASO---------#\n", SPI_CMD_CLEAN_RINSEBASO);
}
void CCleanView::OnCleanRinseintine()//针内壁(清洗剂)
{
// TODO: 在此添加控件通知处理程序代码
CleanChannel("Clean RINSEINTINE---------#\n", SPI_CMD_CLEAN_RINSEINTINE);
}
void CCleanView::OnCleanRinseextine()//针外壁(清洗剂)
{
// TODO: 在此添加控件通知处理程序代码
CleanChannel("Clean DILUENTEXTINE---------#\n", SPI_CMD_CLEAN_DILUENTEXTINE);
}
void CCleanView::OnCleanExternneedle()//外部针
{
// TODO: 在此添加控件通知处理程序代码
ExterCleanFlag = 1;
CleanChannel("Clean EXTERNNEEDLE Step1---------#\n", SPI_CMD_CLEAN_DILUENTINTINE);
}
afx_msg LRESULT CCleanView::OnAckspi(WPARAM wParam, LPARAM lParam)
{
switch (wParam)
{
//清洗完成
case SPI_STATE_INFO_END:
//75ha:20150625
if (1 == ExterCleanFlag && ExterCleanStep < 4)//若是外部针清洗
{
uchar SendCmd[] = {
0,
SPI_CMD_CLEAN_RINSEINTINE,
SPI_CMD_CLEAN_DILUENTEXTINE,
SPI_CMD_CLEAN_RINSEEXTINE
};
++ExterCleanStep;
TRACE("Clean EXTERNNEEDLE Step %d---------#\n", ExterCleanStep + 1);
sdata_cmd[0] = SendCmd[ExterCleanStep];
PC_SEND_FRAME(sdata_cmd, SPI_TYPE_CMD);
}
else
{
if (4 == ExterCleanStep)
ExterCleanStep = ExterCleanFlag = 0;
KillTimer(POLLTIME);
DSP_status = Free;
key_status = TRUE;
SetWindowEnabled();
}
break;
default:
break;
}
//SetWindowEnabled();
return 0;
}
void CCleanView::SetWindowEnabled(){
GetDlgItem(IDC_CLEAN_CYTO)->EnableWindow(TRUE);
GetDlgItem(IDC_CLEAN_CHAMBERS)->EnableWindow(TRUE);
GetDlgItem(IDC_CLEAN_DILUENTINTINE)->EnableWindow(TRUE);
GetDlgItem(IDC_CLEAN_DILUENTEXTINE)->EnableWindow(TRUE);
GetDlgItem(IDC_CLEAN_GEM)->EnableWindow(TRUE);
GetDlgItem(IDC_CLEAN_SHEATFLOWPIPE)->EnableWindow(TRUE);
//GetDlgItem(IDC_CLEAN_RINSEBASO)->EnableWindow(TRUE);
GetDlgItem(IDC_CLEAN_RINSEINTINE)->EnableWindow(TRUE);
GetDlgItem(IDC_CLEAN_RINSEEXTINE)->EnableWindow(TRUE);
//GetDlgItem(IDC_CLEAN_EXTERNNEEDLE)->EnableWindow(TRUE);
GetDlgItem(IDOK)->EnableWindow(TRUE);
GetDlgItem(IDCANCEL)->EnableWindow(TRUE);
}
void CCleanView::SetWindowDisabled(){
GetDlgItem(IDC_CLEAN_CYTO)->EnableWindow(FALSE);
GetDlgItem(IDC_CLEAN_CHAMBERS)->EnableWindow(FALSE);
GetDlgItem(IDC_CLEAN_DILUENTINTINE)->EnableWindow(FALSE);
GetDlgItem(IDC_CLEAN_DILUENTEXTINE)->EnableWindow(FALSE);
GetDlgItem(IDC_CLEAN_GEM)->EnableWindow(FALSE);
GetDlgItem(IDC_CLEAN_SHEATFLOWPIPE)->EnableWindow(FALSE);
//GetDlgItem(IDC_CLEAN_RINSEBASO)->EnableWindow(FALSE);
GetDlgItem(IDC_CLEAN_RINSEINTINE)->EnableWindow(FALSE);
GetDlgItem(IDC_CLEAN_RINSEEXTINE)->EnableWindow(FALSE);
//GetDlgItem(IDC_CLEAN_EXTERNNEEDLE)->EnableWindow(FALSE);
GetDlgItem(IDOK)->EnableWindow(FALSE);
GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
}