// CPageCassetteCtrlCmd.cpp: 实现文件 // #include "stdafx.h" #include "Servo.h" #include "CPageCassetteCtrlCmd.h" #include "afxdialogex.h" // CPageCassetteCtrlCmd 对话框 IMPLEMENT_DYNAMIC(CPageCassetteCtrlCmd, CHMPropertyPage) CPageCassetteCtrlCmd::CPageCassetteCtrlCmd(CWnd* pParent /*=nullptr*/) : CHMPropertyPage(IDD_PAGE_CASSETTE_CTRL_CMD, pParent) { m_pEquipment = nullptr; } CPageCassetteCtrlCmd::~CPageCassetteCtrlCmd() { } void CPageCassetteCtrlCmd::DoDataExchange(CDataExchange* pDX) { CHMPropertyPage::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CPageCassetteCtrlCmd, CHMPropertyPage) ON_WM_CTLCOLOR() ON_WM_DESTROY() ON_WM_SIZE() ON_BN_CLICKED(IDC_BUTTON_SEND_CMD, &CPageCassetteCtrlCmd::OnBnClickedButtonSendCmd) END_MESSAGE_MAP() // CPageCassetteCtrlCmd 消息处理程序 void CPageCassetteCtrlCmd::OnApply() { __super::OnApply(); } void CPageCassetteCtrlCmd::setEquipment(SERVO::CEquipment* pEquipment) { m_pEquipment = pEquipment; } BOOL CPageCassetteCtrlCmd::OnInitDialog() { CHMPropertyPage::OnInitDialog(); const char* pszText[] = {"Cassette Map Download", "Clamp", "Unclamp", "Reclamp", "Cassette Process Start", "Cassette Process Start By Count", "Cassette Process Pause", "Cassette Process Resume", "Cassette Process Abort", "Cassette Process Cancel", "Cassette Process End"}; CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_CASSETTE_CTRL_CMD); for (int i = 0; i < 11; i++) { pComboBox->InsertString(i, pszText[i]); } pComboBox->SetCurSel(0); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE } HBRUSH CPageCassetteCtrlCmd::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CHMPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: 在此更改 DC 的任何特性 // TODO: 如果默认的不是所需画笔,则返回另一个画笔 return hbr; } void CPageCassetteCtrlCmd::OnDestroy() { CHMPropertyPage::OnDestroy(); } void CPageCassetteCtrlCmd::OnSize(UINT nType, int cx, int cy) { CHMPropertyPage::OnSize(nType, cx, cy); } void CPageCassetteCtrlCmd::OnBnClickedButtonSendCmd() { ASSERT(m_pEquipment != nullptr); ASSERT(m_pEquipment->getID() == EQ_ID_LOADPORT1 || m_pEquipment->getID() == EQ_ID_LOADPORT2 || m_pEquipment->getID() == EQ_ID_LOADPORT3 || m_pEquipment->getID() == EQ_ID_LOADPORT4); SERVO::CLoadPort* pLoadPort = (SERVO::CLoadPort*)m_pEquipment; short cmd = 0; short jobExistence[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int jobExistenceSize = 12; short slotProcess = 0; short jobCount = 0; SERVO::CJobDataA* pJobDataA = new SERVO::CJobDataA(); CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_CASSETTE_CTRL_CMD); cmd = pComboBox->GetCurSel() + 1; for (int i = 0; i < 12; i++) { jobExistence[i] = (short)GetDlgItemInt(IDC_EDIT_EXISTENCE1 + i); } slotProcess = (short)GetDlgItemInt(IDC_EDIT_SLOT_TO_PROCESS); jobCount = (short)GetDlgItemInt(IDC_EDIT_JOB_COUNT); pLoadPort->sendCassetteCtrlCmd(cmd, &jobExistence[0], jobExistenceSize, slotProcess, jobCount, pJobDataA, [&](int code) -> int { if (code == WOK) { LOGI("sendCassetteCtrlCmd 成功."); } else { LOGI("sendCassetteCtrlCmd 失败."); } return 0; }); }