提交 | 用户 | age
|
418cb3
|
1 |
// PropCommCfg.cpp: 实现文件
|
Q |
2 |
//
|
|
3 |
|
|
4 |
#include "pch.h"
|
|
5 |
#include "MTerm1.h"
|
|
6 |
#include "PropCommCfg.h"
|
|
7 |
#include "afxdialogex.h"
|
|
8 |
|
|
9 |
|
|
10 |
// CPropCommCfg 对话框
|
|
11 |
|
|
12 |
IMPLEMENT_DYNAMIC(CPropCommCfg, CMyPropPage)
|
|
13 |
|
|
14 |
CPropCommCfg::CPropCommCfg(CWnd* pParent /*=nullptr*/)
|
|
15 |
: CMyPropPage(IDD_PROP_COMM_CFG, pParent)
|
|
16 |
{
|
|
17 |
|
|
18 |
}
|
|
19 |
|
|
20 |
CPropCommCfg::~CPropCommCfg()
|
|
21 |
{
|
|
22 |
}
|
|
23 |
|
|
24 |
void CPropCommCfg::DoDataExchange(CDataExchange* pDX)
|
|
25 |
{
|
|
26 |
CDialogEx::DoDataExchange(pDX);
|
|
27 |
}
|
|
28 |
|
|
29 |
|
|
30 |
BEGIN_MESSAGE_MAP(CPropCommCfg, CMyPropPage)
|
|
31 |
END_MESSAGE_MAP()
|
|
32 |
|
|
33 |
|
|
34 |
// CPropCommCfg 消息处理程序
|
|
35 |
|
|
36 |
|
|
37 |
int CPropCommCfg::ShowParams()
|
|
38 |
{
|
|
39 |
// TODO: 在此处添加实现代码.
|
|
40 |
CString s1;
|
|
41 |
s1.Format(_T("ComCfg ShowParams DataPtr %p "),DataPtr);
|
|
42 |
SysLog(s1);
|
|
43 |
s1.Format(_T("mode %d"), ComPortParam.WorkMode); SysLog(s1);
|
|
44 |
s1.Format(_T("station %d"), ComPortParam.Station); SysLog(s1);
|
|
45 |
s1.Format(_T("baudrate %d"), ComPortParam.BaudRate); SysLog(s1);
|
|
46 |
s1.Format(_T("bytesize %d"), ComPortParam.ByteSize); SysLog(s1);
|
|
47 |
s1.Format(_T("stopbits %d"), ComPortParam.StopBits); SysLog(s1);
|
|
48 |
s1.Format(_T("parity %d"), ComPortParam.Parity); SysLog(s1);
|
|
49 |
s1.Format(_T("eofchar %d"), ComPortParam.EofChar); SysLog(s1);
|
|
50 |
s1.Format(_T("sofchar %d"), ComPortParam.SofChar); SysLog(s1);
|
|
51 |
s1.Format(_T("endtype %d"), ComPortParam.EndType); SysLog(s1);
|
|
52 |
s1.Format(_T("recvaddr %d"), ComPortParam.RecvAddr); SysLog(s1);
|
|
53 |
s1.Format(_T("recvsize %d"), ComPortParam.RecvSize); SysLog(s1);
|
|
54 |
s1.Format(_T("endtime %d"), ComPortParam.EndTime); SysLog(s1);
|
|
55 |
|
|
56 |
|
|
57 |
((CComboBox *)GetDlgItem(IDC_COMBO_WORKMODE))->SetCurSel(ComPortParam.WorkMode);
|
|
58 |
((CComboBox *)GetDlgItem(IDC_COMBO_STATION))->SetCurSel(ComPortParam.Station);
|
|
59 |
s1.Format(_T("%d"), ComPortParam.BaudRate*100);
|
|
60 |
((CComboBox *)GetDlgItem(IDC_COMBO_BAUDRATE))->SelectString(0,s1);
|
|
61 |
((CComboBox *)GetDlgItem(IDC_COMBO_BAUDRATE))->SetWindowText(s1);
|
|
62 |
|
|
63 |
((CComboBox *)GetDlgItem(IDC_COMBO_BYTE_SIZE))->SetCurSel(ComPortParam.ByteSize);
|
|
64 |
((CComboBox *)GetDlgItem(IDC_COMBO_STOP_BIT))->SetCurSel(ComPortParam.StopBits);
|
|
65 |
((CComboBox *)GetDlgItem(IDC_COMBO_PARITY))->SetCurSel(ComPortParam.Parity);
|
|
66 |
((CComboBox *)GetDlgItem(IDC_COMBO_EOF_CHAR))->SetCurSel(ComPortParam.EofChar);
|
|
67 |
((CComboBox *)GetDlgItem(IDC_COMBO_SOF_CHAR))->SetCurSel(ComPortParam.SofChar);
|
|
68 |
((CComboBox *)GetDlgItem(IDC_COMBO_END_TYPE))->SetCurSel(ComPortParam.EndType);
|
|
69 |
s1.Format(_T("%d"), ComPortParam.RecvAddr);
|
|
70 |
((CEdit *)GetDlgItem(IDC_EDIT_BUF_ADDR))->SetWindowText(s1);
|
|
71 |
s1.Format(_T("%d"), ComPortParam.RecvSize);
|
|
72 |
((CEdit *)GetDlgItem(IDC_EDIT_BUF_SIZE))->SetWindowText(s1);;
|
|
73 |
s1.Format(_T("%d"), ComPortParam.EndTime);
|
|
74 |
((CEdit *)GetDlgItem(IDC_EDIT_END_TIME))->SetWindowText(s1);;
|
|
75 |
|
|
76 |
return 0;
|
|
77 |
}
|
|
78 |
|
|
79 |
|
|
80 |
int CPropCommCfg::GetParams()
|
|
81 |
{
|
|
82 |
// TODO: 在此处添加实现代码.
|
|
83 |
return 0;
|
|
84 |
}
|
|
85 |
|
|
86 |
|
|
87 |
int CPropCommCfg::GetData()
|
|
88 |
{
|
|
89 |
// TODO: 在此处添加实现代码.
|
|
90 |
if (DataPtr != nullptr)
|
|
91 |
{
|
|
92 |
memcpy(&ComPortParam, DataPtr, sizeof(ComPortParam));
|
|
93 |
|
|
94 |
ShowParams();
|
|
95 |
}
|
|
96 |
return 0;
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
int CPropCommCfg::SetData()
|
|
101 |
{
|
|
102 |
// TODO: 在此处添加实现代码.
|
|
103 |
GetParams();
|
|
104 |
|
|
105 |
return 0;
|
|
106 |
}
|