chenluhua1980
2026-01-09 260b16a1debe7dbc33982768a37dfd48ca34b248
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
// CEquipmentPage3.cpp: 实现文件
//
 
#include "stdafx.h"
#include "Servo.h"
#include "CEquipmentPage3.h"
#include "afxdialogex.h"
 
 
// CEquipmentPage3 对话框
 
IMPLEMENT_DYNAMIC(CEquipmentPage3, CHMPropertyPage)
 
CEquipmentPage3::CEquipmentPage3(CWnd* pParent /*=nullptr*/)
    : CHMPropertyPage(IDD_PAGE_EQUIPMENT3, pParent)
{
    m_pEquipment = nullptr;
}
 
CEquipmentPage3::~CEquipmentPage3()
{
}
 
void CEquipmentPage3::DoDataExchange(CDataExchange* pDX)
{
    CHMPropertyPage::DoDataExchange(pDX);
}
 
 
BEGIN_MESSAGE_MAP(CEquipmentPage3, CHMPropertyPage)
    ON_WM_CTLCOLOR()
    ON_WM_DESTROY()
    ON_WM_SIZE()
    ON_BN_CLICKED(IDC_RADIO_DISPATCHING_EAP, &CEquipmentPage3::OnBnClickedRadioEap)
    ON_BN_CLICKED(IDC_RADIO_DISPATCHING_LOCAL, &CEquipmentPage3::OnBnClickedRadioLocal)
END_MESSAGE_MAP()
 
 
// CEquipmentPage3 消息处理程序
void CEquipmentPage3::OnApply()
{
    __super::OnApply();
}
 
void CEquipmentPage3::setEquipment(SERVO::CEquipment* pEquipment)
{
    m_pEquipment = pEquipment;
}
 
BOOL CEquipmentPage3::OnInitDialog()
{
    CHMPropertyPage::OnInitDialog();
 
    // TODO:  在此添加额外的初始化
 
    return TRUE;  // return TRUE unless you set the focus to a control
                  // 异常: OCX 属性页应返回 FALSE
}
 
HBRUSH CEquipmentPage3::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
    HBRUSH hbr = CHMPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
 
    // TODO:  在此更改 DC 的任何特性
 
    // TODO:  如果默认的不是所需画笔,则返回另一个画笔
    return hbr;
}
 
void CEquipmentPage3::OnDestroy()
{
    CHMPropertyPage::OnDestroy();
 
    // TODO: 在此处添加消息处理程序代码
}
 
void CEquipmentPage3::OnSize(UINT nType, int cx, int cy)
{
    CHMPropertyPage::OnSize(nType, cx, cy);
 
    // TODO: 在此处添加消息处理程序代码
}
 
void CEquipmentPage3::OnBnClickedRadioEap()
{
    ASSERT(m_pEquipment);
    m_pEquipment->setDispatchingMode(SERVO::DISPATCHING_MODE::EAS,
        [&](int code) -> int {
            if (code == WOK) {
                LOGI("<CEquipment-%s>设置DispatchingMode成功.", m_pEquipment->getName().c_str());
                AfxMessageBox("设置EAS模式成功!");
            }
            else {
                LOGE("<CEquipment-%s>设置DispatchingMode失败,code:%d", m_pEquipment->getName().c_str(), code);
                AfxMessageBox("设置EAS模式失败!");
            }
 
            return 0;
        });
}
 
 
void CEquipmentPage3::OnBnClickedRadioLocal()
{
    ASSERT(m_pEquipment);
    m_pEquipment->setDispatchingMode(SERVO::DISPATCHING_MODE::Local,
        [&](int code) -> int {
            if (code == WOK) {
                LOGI("<CEquipment-%s>设置DispatchingMode成功.", m_pEquipment->getName().c_str());
                AfxMessageBox("设置Local模式成功!");
            }
            else {
                LOGI("<CEquipment-%s>设置DispatchingMode失败,code:%d", m_pEquipment->getName().c_str(), code);
                AfxMessageBox("设置Local模式失败!");
            }
 
            return 0;
        });
}