提交 | 用户 | age
|
418cb3
|
1 |
|
Q |
2 |
#pragma once
|
|
3 |
|
|
4 |
#include "../MyLib/StaticEx.h"
|
|
5 |
// CMTerm1CommDevView 窗体视图
|
|
6 |
class CMTerm1CommDevView : public CFormView
|
|
7 |
{
|
|
8 |
DECLARE_DYNCREATE(CMTerm1CommDevView)
|
|
9 |
// 构造
|
|
10 |
public:
|
|
11 |
protected:
|
|
12 |
CMTerm1CommDevView(); // 动态创建所使用的受保护的构造函数
|
|
13 |
virtual ~CMTerm1CommDevView();
|
|
14 |
|
|
15 |
#ifdef AFX_DESIGN_TIME
|
|
16 |
enum { IDD = IDD_MTerm1CommDevView2 };
|
|
17 |
#endif
|
61deef
|
18 |
/*
|
418cb3
|
19 |
#ifdef _DEBUG
|
Q |
20 |
virtual void AssertValid() const;
|
|
21 |
CMTerm1Doc* CMTerm1CommDevView::GetDocument() const
|
|
22 |
{
|
|
23 |
return reinterpret_cast<CMTerm1Doc*>(m_pDocument);
|
|
24 |
}
|
|
25 |
|
|
26 |
#ifndef _WIN32_WCE
|
|
27 |
virtual void Dump(CDumpContext& dc) const;
|
|
28 |
#endif
|
|
29 |
#endif
|
61deef
|
30 |
*/
|
418cb3
|
31 |
protected:
|
Q |
32 |
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
|
33 |
DECLARE_MESSAGE_MAP()
|
|
34 |
public:
|
|
35 |
CMFCStatusBar * m_pStatusBar;
|
|
36 |
enum StatusBarIndicators {
|
|
37 |
idxMachineType = 0,
|
|
38 |
idxProgPos = 1,
|
|
39 |
idxOnline = 2,
|
|
40 |
idxRunning = 3,
|
|
41 |
idxMonitor = 4,
|
|
42 |
idxAddress = 5,
|
|
43 |
idxInfoDisp = 6,
|
|
44 |
};
|
|
45 |
COLORREF OnlineColor = RGB(0, 255, 255);
|
|
46 |
COLORREF ProgColor = RGB(0, 255, 0);
|
|
47 |
COLORREF RunningColor = RGB(0, 255, 0);
|
|
48 |
COLORREF MonitorColor = RGB(0, 255, 255);
|
|
49 |
COLORREF AddressColor = RGB(0, 255, 255);
|
|
50 |
|
|
51 |
virtual void OnInitialUpdate();
|
|
52 |
|
|
53 |
// CStatusBar m_wndStatusBar;
|
|
54 |
// CToolBar m_wndToolBar;
|
|
55 |
// CImageList m_ColorTreeImages;
|
|
56 |
// CTreeCtrl m_treectrl1;
|
61deef
|
57 |
|
418cb3
|
58 |
typedef struct tagWLStat
|
Q |
59 |
{
|
61deef
|
60 |
union {
|
Q |
61 |
uint32_t Status; //状态
|
|
62 |
struct {
|
|
63 |
uint32_t bMasterSent : 1;
|
|
64 |
uint32_t bMasterRecved : 1;
|
|
65 |
};
|
|
66 |
};
|
|
67 |
uint16_t curStat; //当前状态
|
|
68 |
uint16_t runStep; //工作步骤
|
|
69 |
uint16_t RunStat; //运行状态
|
|
70 |
uint16_t ErrStat; //错误状态
|
|
71 |
uint32_t RF_Freq; //运行频率
|
|
72 |
uint16_t nTimeOnAir;
|
|
73 |
uint16_t DeviceAddr;
|
|
74 |
|
|
75 |
uint8_t NetWorkAddr;
|
|
76 |
|
|
77 |
uint8_t Tx_Power; // dBm 5 - 22 dBm
|
|
78 |
uint8_t LoraBandWidth; // [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved ]
|
|
79 |
uint8_t LoRaFactor; // [SF5 .. SF 12]
|
|
80 |
uint8_t LoRaCodingRate; // [1 : 4/5, 2: 4/6, 3: 4/7, 4: 4/8 ]
|
|
81 |
|
|
82 |
uint8_t LoRaPreambleLen; // 2 - 12
|
|
83 |
|
|
84 |
uint8_t bEnableAddr;
|
|
85 |
uint8_t bEnableEncrypt;
|
|
86 |
uint8_t bEnableRelay;
|
|
87 |
uint8_t bAutoReSend; //自动重发
|
|
88 |
uint8_t nCurClient;
|
|
89 |
uint8_t nSeq;
|
|
90 |
|
|
91 |
uint32_t sentCount; //发送计数
|
|
92 |
uint32_t recvCount; //接收计数
|
|
93 |
uint32_t lastSendtime; //上次发送时间
|
|
94 |
uint32_t lastSenttime; //上次发送出时间
|
|
95 |
uint32_t lastRecvtime; //上次启动接收时间
|
|
96 |
uint32_t lastRecvdtime; //上次接收时间
|
|
97 |
uint32_t lastActTime; //上次动作时间
|
|
98 |
uint32_t lastAckTime; //上次应答时间
|
|
99 |
uint32_t lastErrTime; //上次错误时间
|
|
100 |
uint32_t latancy; //延迟
|
|
101 |
uint32_t cycleTime; //循环时间
|
|
102 |
uint16_t LostPackets; //丢包计数
|
|
103 |
uint16_t CtnLstPkts; //连续丢包计数
|
|
104 |
uint16_t MaxCtnLstPkts; //最大连续丢包计数
|
|
105 |
uint16_t TXErr; //发送错误计数
|
|
106 |
uint16_t RXErr; //接收错误计数
|
|
107 |
uint16_t CRCErr; //CRC错误计数
|
|
108 |
uint16_t PktErr; //包错误 ;
|
|
109 |
uint16_t ChnErr; //频道错误;
|
|
110 |
uint16_t nErrChn; //错误的频道号;
|
|
111 |
uint16_t CADDoneCount; //CAD 完成次数
|
|
112 |
uint16_t CADOkCount; //CAD 是次数
|
|
113 |
uint16_t CADNgCount; //CAD 否次数
|
|
114 |
uint16_t CADTimeOut; //CAD 超时次数
|
|
115 |
uint16_t StepErr1; //步骤错误1
|
|
116 |
uint16_t StepErr2; //步骤错误2
|
|
117 |
uint16_t Err1Count; //微闪报警次数
|
|
118 |
uint16_t Err2Count; //大闪报警次数
|
|
119 |
uint16_t Err3Count; //严重丢失信号次数
|
|
120 |
int8_t RSSI; //信号强度
|
|
121 |
int8_t SNR; //信噪比
|
|
122 |
int8_t tRSSI; //对方信号强度
|
|
123 |
int8_t tSNR; //对方信噪比
|
|
124 |
uint32_t targetSentCount; //对方发送数量
|
|
125 |
uint32_t targetRecvdCount; //对方接受数量
|
|
126 |
|
|
127 |
}stWLRunStat, * pstWLRunStat;
|
|
128 |
|
|
129 |
|
|
130 |
typedef struct tagWLStatV12
|
|
131 |
{
|
|
132 |
union {
|
|
133 |
uint32_t Status; //状态
|
|
134 |
struct {
|
|
135 |
uint32_t bMasterSent : 1;
|
|
136 |
uint32_t bMasterRecved : 1;
|
|
137 |
};
|
|
138 |
};
|
|
139 |
uint16_t curStat; //当前状态
|
|
140 |
uint16_t runStep; //工作步骤
|
|
141 |
uint16_t RunStat; //运行状态
|
|
142 |
uint16_t ErrStat; //错误状态
|
|
143 |
uint32_t RF_Freq; //运行频率
|
|
144 |
uint32_t nTimeOnAir;
|
418cb3
|
145 |
uint32_t sentCount; //发送计数
|
Q |
146 |
uint32_t recvCount; //接收计数
|
|
147 |
uint32_t lastSendtime; //上次发送时间
|
|
148 |
uint32_t lastSenttime; //上次发送出时间
|
|
149 |
uint32_t lastRecvtime; //上次启动接收时间
|
|
150 |
uint32_t lastRecvdtime; //上次接收时间
|
|
151 |
uint32_t lastActTime; //上次动作时间
|
|
152 |
uint32_t lastAckTime; //上次应答时间
|
6ff05a
|
153 |
uint32_t lastErrTime; //上次错误时间
|
418cb3
|
154 |
uint32_t latancy; //延迟
|
Q |
155 |
uint32_t cycleTime; //循环时间
|
61deef
|
156 |
uint16_t LostPackets; //丢包计数
|
Q |
157 |
uint16_t CtnLstPkts; //连续丢包计数
|
|
158 |
uint16_t MaxCtnLstPkts; //最大连续丢包计数
|
|
159 |
uint16_t TXErr; //发送错误计数
|
|
160 |
uint16_t RXErr; //接收错误计数
|
|
161 |
uint16_t CRCErr; //CRC错误计数
|
|
162 |
uint16_t ChnErr; //频道错误
|
|
163 |
uint16_t PktErr; //包错误
|
|
164 |
uint16_t CADDoneCount; //CAD 完成次数
|
|
165 |
uint16_t StepErr1; //步骤错误1
|
|
166 |
uint16_t StepErr2; //步骤错误2
|
|
167 |
uint16_t Err1Count; //微闪报警次数
|
|
168 |
uint16_t Err2Count; //大闪报警次数
|
|
169 |
uint16_t Err3Count; //严重丢失信号次数
|
418cb3
|
170 |
int8_t RSSI; //信号强度
|
Q |
171 |
int8_t SNR; //信噪比
|
|
172 |
int8_t tRSSI; //对方信号强度
|
|
173 |
int8_t tSNR; //对方信噪比
|
6ff05a
|
174 |
uint32_t targetSentCount; //对方发送数量
|
Q |
175 |
uint32_t targetRecvdCount; //对方接受数量
|
|
176 |
|
61deef
|
177 |
}stWLRunStatV12, *pstWLRunStatV12;
|
Q |
178 |
|
|
179 |
typedef struct tagWLStatV1
|
|
180 |
{
|
|
181 |
union {
|
|
182 |
uint32_t Status; //状态
|
|
183 |
struct {
|
|
184 |
uint32_t bMasterSent : 1;
|
|
185 |
uint32_t bMasterRecved : 1;
|
|
186 |
};
|
|
187 |
};
|
|
188 |
uint16_t curStat; //当前状态
|
|
189 |
uint16_t runStep; //工作步骤
|
|
190 |
uint16_t RunStat; //运行状态
|
|
191 |
uint16_t ErrStat; //错误状态
|
|
192 |
// uint32_t RF_Freq; //运行频率
|
|
193 |
// uint32_t nTimeOnAir;
|
|
194 |
uint32_t sentCount; //发送计数
|
|
195 |
uint32_t recvCount; //接收计数
|
|
196 |
uint32_t lastSendtime; //上次发送时间
|
|
197 |
uint32_t lastSenttime; //上次发送出时间
|
|
198 |
uint32_t lastRecvtime; //上次启动接收时间
|
|
199 |
uint32_t lastRecvdtime; //上次接收时间
|
|
200 |
uint32_t lastActTime; //上次动作时间
|
|
201 |
uint32_t lastAckTime; //上次应答时间
|
|
202 |
uint32_t lastErrTime; //上次错误时间
|
|
203 |
uint32_t latancy; //延迟
|
|
204 |
uint32_t cycleTime; //循环时间
|
|
205 |
uint16_t LostPackets; //丢包计数
|
|
206 |
uint16_t CtnLstPkts; //连续丢包计数
|
|
207 |
uint16_t MaxCtnLstPkts; //最大连续丢包计数
|
|
208 |
uint16_t TXErr; //发送错误计数
|
|
209 |
uint16_t RXErr; //接收错误计数
|
|
210 |
uint16_t CRCErr; //CRC错误计数
|
|
211 |
// uint16_t ChnErr; //频道错误
|
|
212 |
// uint16_t PktErr; //包错误
|
|
213 |
uint16_t CADDoneCount; //CAD 完成次数
|
|
214 |
uint16_t StepErr1; //步骤错误1
|
|
215 |
uint16_t StepErr2; //步骤错误2
|
|
216 |
uint16_t Err1Count; //微闪报警次数
|
|
217 |
uint16_t Err2Count; //大闪报警次数
|
|
218 |
uint16_t Err3Count; //严重丢失信号次数
|
|
219 |
int8_t RSSI; //信号强度
|
|
220 |
int8_t SNR; //信噪比
|
|
221 |
int8_t tRSSI; //对方信号强度
|
|
222 |
int8_t tSNR; //对方信噪比
|
|
223 |
uint32_t targetSentCount; //对方发送数量
|
|
224 |
uint32_t targetRecvdCount; //对方接受数量
|
|
225 |
|
|
226 |
}stWLRunStatV1, * pstWLRunStatV1;
|
|
227 |
|
|
228 |
CString KWRunStatToString(pstWLRunStat pWLRunStat1);
|
|
229 |
CString KWRunStatToString(pstWLRunStatV1 pWLRunStat1);
|
|
230 |
CString KWRunStatToString(pstWLRunStatV12 pWLRunStat1);
|
418cb3
|
231 |
|
Q |
232 |
afx_msg void OnClose();
|
|
233 |
afx_msg void OnSize(UINT nType, int cx, int cy);
|
|
234 |
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
|
235 |
afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData);
|
|
236 |
void FindComPort();
|
|
237 |
|
|
238 |
int BInited;
|
|
239 |
int m_bResourceOpened;
|
|
240 |
int m_bPause;
|
|
241 |
|
|
242 |
CString sComSelStr;
|
|
243 |
CString sBaudSelStr;
|
|
244 |
DWORD dComNum;
|
|
245 |
volatile int MyThreadProc1ToRun = 0;
|
|
246 |
volatile int MyThreadProc1Running = 0;
|
|
247 |
|
|
248 |
|
|
249 |
CRect MainClientRect;
|
|
250 |
CRect LeftRect;
|
|
251 |
CRect RightRect;
|
|
252 |
|
|
253 |
CRect ItemRect;
|
|
254 |
CRect OrgButtonRect;
|
|
255 |
CRect ButtonRect;
|
|
256 |
CRect PicRect;
|
|
257 |
CRect PicRectUp;
|
|
258 |
CRect PicRectDown;
|
|
259 |
|
|
260 |
CRect LogRect;
|
|
261 |
|
|
262 |
int calLayerOuts();
|
|
263 |
int DisplayParams();
|
|
264 |
int GetParams();
|
|
265 |
int DelayInit();
|
|
266 |
|
|
267 |
int LoadResourceList();
|
|
268 |
int SaveResourceList();
|
|
269 |
|
|
270 |
|
|
271 |
int LoadModel();
|
|
272 |
int SaveModel();
|
|
273 |
|
|
274 |
int OpenResource(CStringA ResourceStr);
|
|
275 |
int CloseResource();
|
|
276 |
|
|
277 |
int SaveData(CString sFilePathName);
|
|
278 |
int LoadData(CString sFilePathName);
|
|
279 |
|
|
280 |
int MonitorPLC();
|
|
281 |
|
|
282 |
int UpdateDataDisplay();
|
|
283 |
|
|
284 |
public:
|
|
285 |
static UINT MyJumper1(LPVOID pParam);
|
|
286 |
DWORD WINAPI MyThreadProc1(LPVOID pParam);
|
|
287 |
|
|
288 |
bool m_bOnline = false;
|
|
289 |
bool m_bRunning = false;
|
|
290 |
bool m_bMonitoring = false;
|
|
291 |
|
|
292 |
|
|
293 |
// Combo Com port select
|
|
294 |
CComboBox m_combo_comport;
|
|
295 |
// Combo Com Baud select
|
|
296 |
CComboBox m_combo_com_baud;
|
|
297 |
afx_msg void OnBnClickedButtonStart();
|
|
298 |
afx_msg void OnBnClickedButtonStop();
|
|
299 |
afx_msg void OnBnClickedButtonClrscr();
|
|
300 |
afx_msg void OnBnClickedButtonSend();
|
|
301 |
CEdit m_edit_display;
|
|
302 |
// Combo Input
|
|
303 |
CComboBox m_combo_input;
|
|
304 |
|
|
305 |
afx_msg void OnCbnEditchangeComboInput();
|
|
306 |
afx_msg void OnCbnSelchangeComboRes();
|
|
307 |
afx_msg void OnBnClickedButtonDo();
|
|
308 |
afx_msg void OnCbnSelchangeComboCmdType();
|
|
309 |
afx_msg void OnCbnSelchangeComboDcount();
|
|
310 |
afx_msg void OnBnClickedButtonStartBulkTest();
|
|
311 |
afx_msg void OnBnClickedButtonStopBulkTest();
|
|
312 |
afx_msg void OnMenuDownload();
|
|
313 |
afx_msg void OnMenuUpload();
|
|
314 |
afx_msg void OnMenuOnline();
|
|
315 |
afx_msg void OnMenuOffline();
|
|
316 |
afx_msg void OnMenuMonitor();
|
|
317 |
afx_msg void OnMenuRun();
|
|
318 |
afx_msg void OnUpdateMenuRun(CCmdUI *pCmdUI);
|
|
319 |
afx_msg void OnUpdateMenuMonitor(CCmdUI *pCmdUI);
|
|
320 |
afx_msg void OnUpdateMenuOffline(CCmdUI *pCmdUI);
|
|
321 |
afx_msg void OnUpdateMenuOnline(CCmdUI *pCmdUI);
|
|
322 |
CEdit m_edit_mon1;
|
|
323 |
CEdit m_edit_mon2;
|
|
324 |
afx_msg void OnMenuCommset();
|
|
325 |
afx_msg void OnMenuSysregSet();
|
|
326 |
afx_msg void OnMenuStatusShow();
|
|
327 |
afx_msg void OnMenuInfoDisplay();
|
|
328 |
afx_msg void OnMenuCoilMon();
|
|
329 |
afx_msg void OnMenuDataMon();
|
|
330 |
afx_msg void OnMenuCommTool();
|
|
331 |
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
|
|
332 |
afx_msg void OnBnClickedButtonClearStat();
|
|
333 |
int Clear_COM_Stats();
|
|
334 |
afx_msg void OnBnClickedButtonRead();
|
|
335 |
afx_msg void OnBnClickedButtonConnect();
|
|
336 |
afx_msg void OnMenuEventLog();
|
|
337 |
afx_msg void OnMenuCommTest();
|
|
338 |
afx_msg void OnMenuForceIo();
|
|
339 |
afx_msg void OnMenuDatetime();
|
|
340 |
CStaticEx m_static_connect;
|
|
341 |
afx_msg void OnBnClickedButtonDisconnect();
|
|
342 |
afx_msg void OnBnClickedButton11();
|
|
343 |
afx_msg void OnBnClickedButton12();
|
|
344 |
afx_msg void OnBnClickedButton13();
|
|
345 |
|
|
346 |
afx_msg void OnBnClickedButton31();
|
|
347 |
afx_msg void OnBnClickedButton2();
|
|
348 |
afx_msg void OnBnClickedButton3();
|
|
349 |
int UpdateLEDDisplay();
|
|
350 |
int UpdateStatusBar(int nIndex);
|
61deef
|
351 |
afx_msg void OnBnClickedButton5();
|
Q |
352 |
afx_msg void OnBnClickedButton9();
|
|
353 |
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
|
418cb3
|
354 |
};
|