Merge branch 'EAPSimulator' into clh
# Conflicts:
# .gitignore
# SourceCode/Bond/Servo/CMaster.cpp
# SourceCode/Bond/Servo/CMaster.h
# SourceCode/Bond/Servo/Servo.rc
# SourceCode/Bond/Servo/Servo.vcxproj
# SourceCode/Bond/Servo/Servo.vcxproj.filters
# SourceCode/Bond/Servo/ServoDlg.cpp
# SourceCode/Bond/Servo/resource.h
| | |
| | | SourceCode/Bond/x64/Debug/Config/robot_offset.ini |
| | | *.tlog |
| | | *.pch |
| | | SourceCode/Bond/EAPSimulator/x64/Debug/ |
| | | SourceCode/Bond/EAPSimulator/x64/ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | | ä¿¡å·åç§° | EASè§è²ï¼è¯»/åï¼ | 说æ | |
| | | | ------------------------------- | ---------- | ----------------- | |
| | | | Downstream Inline | 读 | 䏿¸¸Inlineç¶æï¼è®¾å¤åç¥ä¸»æº | |
| | | | Downstream Trouble | 读 | 䏿¸¸å¼å¸¸éç¥ï¼è®¾å¤åç»ä¸»æº | |
| | | | Interlock | 读 | äºéç¶æï¼è®¾å¤åé¦ | |
| | | | Send Able | 读 | è®¾å¤æ¯å¦åå¤å¥½åéGlassä¿¡å· | |
| | | | Send Start | å | ä¸»æºæä»¤è®¾å¤å¼å§åéGlass | |
| | | | Job Transfer | å | ä¸»æºæä»¤è®¾å¤è¿è¡Job转移 | |
| | | | Send Complete | 读 | 设å¤åé¦åéå®æä¿¡å· | |
| | | | Shutter State | 读 | è®¾å¤æ¡æ¿ç¶æï¼è®¾å¤åé¦ | |
| | | | Pin State | 读 | 设å¤éèç¶æ | |
| | | | Slot Pair Flag | 读 | 设å¤åé¦Sloté
å¯¹ç¶æ | |
| | | | Arm Slot Pair Flag | 读 | æºæ¢°èSloté
å¯¹ç¶æ | |
| | | | Exchange Possible | 读 | 设å¤å馿¯å¦å
è®¸äº¤æ¢ | |
| | | | Exchange Execute | å | 主æºä¸åæ§è¡äº¤æ¢æä»¤ | |
| | | | Cancel Request | å | 主æºåæ¶å½åæä½è¯·æ± | |
| | | | Cancel Ack | 读 | 设å¤ç¡®è®¤åæ¶æä½ | |
| | | | Cancel Nck | 读 | è®¾å¤æç»åæ¶æä½ | |
| | | | Abort Request | å | 主æºè¯·æ±ä¸æ¢æä½ | |
| | | | Abort Ack | 读 | 设å¤ç¡®è®¤ä¸æ¢æä½ | |
| | | | Abort Nck | 读 | è®¾å¤æç»ä¸æ¢æä½ | |
| | | | Resume Request | å | 主æºè¯·æ±æ¢å¤æä½ | |
| | | | Resume Ack | 读 | 设å¤ç¡®è®¤æ¢å¤æä½ | |
| | | | Resume Nak | 读 | è®¾å¤æç»æ¢å¤æä½ | |
| | | | Abnormal | 读 | 设å¤å¼å¸¸ä¿¡å· | |
| | | | Empty | 读 | 设å¤ç©ºç¶æ | |
| | | | Idle | 读 | 设å¤ç©ºé²ç¶æ | |
| | | | Run | 读 | 设å¤è¿è¡ç¶æ | |
| | | | Complete | 读 | 设å¤å®æç¶æ | |
| | | | Lift Up or Pin Up | 读 | è®¾å¤æ¬åç¶æ | |
| | | | Lift Down or Pin Down | 读 | 设å¤ä¸éç¶æ | |
| | | | Stopper Up or Shutter Open | 读 | è®¾å¤æ¡æ¿å¼ç¶æ | |
| | | | Stopper Down or Shutter Close | 读 | è®¾å¤æ¡æ¿å
³ç¶æ | |
| | | | Manual Operation | 读 | è®¾å¤æå¨æä½ç¶æ | |
| | | | Body Moving | 读 | 设å¤å¨ä½ä¸ç¶æ | |
| | | | Glass Exist #1(Check Sensor on) | 读 | ç»çåå¨ä¼ æå¨ä¿¡å· | |
| | | | Glass Exist #2(Check Sensor on) | 读 | ç»çåå¨ä¼ æå¨ä¿¡å· | |
| | | | Glass Exist #1 Exist | 读 | ç»çå®é
åå¨ç¶æ | |
| | | | Glass Exist #2 Exist | 读 | ç»çå®é
åå¨ç¶æ | |
| | | | Arm Stretch complete | 读 | æºæ¢°è伸å±å®æ | |
| | | | Arm Vacuum | 读 | æºæ¢°èå¸éç¶æ | |
| | | | Conveyor State | 读 | ä¼ éå¸¦ç¶æ | |
| | | | Arm Fold complete | 读 | æºæ¢°èæå 宿 | |
| | | | Make Define #1\~#9 | 读 | 设å¤èªå®ä¹ä¿¡å·ï¼ä¸è¬è®¾å¤åé¦ | |
| | | |
| | | |
| | | |
| | | æ»ç» |
| | | | ä½ éè¦è¿ä¸¤ä¸ªä¿¡å·åï¼ | çæ¡æ¯ï¼å¿
须忶ç¨ã |
| | | | â | â | |
| | | | Robot CMD | â忬è¿å¨ä½åæ°â | |
| | | | Indexer Operation Mode Command | âåå¯å¨å½ä»¤â | |
| | | |
| | | Load port Status䏿¥jobData |
| | | è¾¹æ£NG, Job Data Change report, è¦åè·¯éå |
| | | |
| | | sh600975 sz002818 sh600727 sh600829 |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | SVID,SV Name,SV Format,SV Remark |
| | | 100,PortTransferState,U1,"0=OutOfService\r\n1=TransferBlocked\r\n2=ReadyToLoad\r\n3=ReadyToUnload\r\n4=InService\r\n5=TransferReady" |
| | | 300,AccessMode,U1,"1=Manual\r\n2=Auto" |
| | | 500,Clock,A50, |
| | | 600,CurrentControlState,U1,"0:Offline:equipment\r\n1:Offline-Attempt\r\n2:Online\r\n3:Offline:host\r\n4:Online:Local\r\n5:Online:Remote" |
| | | 601,PreviousControlState,U1, |
| | | 700,CurrentProcessState,U1,"0:DOWN\r\n1:IDLE\r\n2.SETUP\r\n3.EXCUTING\r\n4.MAINTAIN\r\n5.ALARM" |
| | | 701,PreviousProcessState,U1, |
| | | 800,EFEMPPExecName,A20, |
| | | 801,EQPPExecName,A20, |
| | | 1000,CJobSpace,U1, |
| | | 2000,RbRAxisTorque,I2,æºå¨äººRè½´æç© |
| | | 2001,RbLAxisTorque,l2,æºå¨äººLè½´æç© |
| | | 2002,RbZAxisTorque,l2,æºå¨äººZè½´æç© |
| | | 2003,RbTHAxisTorque,l2,æºå¨äººTHè½´æç© |
| | | 2004,RbXAxisTorque,l2,æºå¨äººXè½´æç© |
| | | 2005,AxisX111,l2,X111ç¸æºåç§»æ ½çµæºæç© |
| | | 2006,AxisX112,l2,X112ç¸æºåç§»æ ½çµæºæç© |
| | | 2007,AxisU113,l2,U113产åæè½¬çµæºæç© |
| | | 2008,AxisX114,l2,X114产åå·¦æ´åçµæºæç© |
| | | 2009,AxisY121,l2,Y121产å峿´åçµæºæç© |
| | | 2010,AxisY122,l2,Y122产ååæ´åçµæºæç© |
| | | 2011,AxisY123,l2,Y123产ååéµåçµæºæç© |
| | | 2012,MainAir,U2,æ»è¿æ°ååå¼ |
| | | 2013,MainVacuum,l2,æ»ç空ååå¼ |
| | | 2014,RbMainVacuum,l2,æºå¨äººçç©ºå¼ |
| | | 2015,LPMainVacuum,l2,LPç空å¼#D265 |
| | | 2016,LPMainAir,U2,LPåç©ºå¼ |
| | | 2017,ALVacuum,l2,Alignerçç©ºå¼ |
| | | 2018,FFU1RPM,U2,FFU1转é |
| | | 2019,FFU2RPM,U2,FFU2转é |
| | | 2020,FFU3RPM,U2,FFU3转é |
| | | 2021,FFU4RPM,U2,FFU4转é |
| | | 2022,ESDValue,I2,éçµæ£æµå¼ |
| | | 2023,OCREnable,U2,"OCR使è½ï¼O:å¼å¯ 1ï¼å±è½" |
| | | 2024,CCDEnable,U2,"CCD使è½ï¼O:å¼å¯ 1ï¼å±è½" |
| | | 2025,FFUParameter,U2,FFU设å®å¼ |
| | |
| | | <IDENTITY>Host</IDENTITY> |
| | | </DRVINFO> |
| | | <LOGINFO> |
| | | <DIR>D:\Chenluhua\dazi\a</DIR> |
| | | <DIR>D:\Chenluhua\dazi\A</DIR> |
| | | <SECSIMODE>D</SECSIMODE> |
| | | <SECSIIMODE>D</SECSIIMODE> |
| | | <XMLMODE /> |
| | |
| | | </LOGINFO> |
| | | <SECSMODE MODE="HSMS"> |
| | | <HSMS> |
| | | <HSMSMODE>Active</HSMSMODE> |
| | | <HSMSMODE>Passive</HSMSMODE> |
| | | <REMOTEIP>127.0.0.1</REMOTEIP> |
| | | <REMOTEPORT>7000</REMOTEPORT> |
| | | <LOCALPORT> |
| | | </LOCALPORT> |
| | | <LOCALPORT>7001</LOCALPORT> |
| | | </HSMS> |
| | | <SECS1> |
| | | <MASTER>True</MASTER> |
| | | <COMPORT>COM1</COMPORT> |
| | | <AUTOBAUD>False</AUTOBAUD> |
| | | <AUTOBAUD>True</AUTOBAUD> |
| | | <BAUDRATE>9600</BAUDRATE> |
| | | <INTERLEAVE>False</INTERLEAVE> |
| | | <RETRYCOUNT>3</RETRYCOUNT> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CAddIDSDlg.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "pch.h" |
| | | #include "EAPSimulator.h" |
| | | #include "CAddIDSDlg.h" |
| | | #include "afxdialogex.h" |
| | | |
| | | |
| | | // CAddIDSDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CAddIDSDlg, CDialogEx) |
| | | |
| | | CAddIDSDlg::CAddIDSDlg(CWnd* pParent /*=nullptr*/) |
| | | : CDialogEx(IDD_DIALOG_ADD_IDS, pParent) |
| | | { |
| | | m_nId = 0; |
| | | } |
| | | |
| | | CAddIDSDlg::~CAddIDSDlg() |
| | | { |
| | | } |
| | | |
| | | void CAddIDSDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CAddIDSDlg, CDialogEx) |
| | | ON_BN_CLICKED(IDOK, &CAddIDSDlg::OnBnClickedOk) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CAddIDSDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | void CAddIDSDlg::SetTitle(const char* pszTitle) |
| | | { |
| | | m_strTitle = pszTitle; |
| | | } |
| | | |
| | | BOOL CAddIDSDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // TODO: 卿¤æ·»å é¢å¤çåå§å |
| | | SetWindowText(m_strTitle); |
| | | SetDlgItemText(IDC_GROUP_IDS, m_strTitle); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | unsigned int CAddIDSDlg::GetId() |
| | | { |
| | | return m_nId; |
| | | } |
| | | |
| | | |
| | | void CAddIDSDlg::OnBnClickedOk() |
| | | { |
| | | m_nId = GetDlgItemInt(IDC_EDIT_ID); |
| | | |
| | | CDialogEx::OnOK(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | // CAddIDSDlg å¯¹è¯æ¡ |
| | | |
| | | class CAddIDSDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CAddIDSDlg) |
| | | |
| | | public: |
| | | CAddIDSDlg(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | virtual ~CAddIDSDlg(); |
| | | void SetTitle(const char* pszTitle); |
| | | unsigned int GetId(); |
| | | |
| | | private: |
| | | CString m_strTitle; |
| | | unsigned int m_nId; |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_ADD_IDS }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnBnClickedOk(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "pch.h" |
| | | #include "CCollectionEvent.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | | CCollectionEvent::CCollectionEvent() |
| | | { |
| | | m_nCEID = 0; |
| | | } |
| | | |
| | | CCollectionEvent::CCollectionEvent(unsigned int id, const char* pszName, const char* pszDescription, std::vector<unsigned int>& prtids) |
| | | { |
| | | m_nCEID = id; |
| | | m_strName = pszName; |
| | | m_strDescription = pszDescription; |
| | | for (auto item : prtids) { |
| | | m_rptids.push_back(item); |
| | | } |
| | | } |
| | | |
| | | CCollectionEvent::~CCollectionEvent() |
| | | { |
| | | |
| | | } |
| | | |
| | | unsigned int CCollectionEvent::getEventId() |
| | | { |
| | | return m_nCEID; |
| | | } |
| | | |
| | | std::string& CCollectionEvent::getName() |
| | | { |
| | | return m_strName; |
| | | } |
| | | |
| | | std::string& CCollectionEvent::getDescription() |
| | | { |
| | | return m_strDescription; |
| | | } |
| | | |
| | | BOOL CCollectionEvent::addReport(CReport* pReport) |
| | | { |
| | | ASSERT(pReport); |
| | | if (getReport(pReport->getReportId()) != nullptr) { |
| | | return FALSE; |
| | | } |
| | | |
| | | m_reports.push_back(pReport); |
| | | return TRUE; |
| | | } |
| | | |
| | | BOOL CCollectionEvent::deleteReport(unsigned int nReportId) |
| | | { |
| | | BOOL bDelete = FALSE; |
| | | for (auto iter = m_reports.begin(); iter != m_reports.end(); ++iter) { |
| | | if (nReportId == (*iter)->getReportId()) { |
| | | m_reports.erase(iter); |
| | | bDelete = TRUE; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return bDelete; |
| | | } |
| | | |
| | | CReport* CCollectionEvent::getReport(unsigned int nReportId) |
| | | { |
| | | for (auto item : m_reports) { |
| | | if (nReportId == item->getReportId()) { |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | void CCollectionEvent::setReport(unsigned int nReportId) |
| | | { |
| | | m_rptids.clear(); |
| | | if (nReportId != 0) { |
| | | m_rptids.push_back(nReportId); |
| | | } |
| | | } |
| | | |
| | | std::vector<CReport*>& CCollectionEvent::getReports() |
| | | { |
| | | return m_reports; |
| | | } |
| | | |
| | | std::vector<unsigned int>& CCollectionEvent::getReportIds() |
| | | { |
| | | return m_rptids; |
| | | } |
| | | |
| | | std::string CCollectionEvent::getReportIdsText() |
| | | { |
| | | std::string strResult, strName; |
| | | for (int i = 0; i < m_rptids.size(); i++) { |
| | | strResult += std::to_string(m_rptids[i]);// (getReport(m_rptids[i]) ? |
| | | if (nullptr == getReport(m_rptids[i])) { |
| | | strResult += ""; |
| | | } |
| | | if (i != m_rptids.size() - 1) { |
| | | strResult += ","; |
| | | } |
| | | } |
| | | |
| | | return strResult; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CReport.h" |
| | | #include <vector> |
| | | |
| | | |
| | | namespace SERVO { |
| | | class CCollectionEvent |
| | | { |
| | | public: |
| | | CCollectionEvent(); |
| | | CCollectionEvent(unsigned int id, const char* pszName, const char* pszDescription, std::vector<unsigned int>& prtids); |
| | | virtual ~CCollectionEvent(); |
| | | |
| | | public: |
| | | unsigned int getEventId(); |
| | | std::string& getName(); |
| | | std::string& getDescription(); |
| | | std::vector<CReport*>& getReports(); |
| | | std::vector<unsigned int>& getReportIds(); |
| | | std::string getReportIdsText(); |
| | | BOOL addReport(CReport* pReport); |
| | | BOOL deleteReport(unsigned int nReportId); |
| | | CReport* getReport(unsigned int nReportId); |
| | | void setReport(unsigned int nReportId); |
| | | |
| | | private: |
| | | unsigned int m_nCEID; |
| | | std::string m_strName; |
| | | std::string m_strDescription; |
| | | std::vector<unsigned int> m_rptids; |
| | | std::vector<CReport*> m_reports; |
| | | }; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CDefineReportsDlg.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "pch.h" |
| | | #include "EAPSimulator.h" |
| | | #include "CDefineReportsDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "CAddIDSDlg.h" |
| | | |
| | | |
| | | // CDefineReportsDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CDefineReportsDlg, CDialogEx) |
| | | |
| | | CDefineReportsDlg::CDefineReportsDlg(CWnd* pParent /*=nullptr*/) |
| | | : CDialogEx(IDD_DIALOG_DEFINE_REPORTS, pParent) |
| | | { |
| | | |
| | | } |
| | | |
| | | CDefineReportsDlg::~CDefineReportsDlg() |
| | | { |
| | | } |
| | | |
| | | void CDefineReportsDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CDefineReportsDlg, CDialogEx) |
| | | ON_BN_CLICKED(IDC_BUTTON_ADD_RPTID, &CDefineReportsDlg::OnBnClickedButtonAddRptid) |
| | | ON_LBN_SELCHANGE(IDC_LIST1, &CDefineReportsDlg::OnLbnSelchangeList1) |
| | | ON_BN_CLICKED(IDC_BUTTON_DEL_REPORT, &CDefineReportsDlg::OnBnClickedButtonDelReport) |
| | | ON_BN_CLICKED(IDC_BUTTON_ADD_VID, &CDefineReportsDlg::OnBnClickedButtonAddVid) |
| | | ON_LBN_SELCHANGE(IDC_LIST2, &CDefineReportsDlg::OnLbnSelchangeList2) |
| | | ON_BN_CLICKED(IDC_BUTTON_DEL_VID, &CDefineReportsDlg::OnBnClickedButtonDelVid) |
| | | ON_BN_CLICKED(IDC_BUTTON_SEND, &CDefineReportsDlg::OnBnClickedButtonSend) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CDefineReportsDlg æ¶æ¯å¤çç¨åº |
| | | void CDefineReportsDlg::OnBnClickedButtonAddRptid() |
| | | { |
| | | CAddIDSDlg dlg; |
| | | dlg.SetTitle("RPTID"); |
| | | dlg.DoModal(); |
| | | int PRTID = dlg.GetId(); |
| | | addReport(PRTID); |
| | | } |
| | | |
| | | void CDefineReportsDlg::OnBnClickedButtonAddVid() |
| | | { |
| | | CString strReportId; |
| | | CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST1); |
| | | int nSel = pListBox->GetCurSel(); |
| | | if (nSel >= 0) { |
| | | pListBox->GetText(nSel, strReportId); |
| | | int RPTID = atoi(strReportId); |
| | | |
| | | CAddIDSDlg dlg; |
| | | dlg.SetTitle("RPTID"); |
| | | dlg.DoModal(); |
| | | unsigned int VID = dlg.GetId();; |
| | | addVid(RPTID, VID); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | void CDefineReportsDlg::OnLbnSelchangeList1() |
| | | { |
| | | CString strReportId; |
| | | int RPTID = -1; |
| | | CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST1); |
| | | int nSel = pListBox->GetCurSel(); |
| | | if (nSel >= 0) { |
| | | pListBox->GetText(nSel, strReportId); |
| | | RPTID = atoi(strReportId); |
| | | } |
| | | |
| | | GetDlgItem(IDC_BUTTON_DEL_REPORT)->EnableWindow(nSel >= 0); |
| | | GetDlgItem(IDC_BUTTON_ADD_VID)->EnableWindow(nSel >= 0); |
| | | |
| | | CListBox* pListBox2 = (CListBox*)GetDlgItem(IDC_LIST2); |
| | | pListBox2->ResetContent(); |
| | | auto iter = m_mapReport.find(RPTID); |
| | | if (iter != m_mapReport.end()) { |
| | | auto& vids = m_mapReport[RPTID]; |
| | | for (auto item : vids) { |
| | | pListBox2->AddString(std::to_string(item).c_str()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CDefineReportsDlg::OnBnClickedButtonDelReport() |
| | | { |
| | | CString strReportId; |
| | | CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST1); |
| | | int nSel = pListBox->GetCurSel(); |
| | | if (nSel >= 0) { |
| | | pListBox->GetText(nSel, strReportId); |
| | | int RPTID = atoi(strReportId); |
| | | delReport(RPTID); |
| | | pListBox->DeleteString(nSel); |
| | | ((CListBox*)GetDlgItem(IDC_LIST2))->ResetContent(); |
| | | } |
| | | |
| | | nSel = pListBox->GetCurSel(); |
| | | GetDlgItem(IDC_BUTTON_DEL_REPORT)->EnableWindow(nSel >= 0); |
| | | GetDlgItem(IDC_BUTTON_ADD_VID)->EnableWindow(nSel >= 0); |
| | | } |
| | | |
| | | void CDefineReportsDlg::OnLbnSelchangeList2() |
| | | { |
| | | CListBox* pListBox2 = (CListBox*)GetDlgItem(IDC_LIST2); |
| | | int nSel = pListBox2->GetCurSel(); |
| | | GetDlgItem(IDC_BUTTON_DEL_VID)->EnableWindow(nSel >= 0); |
| | | } |
| | | |
| | | void CDefineReportsDlg::OnBnClickedButtonDelVid() |
| | | { |
| | | CString strRPTID, strVID; |
| | | CListBox* pListBox1 = (CListBox*)GetDlgItem(IDC_LIST1); |
| | | CListBox* pListBox2 = (CListBox*)GetDlgItem(IDC_LIST2); |
| | | int nSel1 = pListBox1->GetCurSel(); |
| | | int nSel2 = pListBox2->GetCurSel(); |
| | | if (nSel1 >= 0 && nSel2 >= 0) { |
| | | pListBox1->GetText(nSel1, strRPTID); |
| | | pListBox2->GetText(nSel2, strVID); |
| | | int RPTID = atoi(strRPTID); |
| | | int VID = atoi(strVID); |
| | | delVid(RPTID, VID); |
| | | pListBox2->DeleteString(nSel2); |
| | | } |
| | | |
| | | nSel2 = pListBox2->GetCurSel(); |
| | | GetDlgItem(IDC_BUTTON_DEL_VID)->EnableWindow(nSel2 >= 0); |
| | | } |
| | | |
| | | void CDefineReportsDlg::addReport(int RPTID) |
| | | { |
| | | auto iter = m_mapReport.find(RPTID); |
| | | if (iter == m_mapReport.end()) { |
| | | std::vector<unsigned int> vids; |
| | | m_mapReport[RPTID] = vids; |
| | | } |
| | | |
| | | CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST1); |
| | | pListBox->AddString(std::to_string(RPTID).c_str()); |
| | | } |
| | | |
| | | bool CDefineReportsDlg::addVid(unsigned int RPTID, unsigned int vid) |
| | | { |
| | | auto iter = m_mapReport.find(RPTID); |
| | | if (iter == m_mapReport.end()) { |
| | | return false; |
| | | } |
| | | |
| | | auto& vids = m_mapReport[RPTID]; |
| | | vids.push_back(vid); |
| | | CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST2); |
| | | pListBox->AddString(std::to_string(vid).c_str()); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | void CDefineReportsDlg::delReport(int RPTID) |
| | | { |
| | | auto iter = m_mapReport.find(RPTID); |
| | | if (iter != m_mapReport.end()) { |
| | | m_mapReport.erase(iter); |
| | | } |
| | | } |
| | | |
| | | void CDefineReportsDlg::delVid(int RPTID, int VID) |
| | | { |
| | | auto iter = m_mapReport.find(RPTID); |
| | | if (iter != m_mapReport.end()) { |
| | | auto& vids = iter->second; |
| | | for (auto iter2 = vids.begin(); iter2 != vids.end(); iter2++) { |
| | | if ((*iter2) == VID) { |
| | | vids.erase(iter2); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CDefineReportsDlg::OnBnClickedButtonSend() |
| | | { |
| | | theApp.m_model.m_pHsmsActive->hsmsDefineReports(m_mapReport); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include <map> |
| | | #include <vector> |
| | | |
| | | // CDefineReportsDlg å¯¹è¯æ¡ |
| | | |
| | | class CDefineReportsDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CDefineReportsDlg) |
| | | |
| | | public: |
| | | CDefineReportsDlg(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | virtual ~CDefineReportsDlg(); |
| | | void addReport(int RPTID); |
| | | void delReport(int RPTID); |
| | | bool addVid(unsigned int RPTID, unsigned int vid); |
| | | void delVid(int RPTID, int VID); |
| | | |
| | | private: |
| | | std::map<unsigned int, std::vector<unsigned int>> m_mapReport; |
| | | |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_DEFINE_REPORTS }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | afx_msg void OnBnClickedButtonAddRptid(); |
| | | afx_msg void OnLbnSelchangeList1(); |
| | | afx_msg void OnBnClickedButtonDelReport(); |
| | | afx_msg void OnBnClickedButtonAddVid(); |
| | | afx_msg void OnLbnSelchangeList2(); |
| | | afx_msg void OnBnClickedButtonDelVid(); |
| | | afx_msg void OnBnClickedButtonSend(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CEDEventReportDlg.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "pch.h" |
| | | #include "EAPSimulator.h" |
| | | #include "CEDEventReportDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include <vector> |
| | | |
| | | |
| | | // CEDEventReportDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CEDEventReportDlg, CDialogEx) |
| | | |
| | | CEDEventReportDlg::CEDEventReportDlg(CWnd* pParent /*=nullptr*/) |
| | | : CDialogEx(IDD_DIALOG_ED_EVENT_REPORT, pParent) |
| | | { |
| | | |
| | | } |
| | | |
| | | CEDEventReportDlg::~CEDEventReportDlg() |
| | | { |
| | | } |
| | | |
| | | void CEDEventReportDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CEDEventReportDlg, CDialogEx) |
| | | ON_BN_CLICKED(IDC_BUTTON_SEND, &CEDEventReportDlg::OnBnClickedButtonSend) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CEDEventReportDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CEDEventReportDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | CButton* pButton = (CButton*)GetDlgItem(IDC_RADIO_ENABLE); |
| | | pButton->SetCheck(BST_CHECKED); |
| | | |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CEDEventReportDlg::OnBnClickedButtonSend() |
| | | { |
| | | CButton* pButton = (CButton*)GetDlgItem(IDC_RADIO_ENABLE); |
| | | bool bEnable = pButton->GetCheck() == BST_CHECKED; |
| | | |
| | | CString strText, strId; |
| | | GetDlgItemText(IDC_EDIT_CEID, strText); |
| | | std::vector<int> ids; |
| | | if (!strText.IsEmpty()) { |
| | | int i = 0; |
| | | while (1) { |
| | | if (!AfxExtractSubString(strId, (LPCTSTR)strText, i++, ',')) { |
| | | break; |
| | | } |
| | | ids.push_back(atoi(strId)); |
| | | } |
| | | } |
| | | |
| | | |
| | | theApp.m_model.m_pHsmsActive->hsmsEDEventReport(bEnable, ids); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | // CEDEventReportDlg å¯¹è¯æ¡ |
| | | |
| | | class CEDEventReportDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CEDEventReportDlg) |
| | | |
| | | public: |
| | | CEDEventReportDlg(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | virtual ~CEDEventReportDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_ED_EVENT_REPORT }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnBnClickedButtonSend(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "pch.h" |
| | | #include "CHsmsActive.h" |
| | | #include "Log.h" |
| | | |
| | | |
| | | CHsmsActive::CHsmsActive() |
| | | { |
| | | m_listener = {}; |
| | | m_pActive = nullptr; |
| | | m_nSessionId = 0; |
| | | m_nSystemByte = 0; |
| | | } |
| | | |
| | | CHsmsActive::~CHsmsActive() |
| | | { |
| | | |
| | | } |
| | | |
| | | void CHsmsActive::setListener(ACTIVEListener listener) |
| | | { |
| | | m_listener = listener; |
| | | } |
| | | |
| | | int CHsmsActive::init(const char* pszIp, int port) |
| | | { |
| | | m_strIp = pszIp; |
| | | m_nPort = port; |
| | | |
| | | auto onStatusChanged = [&](void* pFrom, ACTIVESTATE state) -> void { |
| | | if (m_listener.onStateChanged != nullptr) { |
| | | m_listener.onStateChanged(this, state); |
| | | } |
| | | |
| | | if (ACTIVESTATE::NOT_SELECTED == state) { |
| | | LOGI("Active state changed(NOT_SELECTED)."); |
| | | hsmsSelectRequest(); |
| | | } |
| | | else if (ACTIVESTATE::SELECTED == state) { |
| | | LOGI("Active state changed(SELECTED)."); |
| | | hsmsEstablishCommunications(); |
| | | } |
| | | else if (ACTIVESTATE::NOT_CONNECTED == state) { |
| | | LOGI("Active state changed(NOT_CONNECTED)."); |
| | | m_pActive->disconnect(); |
| | | } |
| | | }; |
| | | auto onRecvSysMessage = [&](void* pFrom, IMessage* pMessage) -> void { |
| | | LOGI("onRecvSysMessage(sessionId:%d, sType:%d).", |
| | | pMessage->getHeader()->sessionId, pMessage->getHeader()->sType); |
| | | TRACE("sessionId:%d, sType:%d\n", pMessage->getHeader()->sessionId, pMessage->getHeader()->sType); |
| | | }; |
| | | |
| | | auto onError = [&](void* pFrom, int error) -> void { |
| | | TRACE("onError:%d\n", error); |
| | | }; |
| | | |
| | | auto onRecvRawData = [&](void* pFrom, const char* pszData, int size) { |
| | | TRACE("onRec ,vRawData:<0x%x, %d>\n", pszData, size); |
| | | }; |
| | | |
| | | auto onRecvDataMessage = [&](void* pFrom, IMessage* pMessage) -> void { |
| | | HEADER* pHeader = pMessage->getHeader(); |
| | | int nStream = (pHeader->stream & 0x7F); |
| | | |
| | | TRACE("æ¶å°æ¶æ¯ S%dF%d================\n", pHeader->stream & 0x7F, pHeader->function); |
| | | TRACE("Body:%s\n", pMessage->toString()); |
| | | LOGI("onRecvDataMessage(%s).", pMessage->toString()); |
| | | |
| | | if (nStream == 5 && pHeader->function == 1) { |
| | | // S1F1 |
| | | replyAck(5, 2, pMessage->getHeader()->systemBytes, 0, _T("ACK0")); |
| | | } |
| | | }; |
| | | |
| | | ActiveListener listener; |
| | | listener.funStateChanged = onStatusChanged; |
| | | listener.funRecvRawData = onRecvRawData; |
| | | listener.funRecvDataMessage = onRecvDataMessage; |
| | | listener.funRecvSysMessage = onRecvSysMessage; |
| | | listener.funError = onError; |
| | | int nRet = HSMS_CreateActive(m_pActive, _T(""), m_strIp.c_str(), m_nPort); |
| | | if (nRet == 0 && m_pActive != nullptr) { |
| | | m_pActive->setListener(listener); |
| | | m_pActive->connect(); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::term() |
| | | { |
| | | if (m_pActive != nullptr) { |
| | | ::HSMS_DestroyActive(m_pActive); |
| | | m_pActive = nullptr; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsSelectRequest() |
| | | { |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_CreateMessageWithSType(pMessage, MSG_SELECT_REQ, ++m_nSystemByte); |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsDeselectRequest() |
| | | { |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_CreateMessageWithSType(pMessage, MSG_DESELECT_REQ, ++m_nSystemByte); |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsEstablishCommunications() |
| | | { |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 1 | REPLY, 13, ++m_nSystemByte); |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsAreYouThere() |
| | | { |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 1 | REPLY, 1, ++m_nSystemByte); |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsDatetimeSync() |
| | | { |
| | | CTime time = CTime::GetCurrentTime(); |
| | | char szTime[256]; |
| | | sprintf_s(szTime, 256, _T("%4d%02d%02d%02d%02d%02d00"), time.GetYear(), |
| | | time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); |
| | | |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 2 | REPLY, 31, ++m_nSystemByte); |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->setString((const char*)szTime, _T("Date time")); |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsTerminalDisplay(BYTE tid, const char* pszText) |
| | | { |
| | | char szTid[1]; |
| | | szTid[0] = tid; |
| | | |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 10 | REPLY, 3, ++m_nSystemByte); |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->addBinaryItem(szTid, 1, _T("TID")); |
| | | pItem->addItem(pszText, _T("TEXT")); |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsEDEventReport(bool bEnable, std::vector<int>& ids) |
| | | { |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 2 | REPLY, 37, ++m_nSystemByte); |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->addBoolItem(bEnable, "CEED"); |
| | | ISECS2Item* pItem2 = pItem->addItem(); |
| | | for (auto item : ids) { |
| | | pItem2->addU4Item(item, "CEID"); |
| | | } |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsEDAlarmReport(bool bEnable, unsigned int id) |
| | | { |
| | | char szEnable[2] = {128, 0}; |
| | | |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 5 | REPLY, 3, ++m_nSystemByte); |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->addBinaryItem(&szEnable[bEnable ? 0 : 1], 1, "ALED"); |
| | | pItem->addU4Item(id, "ALID"); |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsDefineReports(std::map<unsigned int, std::vector<unsigned int>>& mapReport) |
| | | { |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 2 | REPLY, 33, ++m_nSystemByte); |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->addU4Item(1, "DATAID"); |
| | | ISECS2Item* pItemReportList = pItem->addItem(); |
| | | for (auto item : mapReport) { |
| | | ISECS2Item* pItemReport = pItemReportList->addItem(); |
| | | pItemReport->addU4Item(item.first, "RPTID"); |
| | | ISECS2Item* pItemVidList = pItemReport->addItem(); |
| | | for (auto vid : item.second) { |
| | | pItemVidList->addU4Item(vid, "VID"); |
| | | } |
| | | } |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsLinkEventReport(std::map<unsigned int, std::vector<unsigned int>>& mapEvent) |
| | | { |
| | | if (mapEvent.empty()) return 0; |
| | | |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 2 | REPLY, 35, ++m_nSystemByte); |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->addU4Item(1, "DATAID"); |
| | | ISECS2Item* pItemEventList = pItem->addItem(); |
| | | for (auto item : mapEvent) { |
| | | ISECS2Item* pItemEvent = pItemEventList->addItem(); |
| | | pItemEvent->addU4Item(item.first, "CEID"); |
| | | ISECS2Item* pItemRptidList = pItemEvent->addItem(); |
| | | for (auto vid : item.second) { |
| | | pItemRptidList->addU4Item(vid, "RPTID"); |
| | | } |
| | | } |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsConfigureSpooling(std::map<unsigned int, std::set<unsigned int>>& spoolingConfig) |
| | | { |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 2 | REPLY, 43, ++m_nSystemByte); |
| | | if (spoolingConfig.size() > 0) { |
| | | for (auto s : spoolingConfig) { |
| | | ISECS2Item* pItemStreamList = pMessage->getBody()->addItem(); |
| | | pItemStreamList->addU1Item(s.first, "STRID"); |
| | | ISECS2Item* pItemFcnList = pItemStreamList->addItem(); |
| | | for (auto f : s.second) { |
| | | pItemFcnList->addU1Item(f, "FCNID"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::replyAck0(IMessage* pMessage) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | // éç¨çreply ack彿° |
| | | void CHsmsActive::replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName) |
| | | { |
| | | IMessage* pMessage = NULL; |
| | | HSMS_Create1Message(pMessage, m_nSessionId, s, f, systemBytes); |
| | | ASSERT(pMessage); |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->setBinary((const char*)&ack, 1, pszAckName); |
| | | m_pActive->sendMessage(pMessage); |
| | | LOGI("<HSMS>[SECS Msg SEND]S%dF%d (SysByte=%u)", s, f, systemBytes); |
| | | HSMS_Destroy1Message(pMessage); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include <string> |
| | | #include <vector> |
| | | #include <map> |
| | | #include <set> |
| | | #include "CCollectionEvent.h" |
| | | |
| | | |
| | | typedef std::function<void(void* pFrom, ACTIVESTATE state)> STATECHANGED; |
| | | typedef struct _ACTIVEListener |
| | | { |
| | | STATECHANGED onStateChanged; |
| | | } ACTIVEListener; |
| | | |
| | | class CHsmsActive |
| | | { |
| | | public: |
| | | CHsmsActive(); |
| | | ~CHsmsActive(); |
| | | |
| | | public: |
| | | void setListener(ACTIVEListener listener); |
| | | int init(const char* pszIp, int port); |
| | | int term(); |
| | | |
| | | public: |
| | | // Select |
| | | int hsmsSelectRequest(); |
| | | |
| | | // Deselect Request |
| | | int hsmsDeselectRequest(); |
| | | |
| | | // 建ç«é讯(S1F13) |
| | | int hsmsEstablishCommunications(); |
| | | |
| | | // Are You There |
| | | int hsmsAreYouThere(); |
| | | |
| | | // Date time sync |
| | | int hsmsDatetimeSync(); |
| | | |
| | | // terminal display |
| | | int hsmsTerminalDisplay(BYTE tid, const char* pszText); |
| | | |
| | | // Enable/Disable Event Report |
| | | int hsmsEDEventReport(bool bEnable, std::vector<int>& ids); |
| | | |
| | | // Enable/Disable Alarm Report |
| | | int hsmsEDAlarmReport(bool bEnable, unsigned int id); |
| | | |
| | | // Define reports |
| | | int hsmsDefineReports(std::map<unsigned int, std::vector<unsigned int>>& mapReport); |
| | | |
| | | // Line Event Report |
| | | int hsmsLinkEventReport(std::map<unsigned int, std::vector<unsigned int>>& mapEvent); |
| | | |
| | | // Configure Spooling |
| | | int hsmsConfigureSpooling(std::map<unsigned int, std::set<unsigned int>>& spoolingConfig); |
| | | |
| | | // éè¿çreply彿° |
| | | void replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName); |
| | | |
| | | // reply ack0 |
| | | int replyAck0(IMessage* pMessage); |
| | | |
| | | private: |
| | | ACTIVEListener m_listener; |
| | | IActive* m_pActive; |
| | | std::string m_strIp; |
| | | int m_nPort; |
| | | unsigned short m_nSessionId; |
| | | unsigned int m_nSystemByte; |
| | | }; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CLinkReportDetailDlg.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "pch.h" |
| | | #include "EAPSimulator.h" |
| | | #include "CLinkReportDetailDlg.h" |
| | | #include "afxdialogex.h" |
| | | |
| | | |
| | | // CLinkReportDetailDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CLinkReportDetailDlg, CDialogEx) |
| | | |
| | | CLinkReportDetailDlg::CLinkReportDetailDlg(CWnd* pParent /*=nullptr*/) |
| | | : CDialogEx(IDD_DIALOG_LINK_REPORT_DETAIL, pParent) |
| | | { |
| | | m_pEvent = nullptr; |
| | | } |
| | | |
| | | CLinkReportDetailDlg::~CLinkReportDetailDlg() |
| | | { |
| | | } |
| | | |
| | | void CLinkReportDetailDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CLinkReportDetailDlg, CDialogEx) |
| | | ON_BN_CLICKED(IDOK, &CLinkReportDetailDlg::OnBnClickedOk) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CLinkReportDetailDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | void CLinkReportDetailDlg::SetCollectionEvent(SERVO::CCollectionEvent* pEvent) |
| | | { |
| | | m_pEvent = pEvent; |
| | | } |
| | | |
| | | BOOL CLinkReportDetailDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | |
| | | ASSERT(m_pEvent); |
| | | SetDlgItemInt(IDC_EDIT_CEID, m_pEvent->getEventId()); |
| | | SetDlgItemText(IDC_EDIT_CE_NAME, m_pEvent->getName().c_str()); |
| | | SetDlgItemText(IDC_EDIT_CE_DESCRIPTIONS, m_pEvent->getDescription().c_str()); |
| | | SetDlgItemText(IDC_EDIT_CE_RPTID, m_pEvent->getReportIdsText().c_str()); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CLinkReportDetailDlg::OnBnClickedOk() |
| | | { |
| | | ASSERT(m_pEvent); |
| | | |
| | | UINT RPTID = GetDlgItemInt(IDC_EDIT_CE_RPTID); |
| | | m_pEvent->setReport(RPTID); |
| | | |
| | | CDialogEx::OnOK(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CCollectionEvent.h" |
| | | |
| | | |
| | | // CLinkReportDetailDlg å¯¹è¯æ¡ |
| | | |
| | | class CLinkReportDetailDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CLinkReportDetailDlg) |
| | | |
| | | public: |
| | | CLinkReportDetailDlg(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | virtual ~CLinkReportDetailDlg(); |
| | | void SetCollectionEvent(SERVO::CCollectionEvent* pEvent); |
| | | |
| | | private: |
| | | SERVO::CCollectionEvent* m_pEvent; |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_LINK_REPORT_DETAIL }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnBnClickedOk(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CLinkReportDlg.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "pch.h" |
| | | #include "EAPSimulator.h" |
| | | #include "CLinkReportDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include <string.h> |
| | | #include <regex> |
| | | #include "CLinkReportDetailDlg.h" |
| | | |
| | | |
| | | // CLinkReportDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CLinkReportDlg, CDialogEx) |
| | | |
| | | CLinkReportDlg::CLinkReportDlg(CWnd* pParent /*=nullptr*/) |
| | | : CDialogEx(IDD_DIALOG_LINK_REPORT, pParent) |
| | | { |
| | | |
| | | } |
| | | |
| | | CLinkReportDlg::~CLinkReportDlg() |
| | | { |
| | | } |
| | | |
| | | void CLinkReportDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CLinkReportDlg, CDialogEx) |
| | | ON_NOTIFY(NM_DBLCLK, IDC_LIST1, &CLinkReportDlg::OnListCtrlDoubleClick) |
| | | ON_BN_CLICKED(IDC_BUTTON_SEND, &CLinkReportDlg::OnBnClickedButtonSend) |
| | | ON_WM_DESTROY() |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CLinkReportDlg æ¶æ¯å¤çç¨åº |
| | | BOOL CLinkReportDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST1); |
| | | DWORD dwStyle = pListCtrl->GetExtendedStyle(); |
| | | dwStyle |= LVS_EX_FULLROWSELECT; |
| | | dwStyle |= LVS_EX_GRIDLINES; |
| | | pListCtrl->SetExtendedStyle(dwStyle); |
| | | pListCtrl->ModifyStyle(0, LVS_SHOWSELALWAYS); |
| | | |
| | | HIMAGELIST imageList = ImageList_Create(24, 24, ILC_COLOR24, 1, 1); |
| | | ListView_SetImageList(pListCtrl->GetSafeHwnd(), imageList, LVSIL_SMALL); |
| | | pListCtrl->InsertColumn(0, _T(""), LVCFMT_RIGHT, 0); |
| | | pListCtrl->InsertColumn(1, _T("CEID"), LVCFMT_LEFT, 120); |
| | | pListCtrl->InsertColumn(2, _T("CD Name"), LVCFMT_LEFT, 120); |
| | | pListCtrl->InsertColumn(3, _T("Descriptions"), LVCFMT_LEFT, 180); |
| | | pListCtrl->InsertColumn(4, _T("Attached RPTID"), LVCFMT_LEFT, 120); |
| | | pListCtrl->SetColumnWidth(4, LVSCW_AUTOSIZE_USEHEADER); |
| | | |
| | | |
| | | CString strFile; |
| | | strFile.Format(_T("%s\\CollectionEventList.txt"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir); |
| | | loadCollectionEvents((LPTSTR)(LPCTSTR)strFile); |
| | | |
| | | for (auto item : m_collectionEvents) { |
| | | int index = pListCtrl->InsertItem(pListCtrl->GetItemCount(), _T("")); |
| | | pListCtrl->SetItemData(index, (DWORD_PTR)item); |
| | | pListCtrl->SetItemText(index, 1, std::to_string(item->getEventId()).c_str()); |
| | | pListCtrl->SetItemText(index, 2, item->getName().c_str()); |
| | | pListCtrl->SetItemText(index, 3, item->getDescription().c_str()); |
| | | pListCtrl->SetItemText(index, 4, item->getReportIdsText().c_str()); |
| | | } |
| | | |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | int CLinkReportDlg::loadCollectionEvents(const char* pszFilepath) |
| | | { |
| | | CStdioFile file; |
| | | if (!file.Open(pszFilepath, CFile::modeRead)) { |
| | | return -1; |
| | | } |
| | | |
| | | std::regex pattern("^\\d+,[^,]*,[^,]*,\\(\\d+(,\\d+)*\\).*"); // å¹é
以æ°å+éå·å¼å¤´çå符串 |
| | | std::vector<SERVO::CCollectionEvent*> events; |
| | | int index, last; |
| | | CString strLine, strRPTIDs; |
| | | CString strId, strName, strDescription; |
| | | while (file.ReadString(strLine)) { |
| | | if (!std::regex_match((LPTSTR)(LPCTSTR)strLine, pattern)) { |
| | | continue; |
| | | } |
| | | |
| | | last = 0; |
| | | index = strLine.Find(",", last); |
| | | if (index < 0) continue; |
| | | strId = strLine.Left(index); |
| | | last = index + 1; |
| | | |
| | | index = strLine.Find(",", last); |
| | | if (index < 0) continue; |
| | | strName = strLine.Mid(last, index - last); |
| | | last = index + 1; |
| | | |
| | | index = strLine.Find(",", last); |
| | | if (index < 0) continue; |
| | | strDescription = strLine.Mid(last, index - last); |
| | | strRPTIDs = strLine.Right(strLine.GetLength() - index - 1); |
| | | strRPTIDs.Delete(0); |
| | | strRPTIDs.Delete(strRPTIDs.GetLength() - 1); |
| | | auto prtids = parseVidList(strRPTIDs); |
| | | |
| | | SERVO::CCollectionEvent* pEvent = new SERVO::CCollectionEvent( |
| | | atoi(strId), (LPTSTR)(LPCTSTR)strName, (LPTSTR)(LPCTSTR)strDescription, prtids); |
| | | events.push_back(pEvent); |
| | | } |
| | | |
| | | if (!events.empty()) { |
| | | clearAllCollectionEvent(); |
| | | for (auto item : events) { |
| | | m_collectionEvents.push_back(item); |
| | | } |
| | | } |
| | | |
| | | |
| | | file.Close(); |
| | | return 0; |
| | | } |
| | | |
| | | std::vector<unsigned int> CLinkReportDlg::parseVidList(CString& strNums) |
| | | { |
| | | // 1. å
廿å¯è½åºç°ç空ç½ç¬¦ï¼ç©ºæ ¼ãå¶è¡¨ç¬¦çï¼ |
| | | strNums.Trim(); |
| | | |
| | | // 2ï¸. |
| | | std::vector<unsigned int> result; |
| | | int i = 0; |
| | | CString strVid; |
| | | while (1) { |
| | | if (!AfxExtractSubString(strVid, (LPCTSTR)strNums, i, ',')) { |
| | | break; |
| | | } |
| | | if (!strVid.IsEmpty()) // é²å¾¡æ§æ£æ¥ |
| | | result.push_back(std::stoi((LPTSTR)(LPCTSTR)strVid)); |
| | | i++; |
| | | |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | void CLinkReportDlg::clearAllCollectionEvent() |
| | | { |
| | | for (auto item : m_collectionEvents) { |
| | | delete item; |
| | | } |
| | | m_collectionEvents.clear(); |
| | | } |
| | | |
| | | void CLinkReportDlg::OnListCtrlDoubleClick(NMHDR* pNMHDR, LRESULT* pResult) |
| | | { |
| | | LPNMITEMACTIVATE pNMItem = (LPNMITEMACTIVATE)pNMHDR; |
| | | int nItem = pNMItem->iItem; |
| | | if (nItem >= 0) { |
| | | CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST1); |
| | | SERVO::CCollectionEvent* pEvent = (SERVO::CCollectionEvent*)pListCtrl->GetItemData(nItem); |
| | | CLinkReportDetailDlg dlg; |
| | | dlg.SetCollectionEvent(pEvent); |
| | | if (IDOK == dlg.DoModal()) { |
| | | pListCtrl->SetItemText(nItem, 4, pEvent->getReportIdsText().c_str()); |
| | | } |
| | | } |
| | | |
| | | *pResult = 0; |
| | | } |
| | | |
| | | void CLinkReportDlg::OnBnClickedButtonSend() |
| | | { |
| | | std::vector<SERVO::CCollectionEvent*> events; |
| | | CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST1); |
| | | POSITION pos = pListCtrl->GetFirstSelectedItemPosition(); |
| | | while (pos) { |
| | | int nItem = pListCtrl->GetNextSelectedItem(pos); |
| | | SERVO::CCollectionEvent* pEvent = (SERVO::CCollectionEvent*)pListCtrl->GetItemData(nItem); |
| | | events.push_back(pEvent); |
| | | } |
| | | |
| | | std::map<unsigned int, std::vector<unsigned int>> mapEvent; |
| | | for (auto item : events) { |
| | | std::vector<unsigned int> RPTIDs = item->getReportIds(); |
| | | mapEvent[item->getEventId()] = RPTIDs; |
| | | } |
| | | |
| | | |
| | | theApp.m_model.m_pHsmsActive->hsmsLinkEventReport(mapEvent); |
| | | } |
| | | |
| | | void CLinkReportDlg::OnDestroy() |
| | | { |
| | | CDialogEx::OnDestroy(); |
| | | clearAllCollectionEvent(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CCollectionEvent.h" |
| | | |
| | | |
| | | // CLinkReportDlg å¯¹è¯æ¡ |
| | | |
| | | class CLinkReportDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CLinkReportDlg) |
| | | |
| | | public: |
| | | CLinkReportDlg(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | virtual ~CLinkReportDlg(); |
| | | int loadCollectionEvents(const char* pszFilepath); |
| | | std::vector<unsigned int> parseVidList(CString& strNums); |
| | | void clearAllCollectionEvent(); |
| | | |
| | | |
| | | private: |
| | | std::vector<SERVO::CCollectionEvent*> m_collectionEvents; |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_LINK_REPORT }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnListCtrlDoubleClick(NMHDR* pNMHDR, LRESULT* pResult); |
| | | afx_msg void OnBnClickedButtonSend(); |
| | | afx_msg void OnDestroy(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "pch.h" |
| | | #include "CModel.h" |
| | | #include "Log.h" |
| | | #include "Common.h" |
| | | |
| | | |
| | | CModel::CModel() |
| | | { |
| | | m_pObservableEmitter = nullptr; |
| | | m_pObservable = nullptr; |
| | | m_pHsmsActive = nullptr; |
| | | } |
| | | |
| | | CModel::~CModel() |
| | | { |
| | | } |
| | | |
| | | IObservable* CModel::getObservable() |
| | | { |
| | | if (m_pObservable == nullptr) { |
| | | m_pObservable = RX_AllocaObservable([&](IObservableEmitter* e) -> void { |
| | | m_pObservableEmitter = e; // ä¿ååå°å¨ |
| | | }); |
| | | } |
| | | |
| | | return m_pObservable; |
| | | } |
| | | |
| | | void CModel::setWorkDir(const char* pszWorkDir) |
| | | { |
| | | m_strWorkDir = pszWorkDir; |
| | | } |
| | | |
| | | int CModel::init() |
| | | { |
| | | CString strIniFile; |
| | | |
| | | |
| | | |
| | | // Log |
| | | CString strLogDir; |
| | | strLogDir.Format(_T("%s\\Log"), (LPTSTR)(LPCTSTR)m_strWorkDir); |
| | | ::CreateDirectory(strLogDir, NULL); |
| | | CLog::GetLog()->SetOnLogCallback([&](int level, const char* pszMessage) -> void { |
| | | notifyTextAndInt(RX_CODE_LOG, pszMessage, level); |
| | | }); |
| | | CLog::GetLog()->SetAutoAppendTimeString(TRUE); |
| | | CLog::GetLog()->SetOutputTarget(OT_FILE); |
| | | CLog::GetLog()->SetLogsDir(strLogDir); |
| | | CLog::GetLog()->SetEquipmentId(_T("EAP")); |
| | | LOGI("\r\n\r\n~~~ Prog Start! ~~~"); |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::term() |
| | | { |
| | | CLog::GetLog()->SetOnLogCallback(nullptr); |
| | | if (m_pHsmsActive != nullptr) { |
| | | m_pHsmsActive->term(); |
| | | delete m_pHsmsActive; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::connectEq(const char* pszIp, int port) |
| | | { |
| | | if (m_pHsmsActive != nullptr) { |
| | | m_pHsmsActive->term(); |
| | | delete m_pHsmsActive; |
| | | } |
| | | |
| | | ACTIVEListener listener; |
| | | listener.onStateChanged = [&](void* pFrom, ACTIVESTATE state) -> void { |
| | | notifyInt(RX_CODE_ACTIVE_STATUS_CHANGED, (int)state); |
| | | }; |
| | | |
| | | m_pHsmsActive = new CHsmsActive(); |
| | | m_pHsmsActive->setListener(listener); |
| | | m_pHsmsActive->init(pszIp, port); |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::disconnect() |
| | | { |
| | | if (m_pHsmsActive == nullptr) { |
| | | return -1; |
| | | } |
| | | |
| | | m_pHsmsActive->hsmsDeselectRequest(); |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notify(int code) |
| | | { |
| | | /* code */ |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int CModel::notifyPtr(int code, void* ptr/* = NULL*/) |
| | | { |
| | | /* code */ |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setPtrValue("ptr", ptr); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int CModel::notifyObj(int code, IRxObject* pObj) |
| | | { |
| | | /* code */ |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setObject("obj", pObj); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int CModel::notifyObjAndPtr(int code, IRxObject* pObj, void* ptr) |
| | | { |
| | | /* code */ |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setObject("obj", pObj); |
| | | pAny->setPtrValue("ptr", ptr); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int CModel::notifyInt(int code, int exCode) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setIntValue("exCode", exCode); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyInt2(int code, int exCode, int exCode2) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setIntValue("exCode", exCode); |
| | | pAny->setIntValue("exCode2", exCode2); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyDouble(int code, double dValue) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setDoubleValue("value", dValue); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyObjAndInt(int code, IRxObject* pObj1, IRxObject* pObj2, int exCode) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | if (pObj1 != nullptr) pAny->setObject("obj", pObj1); |
| | | if (pObj2 != nullptr) pAny->setObject("obj2", pObj2); |
| | | pAny->setIntValue("exCode", exCode); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyText(int code, const char* pszText) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setStringValue("text", pszText); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyTextAndInt(int code, const char* pszText, int exCode) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setStringValue("text", pszText); |
| | | pAny->setIntValue("exCode", exCode); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyPtrAndInt(int code, void* ptr1, void* ptr2, int exCode) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setPtrValue("ptr", ptr1); |
| | | pAny->setPtrValue("ptr1", ptr1); |
| | | pAny->setPtrValue("ptr2", ptr2); |
| | | pAny->setIntValue("exCode", exCode); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CModel::notifyMesMsg(int code, int stream, int function, const char* pszText) |
| | | { |
| | | if (m_pObservableEmitter != NULL) { |
| | | IAny* pAny = RX_AllocaAny(); |
| | | if (pAny != NULL) { |
| | | pAny->addRef(); |
| | | pAny->setCode(code); |
| | | pAny->setIntValue("stream", stream); |
| | | pAny->setIntValue("function", function); |
| | | pAny->setStringValue("text", pszText); |
| | | m_pObservableEmitter->onNext(pAny); |
| | | pAny->release(); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CHsmsActive.h" |
| | | |
| | | class CModel |
| | | { |
| | | public: |
| | | CModel(); |
| | | ~CModel(); |
| | | |
| | | public: |
| | | IObservable* getObservable(); |
| | | void setWorkDir(const char* pszWorkDir); |
| | | int init(); |
| | | int term(); |
| | | int connectEq(const char* pszIp, int port); |
| | | int disconnect(); |
| | | |
| | | public: |
| | | int notify(int code); |
| | | int notifyPtr(int code, void* ptr = NULL); |
| | | int notifyObj(int code, IRxObject* pObj); |
| | | int notifyObjAndPtr(int code, IRxObject* pObj, void* ptr); |
| | | int notifyObjAndInt(int code, IRxObject* pObj1, IRxObject* pObj2, int exCode); |
| | | int notifyInt(int code, int exCode); |
| | | int notifyInt2(int code, int exCode, int exCode2); |
| | | int notifyDouble(int code, double dValue); |
| | | int notifyText(int code, const char* pszText); |
| | | int notifyPtrAndInt(int code, void* ptr1, void* ptr2, int exCode); |
| | | int notifyTextAndInt(int code, const char* pszText, int exCode); |
| | | int notifyMesMsg(int code, int stream, int function, const char* pszText); |
| | | |
| | | public: |
| | | CHsmsActive* m_pHsmsActive; |
| | | |
| | | private: |
| | | IObservable* m_pObservable; |
| | | IObservableEmitter* m_pObservableEmitter; |
| | | CString m_strWorkDir; |
| | | CString m_strDataDir; |
| | | }; |
| | | |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "pch.h" |
| | | #include "CReport.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | | CReport::CReport() |
| | | { |
| | | m_nReportId = 0; |
| | | } |
| | | |
| | | CReport::CReport(unsigned int reportId, std::vector<unsigned int>& vids) |
| | | { |
| | | m_nReportId = reportId; |
| | | for (auto vid : vids) { |
| | | m_vids.push_back(vid); |
| | | } |
| | | } |
| | | |
| | | CReport::~CReport() |
| | | { |
| | | |
| | | } |
| | | |
| | | unsigned int CReport::getReportId() |
| | | { |
| | | return m_nReportId; |
| | | } |
| | | |
| | | BOOL CReport::addVariable(CVariable* pVariable) |
| | | { |
| | | ASSERT(pVariable); |
| | | if (getVariable(pVariable->getVarialbleId()) != nullptr) { |
| | | return FALSE; |
| | | } |
| | | |
| | | m_variabels.push_back(pVariable); |
| | | return TRUE; |
| | | } |
| | | |
| | | BOOL CReport::deleteVarialble(unsigned int nVarialbleId) |
| | | { |
| | | BOOL bDelete = FALSE; |
| | | for (auto iter = m_variabels.begin(); iter != m_variabels.end(); ++iter) { |
| | | if (nVarialbleId == (*iter)->getVarialbleId()) { |
| | | m_variabels.erase(iter); |
| | | bDelete = TRUE; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return bDelete; |
| | | } |
| | | |
| | | CVariable* CReport::getVariable(unsigned int nVarialbleId) |
| | | { |
| | | for (auto item : m_variabels) { |
| | | if (nVarialbleId == item->getVarialbleId()) { |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | std::vector<CVariable*>& CReport::getVariables() |
| | | { |
| | | return m_variabels; |
| | | } |
| | | |
| | | std::string CReport::getVariablesIdsText() |
| | | { |
| | | std::string strResult, strName; |
| | | for (int i = 0; i < m_vids.size(); i++) { |
| | | strResult += std::to_string(m_vids[i]); |
| | | strResult += "("; |
| | | strResult += (getVariableName(m_vids[i], strName) ? |
| | | strName : _T("null")); |
| | | strResult += ")"; |
| | | if (i != m_vids.size() - 1) { |
| | | strResult += ","; |
| | | } |
| | | } |
| | | |
| | | return strResult; |
| | | } |
| | | |
| | | bool CReport::getVariableName(unsigned int vid, std::string& strName) |
| | | { |
| | | for (auto item : m_variabels) { |
| | | if (item->getVarialbleId() == vid) { |
| | | strName = item->getName(); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CVariable.h" |
| | | #include <vector> |
| | | |
| | | namespace SERVO { |
| | | class CReport |
| | | { |
| | | public: |
| | | CReport(); |
| | | CReport(unsigned int reportId, std::vector<unsigned int>& vids); |
| | | virtual ~CReport(); |
| | | |
| | | public: |
| | | unsigned int getReportId(); |
| | | BOOL addVariable(CVariable* pVariable); |
| | | BOOL deleteVarialble(unsigned int nVarialbleId); |
| | | CVariable* getVariable(unsigned int nVarialbleId); |
| | | std::vector<CVariable*>& getVariables(); |
| | | std::string getVariablesIdsText(); |
| | | bool getVariableName(unsigned int vid, std::string& strName); |
| | | |
| | | private: |
| | | unsigned int m_nReportId; |
| | | std::vector<unsigned int> m_vids; |
| | | std::vector<CVariable*> m_variabels; |
| | | }; |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CTerminalDisplayDlg.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "pch.h" |
| | | #include "EAPSimulator.h" |
| | | #include "CTerminalDisplayDlg.h" |
| | | #include "afxdialogex.h" |
| | | |
| | | |
| | | // CTerminalDisplayDlg å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CTerminalDisplayDlg, CDialogEx) |
| | | |
| | | CTerminalDisplayDlg::CTerminalDisplayDlg(CWnd* pParent /*=nullptr*/) |
| | | : CDialogEx(IDD_DIALOG_TERMINAL_DISPLAY, pParent) |
| | | { |
| | | |
| | | } |
| | | |
| | | CTerminalDisplayDlg::~CTerminalDisplayDlg() |
| | | { |
| | | } |
| | | |
| | | void CTerminalDisplayDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CTerminalDisplayDlg, CDialogEx) |
| | | ON_EN_CHANGE(IDC_EDIT_TEXT, &CTerminalDisplayDlg::OnEnChangeEditText) |
| | | ON_BN_CLICKED(IDC_BUTTON_SEND, &CTerminalDisplayDlg::OnBnClickedButtonSend) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CTerminalDisplayDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CTerminalDisplayDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | |
| | | // æ·»å ç»ç«¯id |
| | | CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_TID); |
| | | pComboBox->InsertString(0, _T("0(å
¨é¨)")); |
| | | pComboBox->InsertString(1, _T("1(ç»ç«¯1)")); |
| | | pComboBox->InsertString(2, _T("2(ç»ç«¯2)")); |
| | | pComboBox->InsertString(3, _T("3(ç»ç«¯3)")); |
| | | pComboBox->InsertString(4, _T("4(ç»ç«¯4)")); |
| | | pComboBox->SetCurSel(0); |
| | | |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | void CTerminalDisplayDlg::OnEnChangeEditText() |
| | | { |
| | | CString strText; |
| | | GetDlgItemText(IDC_EDIT_TEXT, strText); |
| | | GetDlgItem(IDC_BUTTON_SEND)->EnableWindow(!strText.IsEmpty()); |
| | | } |
| | | |
| | | void CTerminalDisplayDlg::OnBnClickedButtonSend() |
| | | { |
| | | CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_TID); |
| | | BYTE tid = (BYTE)pComboBox->GetCurSel(); |
| | | CString strText; |
| | | GetDlgItemText(IDC_EDIT_TEXT, strText); |
| | | |
| | | theApp.m_model.m_pHsmsActive->hsmsTerminalDisplay(tid, (LPTSTR)(LPCTSTR)strText); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | // CTerminalDisplayDlg å¯¹è¯æ¡ |
| | | |
| | | class CTerminalDisplayDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CTerminalDisplayDlg) |
| | | |
| | | public: |
| | | CTerminalDisplayDlg(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | virtual ~CTerminalDisplayDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_DIALOG_TERMINAL_DISPLAY }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnEnChangeEditText(); |
| | | afx_msg void OnBnClickedButtonSend(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "pch.h" |
| | | #include "CVariable.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | | CVariable::CVariable() |
| | | { |
| | | m_nVarialbeId = 0; |
| | | m_format = SVFromat::U1; |
| | | } |
| | | |
| | | CVariable::CVariable(const char* pszId, const char* pszName, const char* pszFormat, const char* pszRemark) |
| | | { |
| | | m_nVarialbeId = atoi(pszId); |
| | | m_strName = pszName; |
| | | m_format = toFormat(pszFormat); |
| | | m_strRemark = pszRemark; |
| | | TRACE("CVariable .....%d,%s,%d,%s\n", m_nVarialbeId, m_strName.c_str(), |
| | | m_format, m_strRemark.c_str()); |
| | | |
| | | } |
| | | |
| | | CVariable::~CVariable() |
| | | { |
| | | |
| | | } |
| | | |
| | | SVFromat CVariable::toFormat(const char* pszFormat) |
| | | { |
| | | if (_strcmpi("U1", pszFormat) == 0) { |
| | | return SVFromat::U1; |
| | | } |
| | | if (_strcmpi("U2", pszFormat) == 0) { |
| | | return SVFromat::U2; |
| | | } |
| | | if (_strcmpi("I2", pszFormat) == 0) { |
| | | return SVFromat::I2; |
| | | } |
| | | if (_strcmpi("A50", pszFormat) == 0) { |
| | | return SVFromat::A50; |
| | | } |
| | | if (_strcmpi("A20", pszFormat) == 0) { |
| | | return SVFromat::A20; |
| | | } |
| | | |
| | | return SVFromat::U1; |
| | | } |
| | | |
| | | |
| | | std::string CVariable::formatToString(SVFromat format) |
| | | { |
| | | if (SVFromat::U1 == format) { |
| | | return "U1"; |
| | | } |
| | | if (SVFromat::U2 == format) { |
| | | return "U1"; |
| | | } |
| | | if (SVFromat::I2 == format) { |
| | | return "I2"; |
| | | } |
| | | if (SVFromat::A50 == format) { |
| | | return "A50"; |
| | | } |
| | | if (SVFromat::A20 == format) { |
| | | return "A20"; |
| | | } |
| | | |
| | | return "U1"; |
| | | } |
| | | |
| | | unsigned int CVariable::getVarialbleId() |
| | | { |
| | | return m_nVarialbeId; |
| | | } |
| | | |
| | | std::string& CVariable::getName() |
| | | { |
| | | return m_strName; |
| | | } |
| | | |
| | | SVFromat CVariable::getFormat() |
| | | { |
| | | return m_format; |
| | | } |
| | | |
| | | std::string& CVariable::getRemark() |
| | | { |
| | | return m_strRemark; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include <string> |
| | | |
| | | |
| | | namespace SERVO { |
| | | // åéæ ¼å¼ |
| | | enum class SVFromat { |
| | | U1 = 0, |
| | | U2, |
| | | I2, |
| | | A20, |
| | | A50 |
| | | }; |
| | | |
| | | class CVariable |
| | | { |
| | | public: |
| | | CVariable(); |
| | | CVariable(const char* pszId, const char* pszName, const char* pszFormat, const char* pszRemark); |
| | | ~CVariable(); |
| | | |
| | | public: |
| | | static SVFromat toFormat(const char* pszFormat); |
| | | static std::string formatToString(SVFromat format); |
| | | unsigned int getVarialbleId(); |
| | | std::string& getName(); |
| | | SVFromat getFormat(); |
| | | std::string& getRemark(); |
| | | |
| | | private: |
| | | unsigned int m_nVarialbeId; |
| | | std::string m_strName; |
| | | SVFromat m_format; |
| | | std::string m_strRemark; |
| | | }; |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | |
| | | #define RX_CODE_TEST 0 |
| | | #define RX_CODE_LOG 1000 |
| | | #define RX_CODE_ACTIVE_STATUS_CHANGED 1001 |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "pch.h" |
| | | #include "Context.h" |
| | | #include <dbghelp.h> |
| | | |
| | | #pragma comment(lib, "dbghelp.lib") |
| | | |
| | | |
| | | void PrintStackTrace() |
| | | { |
| | | void* stack[62]; // æå¤æ62å± |
| | | USHORT frames = CaptureStackBackTrace(0, 62, stack, NULL); |
| | | |
| | | HANDLE process = GetCurrentProcess(); |
| | | SymInitialize(process, NULL, TRUE); |
| | | for (USHORT i = 0; i < frames; ++i) { |
| | | DWORD64 address = (DWORD64)(stack[i]); |
| | | char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)]; |
| | | PSYMBOL_INFO symbol = (PSYMBOL_INFO)buffer; |
| | | symbol->SizeOfStruct = sizeof(SYMBOL_INFO); |
| | | symbol->MaxNameLen = MAX_SYM_NAME; |
| | | |
| | | if (SymFromAddr(process, address, 0, symbol)) { |
| | | TRACE(">>>> name:%s\n", symbol->Name); |
| | | } |
| | | else { |
| | | TRACE(">>>> name:%s\n", "SymFromAddr failed"); |
| | | } |
| | | } |
| | | |
| | | SymCleanup(process); |
| | | } |
| | | CContext::CContext() |
| | | { |
| | | m_onReleaseCallback = nullptr; |
| | | m_nRef = 0; |
| | | m_nRetCode = 0; |
| | | m_hEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL); |
| | | InitializeCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | |
| | | CContext::~CContext() |
| | | { |
| | | if (m_hEvent != NULL) { |
| | | CloseHandle(m_hEvent); |
| | | m_hEvent = NULL; |
| | | } |
| | | DeleteCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | void CContext::setOnRelease(ONRELEASECALLBACK fOnRelease) |
| | | { |
| | | m_onReleaseCallback = fOnRelease; |
| | | } |
| | | |
| | | int CContext::addRef() |
| | | { |
| | | Lock(); |
| | | m_nRef++; |
| | | Unlock(); |
| | | |
| | | return m_nRef; |
| | | } |
| | | |
| | | int CContext::release() |
| | | { |
| | | Lock(); |
| | | if (m_nRef > 0) { |
| | | m_nRef--; |
| | | BOOL bRefCount0 = m_nRef == 0; |
| | | Unlock(); |
| | | |
| | | if (bRefCount0 && m_onReleaseCallback != nullptr) { |
| | | m_onReleaseCallback(this); |
| | | } |
| | | } |
| | | else { |
| | | Unlock(); |
| | | } |
| | | |
| | | return m_nRef; |
| | | } |
| | | |
| | | void CContext::setRetCode(int code) |
| | | { |
| | | m_nRetCode = code; |
| | | } |
| | | |
| | | int CContext::getRetCode() |
| | | { |
| | | return m_nRetCode; |
| | | } |
| | | |
| | | void CContext::setRetMsg(const char* pszMsg) |
| | | { |
| | | m_strRetMsg = pszMsg; |
| | | } |
| | | |
| | | std::string& CContext::getRetMsg() |
| | | { |
| | | return m_strRetMsg; |
| | | } |
| | | |
| | | HANDLE CContext::getEventHandle() |
| | | { |
| | | return m_hEvent; |
| | | } |
| | | |
| | | void CContext::setEvent() |
| | | { |
| | | if (m_hEvent != NULL) { |
| | | SetEvent(m_hEvent); |
| | | } |
| | | } |
| | | |
| | | void CContext::resetEvent() |
| | | { |
| | | if (m_hEvent != NULL) { |
| | | ResetEvent(m_hEvent); |
| | | } |
| | | } |
| | | |
| | | void CContext::ReadString(CArchive& ar, std::string& string) |
| | | { |
| | | CString strTemp; |
| | | ar >> strTemp; |
| | | string = (LPTSTR)(LPCTSTR)strTemp; |
| | | } |
| | | |
| | | void CContext::WriteString(CArchive& ar, std::string& string) |
| | | { |
| | | CString strTemp = string.c_str(); |
| | | ar << strTemp; |
| | | } |
| | | |
| | | void CContext::createDir(CString strDir) |
| | | { |
| | | int lastIndex = 0; |
| | | int index = strDir.Find(_T("\\"), lastIndex); |
| | | while (index > 0) { |
| | | CString strTempDir = strDir.Left(index); |
| | | CreateDirectory(strTempDir, NULL); |
| | | |
| | | lastIndex = index + 1; |
| | | index = strDir.Find(_T("\\"), lastIndex); |
| | | } |
| | | CreateDirectory(strDir, NULL); |
| | | } |
| | | |
| | | BOOL CContext::IsBoxId(CString& strId) |
| | | { |
| | | //'W20'å¼å¤´ï¼åæ°ç¬¬äºä½ä¸º'Z'çå符串 |
| | | if (strId.GetLength() < 8) { |
| | | return FALSE; |
| | | } |
| | | |
| | | if (strId.Left(3).Compare(_T("W20")) != 0) { |
| | | return FALSE; |
| | | } |
| | | |
| | | if (strId.Right(5).GetAt(0) != (char)'Z') { |
| | | return FALSE; |
| | | } |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | BOOL CContext::IsLotId(CString& strId) |
| | | { |
| | | //'N20'å¼å¤´ï¼åæ°ç¬¬äºä½ä¸º'Z'çå符串 |
| | | if (strId.GetLength() < 8) { |
| | | return FALSE; |
| | | } |
| | | |
| | | if (strId.Left(3).Compare(_T("N20")) != 0) { |
| | | return FALSE; |
| | | } |
| | | |
| | | if (strId.Right(5).GetAt(0) != (char)'Z') { |
| | | return FALSE; |
| | | } |
| | | |
| | | return TRUE; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "Common.h" |
| | | #include <functional> |
| | | |
| | | |
| | | typedef std::function<void(void*)> ONRELEASECALLBACK; |
| | | class CContext : public IRxObject |
| | | { |
| | | public: |
| | | CContext(); |
| | | virtual ~CContext(); |
| | | |
| | | public: |
| | | void setOnRelease(ONRELEASECALLBACK fOnRelease); |
| | | int addRef(); |
| | | int release(); |
| | | |
| | | public: |
| | | virtual std::string& getClassName() = 0; |
| | | virtual std::string toString() = 0; |
| | | void setRetCode(int code); |
| | | int getRetCode(); |
| | | void setRetMsg(const char* pszMsg); |
| | | std::string& getRetMsg(); |
| | | HANDLE getEventHandle(); |
| | | void setEvent(); |
| | | void resetEvent(); |
| | | static void createDir(CString strDir); |
| | | |
| | | protected: |
| | | inline void Lock() { EnterCriticalSection(&m_criticalSection); } |
| | | inline void Unlock() { LeaveCriticalSection(&m_criticalSection); } |
| | | void ReadString(CArchive& ar, std::string& string); |
| | | void WriteString(CArchive& ar, std::string& string); |
| | | static BOOL IsBoxId(CString& strId); |
| | | static BOOL IsLotId(CString& strId); |
| | | |
| | | private: |
| | | ONRELEASECALLBACK m_onReleaseCallback; |
| | | int m_nRef; |
| | | CRITICAL_SECTION m_criticalSection; |
| | | |
| | | protected: |
| | | int m_nRetCode; |
| | | std::string m_strRetMsg; |
| | | HANDLE m_hEvent; |
| | | }; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | |  |
| | | // EAPSimulator.cpp: å®ä¹åºç¨ç¨åºçç±»è¡ä¸ºã |
| | | // |
| | | |
| | | #include "pch.h" |
| | | #include "framework.h" |
| | | #include "EAPSimulator.h" |
| | | #include "EAPSimulatorDlg.h" |
| | | |
| | | #ifdef _DEBUG |
| | | #define new DEBUG_NEW |
| | | #endif |
| | | |
| | | |
| | | // CEAPSimulatorApp |
| | | |
| | | BEGIN_MESSAGE_MAP(CEAPSimulatorApp, CWinApp) |
| | | ON_COMMAND(ID_HELP, &CWinApp::OnHelp) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CEAPSimulatorApp æé |
| | | |
| | | CEAPSimulatorApp::CEAPSimulatorApp() |
| | | { |
| | | // æ¯æéæ°å¯å¨ç®¡çå¨ |
| | | m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART; |
| | | |
| | | // TODO: 卿¤å¤æ·»å æé 代ç ï¼ |
| | | // å°ææéè¦çåå§åæ¾ç½®å¨ InitInstance ä¸ |
| | | } |
| | | |
| | | |
| | | // å¯ä¸ç CEAPSimulatorApp 对象 |
| | | |
| | | CEAPSimulatorApp theApp; |
| | | |
| | | |
| | | // CEAPSimulatorApp åå§å |
| | | |
| | | BOOL CEAPSimulatorApp::InitInstance() |
| | | { |
| | | // 妿ä¸ä¸ªè¿è¡å¨ Windows XP ä¸çåºç¨ç¨åºæ¸
åæå®è¦ |
| | | // ä½¿ç¨ ComCtl32.dll çæ¬ 6 ææ´é«çæ¬æ¥å¯ç¨å¯è§åæ¹å¼ï¼ |
| | | //åéè¦ InitCommonControlsEx()ã å¦åï¼å°æ æ³å建çªå£ã |
| | | INITCOMMONCONTROLSEX InitCtrls; |
| | | InitCtrls.dwSize = sizeof(InitCtrls); |
| | | // å°å®è®¾ç½®ä¸ºå
æ¬ææè¦å¨åºç¨ç¨åºä¸ä½¿ç¨ç |
| | | // å
Œ
±æ§ä»¶ç±»ã |
| | | InitCtrls.dwICC = ICC_WIN95_CLASSES; |
| | | InitCommonControlsEx(&InitCtrls); |
| | | |
| | | CWinApp::InitInstance(); |
| | | |
| | | |
| | | AfxEnableControlContainer(); |
| | | |
| | | // å建 shell 管çå¨ï¼ä»¥é²å¯¹è¯æ¡å
å« |
| | | // ä»»ä½ shell æ è§å¾æ§ä»¶æ shell å表è§å¾æ§ä»¶ã |
| | | CShellManager *pShellManager = new CShellManager; |
| | | |
| | | // æ¿æ´»âWindows Nativeâè§è§ç®¡çå¨ï¼ä»¥ä¾¿å¨ MFC æ§ä»¶ä¸å¯ç¨ä¸»é¢ |
| | | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); |
| | | |
| | | // æ ååå§å |
| | | // 妿æªä½¿ç¨è¿äºåè½å¹¶å¸æåå° |
| | | // æç»å¯æ§è¡æä»¶ç大å°ï¼ååºç§»é¤ä¸å |
| | | // ä¸éè¦çç¹å®åå§åä¾ç¨ |
| | | // æ´æ¹ç¨äºåå¨è®¾ç½®ç注å表项 |
| | | // TODO: åºéå½ä¿®æ¹è¯¥åç¬¦ä¸²ï¼ |
| | | // ä¾å¦ä¿®æ¹ä¸ºå
¬å¸æç»ç»å |
| | | SetRegistryKey(_T("åºç¨ç¨åºå导çæçæ¬å°åºç¨ç¨åº")); |
| | | |
| | | |
| | | // æ¬ç¨åºæä»¶ç®å½ |
| | | TCHAR sDrive[_MAX_DRIVE]; |
| | | TCHAR sDir[_MAX_DIR]; |
| | | TCHAR sFilename[_MAX_FNAME], sAppFilename[_MAX_FNAME]; |
| | | TCHAR sExt[_MAX_EXT]; |
| | | GetModuleFileName(AfxGetInstanceHandle(), sAppFilename, _MAX_FNAME); |
| | | _tsplitpath_s(sAppFilename, sDrive, sDir, sFilename, sExt); |
| | | m_strAppDir = CString(sDrive) + CString(sDir); |
| | | m_strAppFile = CString(sFilename); |
| | | |
| | | |
| | | // åå§åRxåº |
| | | RX_Init(); |
| | | HSMS_Initialize(); |
| | | |
| | | |
| | | |
| | | CEAPSimulatorDlg dlg; |
| | | m_pMainWnd = &dlg; |
| | | INT_PTR nResponse = dlg.DoModal(); |
| | | if (nResponse == IDOK) |
| | | { |
| | | // TODO: 卿¤æ¾ç½®å¤ç使¶ç¨ |
| | | // âç¡®å®âæ¥å
³éå¯¹è¯æ¡ç代ç |
| | | } |
| | | else if (nResponse == IDCANCEL) |
| | | { |
| | | // TODO: 卿¤æ¾ç½®å¤ç使¶ç¨ |
| | | // âåæ¶âæ¥å
³éå¯¹è¯æ¡ç代ç |
| | | } |
| | | else if (nResponse == -1) |
| | | { |
| | | TRACE(traceAppMsg, 0, "è¦å: å¯¹è¯æ¡å建失败ï¼åºç¨ç¨åºå°æå¤ç»æ¢ã\n"); |
| | | TRACE(traceAppMsg, 0, "è¦å: 妿æ¨å¨å¯¹è¯æ¡ä¸ä½¿ç¨ MFC æ§ä»¶ï¼åæ æ³ #define _AFX_NO_MFC_CONTROLS_IN_DIALOGSã\n"); |
| | | } |
| | | |
| | | // å é¤ä¸é¢å建ç shell 管çå¨ã |
| | | if (pShellManager != nullptr) |
| | | { |
| | | delete pShellManager; |
| | | } |
| | | |
| | | #if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS) |
| | | ControlBarCleanUp(); |
| | | #endif |
| | | |
| | | // ç±äºå¯¹è¯æ¡å·²å
³éï¼æä»¥å°è¿å FALSE 以便éåºåºç¨ç¨åºï¼ |
| | | // è䏿¯å¯å¨åºç¨ç¨åºçæ¶æ¯æ³µã |
| | | return FALSE; |
| | | } |
| | | |
| | | |
| | | int CEAPSimulatorApp::ExitInstance() |
| | | { |
| | | HSMS_Term(); |
| | | RX_Term(); |
| | | |
| | | return CWinApp::ExitInstance(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | |  |
| | | // EAPSimulator.h: PROJECT_NAME åºç¨ç¨åºç主头æä»¶ |
| | | // |
| | | |
| | | #pragma once |
| | | |
| | | #ifndef __AFXWIN_H__ |
| | | #error "å¨å
嫿¤æä»¶ä¹åå
å« 'pch.h' ä»¥çæ PCH" |
| | | #endif |
| | | |
| | | #include "resource.h" // ä¸»ç¬¦å· |
| | | #include "CModel.h" |
| | | |
| | | |
| | | // CEAPSimulatorApp: |
| | | // æå
³æ¤ç±»çå®ç°ï¼è¯·åé
EAPSimulator.cpp |
| | | // |
| | | |
| | | class CEAPSimulatorApp : public CWinApp |
| | | { |
| | | public: |
| | | CEAPSimulatorApp(); |
| | | |
| | | |
| | | public: |
| | | CModel m_model; |
| | | CString m_strAppDir; |
| | | CString m_strAppFile; |
| | | |
| | | // éå |
| | | public: |
| | | virtual BOOL InitInstance(); |
| | | |
| | | // å®ç° |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | virtual int ExitInstance(); |
| | | }; |
| | | |
| | | extern CEAPSimulatorApp theApp; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <ItemGroup Label="ProjectConfigurations"> |
| | | <ProjectConfiguration Include="Debug|Win32"> |
| | | <Configuration>Debug</Configuration> |
| | | <Platform>Win32</Platform> |
| | | </ProjectConfiguration> |
| | | <ProjectConfiguration Include="Release|Win32"> |
| | | <Configuration>Release</Configuration> |
| | | <Platform>Win32</Platform> |
| | | </ProjectConfiguration> |
| | | <ProjectConfiguration Include="Debug|x64"> |
| | | <Configuration>Debug</Configuration> |
| | | <Platform>x64</Platform> |
| | | </ProjectConfiguration> |
| | | <ProjectConfiguration Include="Release|x64"> |
| | | <Configuration>Release</Configuration> |
| | | <Platform>x64</Platform> |
| | | </ProjectConfiguration> |
| | | </ItemGroup> |
| | | <PropertyGroup Label="Globals"> |
| | | <VCProjectVersion>16.0</VCProjectVersion> |
| | | <ProjectGuid>{9EA43050-B71C-47A7-AC90-F0D7A88C5F50}</ProjectGuid> |
| | | <Keyword>MFCProj</Keyword> |
| | | <RootNamespace>EAPSimulator</RootNamespace> |
| | | <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> |
| | | </PropertyGroup> |
| | | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
| | | <ConfigurationType>Application</ConfigurationType> |
| | | <UseDebugLibraries>true</UseDebugLibraries> |
| | | <PlatformToolset>v142</PlatformToolset> |
| | | <CharacterSet>Unicode</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
| | | <ConfigurationType>Application</ConfigurationType> |
| | | <UseDebugLibraries>false</UseDebugLibraries> |
| | | <PlatformToolset>v142</PlatformToolset> |
| | | <WholeProgramOptimization>true</WholeProgramOptimization> |
| | | <CharacterSet>Unicode</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
| | | <ConfigurationType>Application</ConfigurationType> |
| | | <UseDebugLibraries>true</UseDebugLibraries> |
| | | <PlatformToolset>v142</PlatformToolset> |
| | | <CharacterSet>MultiByte</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
| | | <ConfigurationType>Application</ConfigurationType> |
| | | <UseDebugLibraries>false</UseDebugLibraries> |
| | | <PlatformToolset>v142</PlatformToolset> |
| | | <WholeProgramOptimization>true</WholeProgramOptimization> |
| | | <CharacterSet>Unicode</CharacterSet> |
| | | <UseOfMfc>Dynamic</UseOfMfc> |
| | | </PropertyGroup> |
| | | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
| | | <ImportGroup Label="ExtensionSettings"> |
| | | </ImportGroup> |
| | | <ImportGroup Label="Shared"> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
| | | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
| | | </ImportGroup> |
| | | <PropertyGroup Label="UserMacros" /> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
| | | <LinkIncremental>true</LinkIncremental> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| | | <LinkIncremental>true</LinkIncremental> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
| | | <LinkIncremental>false</LinkIncremental> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
| | | <LinkIncremental>false</LinkIncremental> |
| | | </PropertyGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
| | | <ClCompile> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <SDLCheck>true</SDLCheck> |
| | | <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <ValidateAllParameters>true</ValidateAllParameters> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0804</Culture> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| | | <ClCompile> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <SDLCheck>true</SDLCheck> |
| | | <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <ValidateAllParameters>true</ValidateAllParameters> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0804</Culture> |
| | | <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
| | | <ClCompile> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <FunctionLevelLinking>true</FunctionLevelLinking> |
| | | <IntrinsicFunctions>true</IntrinsicFunctions> |
| | | <SDLCheck>true</SDLCheck> |
| | | <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
| | | <OptimizeReferences>true</OptimizeReferences> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <ValidateAllParameters>true</ValidateAllParameters> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0804</Culture> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
| | | <ClCompile> |
| | | <PrecompiledHeader>Use</PrecompiledHeader> |
| | | <WarningLevel>Level3</WarningLevel> |
| | | <FunctionLevelLinking>true</FunctionLevelLinking> |
| | | <IntrinsicFunctions>true</IntrinsicFunctions> |
| | | <SDLCheck>true</SDLCheck> |
| | | <PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> |
| | | </ClCompile> |
| | | <Link> |
| | | <SubSystem>Windows</SubSystem> |
| | | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
| | | <OptimizeReferences>true</OptimizeReferences> |
| | | </Link> |
| | | <Midl> |
| | | <MkTypLibCompatible>false</MkTypLibCompatible> |
| | | <ValidateAllParameters>true</ValidateAllParameters> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | </Midl> |
| | | <ResourceCompile> |
| | | <Culture>0x0804</Culture> |
| | | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ResourceCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="CAddIDSDlg.h" /> |
| | | <ClInclude Include="CCollectionEvent.h" /> |
| | | <ClInclude Include="CDefineReportsDlg.h" /> |
| | | <ClInclude Include="CEDEventReportDlg.h" /> |
| | | <ClInclude Include="CHsmsActive.h" /> |
| | | <ClInclude Include="CLinkReportDetailDlg.h" /> |
| | | <ClInclude Include="CLinkReportDlg.h" /> |
| | | <ClInclude Include="CModel.h" /> |
| | | <ClInclude Include="Common.h" /> |
| | | <ClInclude Include="Context.h" /> |
| | | <ClInclude Include="CReport.h" /> |
| | | <ClInclude Include="CTerminalDisplayDlg.h" /> |
| | | <ClInclude Include="CVariable.h" /> |
| | | <ClInclude Include="EAPSimulator.h" /> |
| | | <ClInclude Include="EAPSimulatorDlg.h" /> |
| | | <ClInclude Include="framework.h" /> |
| | | <ClInclude Include="Log.h" /> |
| | | <ClInclude Include="LogEdit.h" /> |
| | | <ClInclude Include="pch.h" /> |
| | | <ClInclude Include="Resource.h" /> |
| | | <ClInclude Include="targetver.h" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClCompile Include="CAddIDSDlg.cpp" /> |
| | | <ClCompile Include="CCollectionEvent.cpp" /> |
| | | <ClCompile Include="CDefineReportsDlg.cpp" /> |
| | | <ClCompile Include="CEDEventReportDlg.cpp" /> |
| | | <ClCompile Include="CHsmsActive.cpp" /> |
| | | <ClCompile Include="CLinkReportDetailDlg.cpp" /> |
| | | <ClCompile Include="CLinkReportDlg.cpp" /> |
| | | <ClCompile Include="CModel.cpp" /> |
| | | <ClCompile Include="Context.cpp" /> |
| | | <ClCompile Include="CReport.cpp" /> |
| | | <ClCompile Include="CTerminalDisplayDlg.cpp" /> |
| | | <ClCompile Include="CVariable.cpp" /> |
| | | <ClCompile Include="EAPSimulator.cpp" /> |
| | | <ClCompile Include="EAPSimulatorDlg.cpp" /> |
| | | <ClCompile Include="Log.cpp" /> |
| | | <ClCompile Include="LogEdit.cpp" /> |
| | | <ClCompile Include="pch.cpp"> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |
| | | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> |
| | | </ClCompile> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="EAPSimulator.rc" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="res\EAPSimulator.rc2" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Image Include="res\EAPSimulator.ico" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Manifest Include="res\application.exe.manifest" /> |
| | | </ItemGroup> |
| | | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
| | | <ImportGroup Label="ExtensionTargets"> |
| | | </ImportGroup> |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <ItemGroup> |
| | | <Filter Include="æºæä»¶"> |
| | | <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> |
| | | <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions> |
| | | </Filter> |
| | | <Filter Include="头æä»¶"> |
| | | <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> |
| | | <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions> |
| | | </Filter> |
| | | <Filter Include="èµæºæä»¶"> |
| | | <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> |
| | | <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> |
| | | </Filter> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="EAPSimulator.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="EAPSimulatorDlg.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="framework.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="targetver.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Resource.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="pch.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Log.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="LogEdit.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CModel.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Context.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CHsmsActive.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="Common.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CTerminalDisplayDlg.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CEDEventReportDlg.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CDefineReportsDlg.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CAddIDSDlg.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CLinkReportDlg.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CCollectionEvent.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CReport.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CVariable.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CLinkReportDetailDlg.h"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClCompile Include="EAPSimulator.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="EAPSimulatorDlg.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="pch.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Log.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="LogEdit.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CModel.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="Context.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CHsmsActive.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CTerminalDisplayDlg.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CEDEventReportDlg.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CDefineReportsDlg.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CAddIDSDlg.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CLinkReportDlg.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CCollectionEvent.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CReport.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CVariable.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CLinkReportDetailDlg.cpp"> |
| | | <Filter>æºæä»¶</Filter> |
| | | </ClCompile> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="EAPSimulator.rc"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </ResourceCompile> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="res\EAPSimulator.rc2"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Image Include="res\EAPSimulator.ico"> |
| | | <Filter>èµæºæä»¶</Filter> |
| | | </Image> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Manifest Include="res\application.exe.manifest" /> |
| | | </ItemGroup> |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <PropertyGroup> |
| | | <RESOURCE_FILE>EAPSimulator.rc</RESOURCE_FILE> |
| | | </PropertyGroup> |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | |  |
| | | // EAPSimulatorDlg.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "pch.h" |
| | | #include "framework.h" |
| | | #include "EAPSimulator.h" |
| | | #include "EAPSimulatorDlg.h" |
| | | #include "afxdialogex.h" |
| | | #include "Common.h" |
| | | #include <regex> |
| | | #include "CTerminalDisplayDlg.h" |
| | | #include "CEDEventReportDlg.h" |
| | | #include "CDefineReportsDlg.h" |
| | | #include "CLinkReportDlg.h" |
| | | |
| | | |
| | | #ifdef _DEBUG |
| | | #define new DEBUG_NEW |
| | | #endif |
| | | |
| | | |
| | | // ç¨äºåºç¨ç¨åºâå
³äºâèå项ç CAboutDlg å¯¹è¯æ¡ |
| | | |
| | | class CAboutDlg : public CDialogEx |
| | | { |
| | | public: |
| | | CAboutDlg(); |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_ABOUTBOX }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | // å®ç° |
| | | protected: |
| | | DECLARE_MESSAGE_MAP() |
| | | }; |
| | | |
| | | CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX) |
| | | { |
| | | } |
| | | |
| | | void CAboutDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | } |
| | | |
| | | BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CEAPSimulatorDlg å¯¹è¯æ¡ |
| | | |
| | | |
| | | |
| | | CEAPSimulatorDlg::CEAPSimulatorDlg(CWnd* pParent /*=nullptr*/) |
| | | : CDialogEx(IDD_EAPSIMULATOR_DIALOG, pParent) |
| | | { |
| | | m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); |
| | | m_pObserver = nullptr; |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_EDIT_LOG, m_logEdit); |
| | | } |
| | | |
| | | BEGIN_MESSAGE_MAP(CEAPSimulatorDlg, CDialogEx) |
| | | ON_WM_SYSCOMMAND() |
| | | ON_WM_PAINT() |
| | | ON_WM_QUERYDRAGICON() |
| | | ON_WM_DESTROY() |
| | | ON_BN_CLICKED(IDC_BUTTON_CONNECT, &CEAPSimulatorDlg::OnBnClickedButtonConnect) |
| | | ON_BN_CLICKED(IDC_BUTTON_DISCONNECT, &CEAPSimulatorDlg::OnBnClickedButtonDisconnect) |
| | | ON_BN_CLICKED(IDC_BUTTON_ARE_YOU_THERE, &CEAPSimulatorDlg::OnBnClickedButtonAreYouThere) |
| | | ON_BN_CLICKED(IDC_BUTTON_DATETIME_SYNC, &CEAPSimulatorDlg::OnBnClickedButtonDatetimeSync) |
| | | ON_BN_CLICKED(IDC_BUTTON_TERMINAL_DISPLAY, &CEAPSimulatorDlg::OnBnClickedButtonTerminalDisplay) |
| | | ON_BN_CLICKED(IDC_BUTTON_ED_EVENT_REPORT, &CEAPSimulatorDlg::OnBnClickedButtonEdEventReport) |
| | | ON_BN_CLICKED(IDC_BUTTON_ED_ALARM_REPORT, &CEAPSimulatorDlg::OnBnClickedButtonEdAlarmReport) |
| | | ON_BN_CLICKED(IDC_BUTTON_DEFINE_REPORT, &CEAPSimulatorDlg::OnBnClickedButtonDefineReport) |
| | | ON_BN_CLICKED(IDC_BUTTON_LINE_REPORT, &CEAPSimulatorDlg::OnBnClickedButtonLineReport) |
| | | ON_BN_CLICKED(IDC_BUTTON_CONFIGURE_SPOOLING, &CEAPSimulatorDlg::OnBnClickedButtonConfigureSpooling) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CEAPSimulatorDlg æ¶æ¯å¤çç¨åº |
| | | |
| | | void CEAPSimulatorDlg::InitRxWindow() |
| | | { |
| | | /* code */ |
| | | // 订é
æ°æ® |
| | | IRxWindows* pRxWindows = RX_GetRxWindows(); |
| | | pRxWindows->enableLog(5); |
| | | if (m_pObserver == NULL) { |
| | | m_pObserver = pRxWindows->allocObserver([&](IAny* pAny) -> void { |
| | | // onNext |
| | | pAny->addRef(); |
| | | int code = pAny->getCode(); |
| | | if (RX_CODE_LOG == code && ::IsWindow(m_hWnd)) { |
| | | const char* pszLogMsg; |
| | | int level; |
| | | if (pAny->getStringValue("text", pszLogMsg) |
| | | && pAny->getIntValue("exCode", level)) { |
| | | CString strText = pszLogMsg; |
| | | strText.Replace("\n", "\r\n"); |
| | | AppendLog(level, (LPTSTR)(LPCTSTR)strText); |
| | | } |
| | | } |
| | | else if (RX_CODE_ACTIVE_STATUS_CHANGED == code) { |
| | | int state; |
| | | if (pAny->getIntValue("exCode", state)) { |
| | | if ((ACTIVESTATE)state == ACTIVESTATE::SELECTED) { |
| | | SetGroup2Enabled(TRUE); |
| | | } |
| | | if ((ACTIVESTATE)state == ACTIVESTATE::NOT_CONNECTED) { |
| | | SetGroup2Enabled(FALSE); |
| | | SetGroup1Enabled(TRUE); |
| | | } |
| | | } |
| | | } |
| | | |
| | | pAny->release(); |
| | | }, [&]() -> void { |
| | | // onComplete |
| | | }, [&](IThrowable* pThrowable) -> void { |
| | | // onErrorm |
| | | pThrowable->printf(); |
| | | }); |
| | | |
| | | theApp.m_model.getObservable()->observeOn(pRxWindows->mainThread()) |
| | | ->subscribe(m_pObserver); |
| | | } |
| | | |
| | | theApp.m_model.init(); |
| | | } |
| | | |
| | | BOOL CEAPSimulatorDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | // å°âå
³äº...âèå项添å å°ç³»ç»èåä¸ã |
| | | |
| | | // IDM_ABOUTBOX å¿
é¡»å¨ç³»ç»å½ä»¤èå´å
ã |
| | | ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); |
| | | ASSERT(IDM_ABOUTBOX < 0xF000); |
| | | |
| | | CMenu* pSysMenu = GetSystemMenu(FALSE); |
| | | if (pSysMenu != nullptr) |
| | | { |
| | | BOOL bNameValid; |
| | | CString strAboutMenu; |
| | | bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX); |
| | | ASSERT(bNameValid); |
| | | if (!strAboutMenu.IsEmpty()) |
| | | { |
| | | pSysMenu->AppendMenu(MF_SEPARATOR); |
| | | pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); |
| | | } |
| | | } |
| | | |
| | | // 设置æ¤å¯¹è¯æ¡ç徿 ã å½åºç¨ç¨åºä¸»çªå£ä¸æ¯å¯¹è¯æ¡æ¶ï¼æ¡æ¶å°èªå¨ |
| | | // æ§è¡æ¤æä½ |
| | | SetIcon(m_hIcon, TRUE); // è®¾ç½®å¤§å¾æ |
| | | SetIcon(m_hIcon, FALSE); // 设置å°å¾æ |
| | | |
| | | SetDlgItemText(IDC_EDIT_IP, _T("127.0.0.1")); |
| | | SetDlgItemInt(IDC_EDIT_PORT, 7000); |
| | | SetGroup2Enabled(FALSE); |
| | | SetGroup1Enabled(TRUE); |
| | | ::SetProp(GetDlgItem(IDC_BUTTON_ED_ALARM_REPORT)->m_hWnd, _T("Enable"), (void*)1); |
| | | |
| | | |
| | | // log edit |
| | | m_logEdit.SetMaxLineCount(8000); |
| | | m_logEdit.SetLimitText(-1); |
| | | InitRxWindow(); |
| | | |
| | | return TRUE; // é¤éå°ç¦ç¹è®¾ç½®å°æ§ä»¶ï¼å¦åè¿å TRUE |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnSysCommand(UINT nID, LPARAM lParam) |
| | | { |
| | | if ((nID & 0xFFF0) == IDM_ABOUTBOX) |
| | | { |
| | | CAboutDlg dlgAbout; |
| | | dlgAbout.DoModal(); |
| | | } |
| | | else |
| | | { |
| | | CDialogEx::OnSysCommand(nID, lParam); |
| | | } |
| | | } |
| | | |
| | | // 妿åå¯¹è¯æ¡æ·»å æå°åæé®ï¼åéè¦ä¸é¢ç代ç |
| | | // æ¥ç»å¶è¯¥å¾æ ã 对äºä½¿ç¨ææ¡£/è§å¾æ¨¡åç MFC åºç¨ç¨åºï¼ |
| | | // è¿å°ç±æ¡æ¶èªå¨å®æã |
| | | |
| | | void CEAPSimulatorDlg::OnPaint() |
| | | { |
| | | if (IsIconic()) |
| | | { |
| | | CPaintDC dc(this); // ç¨äºç»å¶ç设å¤ä¸ä¸æ |
| | | |
| | | SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); |
| | | |
| | | // ä½¿å¾æ å¨å·¥ä½åºç©å½¢ä¸å±
ä¸ |
| | | int cxIcon = GetSystemMetrics(SM_CXICON); |
| | | int cyIcon = GetSystemMetrics(SM_CYICON); |
| | | CRect rect; |
| | | GetClientRect(&rect); |
| | | int x = (rect.Width() - cxIcon + 1) / 2; |
| | | int y = (rect.Height() - cyIcon + 1) / 2; |
| | | |
| | | // ç»å¶å¾æ |
| | | dc.DrawIcon(x, y, m_hIcon); |
| | | } |
| | | else |
| | | { |
| | | CDialogEx::OnPaint(); |
| | | } |
| | | } |
| | | |
| | | //å½ç¨æ·æå¨æå°åçªå£æ¶ç³»ç»è°ç¨æ¤å½æ°åå¾å
æ |
| | | //æ¾ç¤ºã |
| | | HCURSOR CEAPSimulatorDlg::OnQueryDragIcon() |
| | | { |
| | | return static_cast<HCURSOR>(m_hIcon); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::AppendLog(int level, const char* pszText) |
| | | { |
| | | if (!::IsWindow(m_logEdit.m_hWnd)) { |
| | | return; |
| | | } |
| | | m_logEdit.AppendText(pszText); |
| | | } |
| | | |
| | | |
| | | |
| | | void CEAPSimulatorDlg::OnDestroy() |
| | | { |
| | | CDialogEx::OnDestroy(); |
| | | |
| | | ASSERT(m_pObserver != NULL); |
| | | m_pObserver->unsubscribe(); |
| | | m_pObserver = NULL; |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::SetGroup1Enabled(bool enabled) |
| | | { |
| | | GetDlgItem(IDC_EDIT_IP)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_EDIT_PORT)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_CONNECT)->EnableWindow(enabled); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::SetGroup2Enabled(bool enabled) |
| | | { |
| | | GetDlgItem(IDC_BUTTON_DISCONNECT)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_ARE_YOU_THERE)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_DATETIME_SYNC)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_TERMINAL_DISPLAY)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_ED_EVENT_REPORT)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_ED_ALARM_REPORT)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_DEFINE_REPORT)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_LINE_REPORT)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_CONFIGURE_SPOOLING)->EnableWindow(enabled); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonConnect() |
| | | { |
| | | CString strIp; |
| | | UINT port; |
| | | GetDlgItemText(IDC_EDIT_IP, strIp); |
| | | port = GetDlgItemInt(IDC_EDIT_PORT); |
| | | theApp.m_model.connectEq((LPTSTR)(LPCTSTR)strIp, port); |
| | | SetGroup1Enabled(FALSE); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonDisconnect() |
| | | { |
| | | theApp.m_model.disconnect(); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonAreYouThere() |
| | | { |
| | | theApp.m_model.m_pHsmsActive->hsmsAreYouThere(); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonDatetimeSync() |
| | | { |
| | | theApp.m_model.m_pHsmsActive->hsmsDatetimeSync(); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonTerminalDisplay() |
| | | { |
| | | CTerminalDisplayDlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonEdEventReport() |
| | | { |
| | | CEDEventReportDlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonEdAlarmReport() |
| | | { |
| | | int enable = (int)::GetProp(GetDlgItem(IDC_BUTTON_ED_ALARM_REPORT)->m_hWnd, _T("Enable")); |
| | | enable = enable == 0 ? 1 : 0; |
| | | theApp.m_model.m_pHsmsActive->hsmsEDAlarmReport(enable == 1, 0); |
| | | |
| | | SetDlgItemText(IDC_BUTTON_ED_ALARM_REPORT, |
| | | enable == 1 ? _T("Disable Alarm Report") : _T("Enable Alarm Report")); |
| | | ::SetProp(GetDlgItem(IDC_BUTTON_ED_ALARM_REPORT)->m_hWnd, _T("Enable"), (void*)enable); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonDefineReport() |
| | | { |
| | | CDefineReportsDlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonLineReport() |
| | | { |
| | | CLinkReportDlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonConfigureSpooling() |
| | | { |
| | | std::map<unsigned int, std::set<unsigned int>> spoolingConfig; |
| | | |
| | | // test clear all |
| | | // theApp.m_model.m_pHsmsActive->hsmsConfigureSpooling(spoolingConfig); |
| | | |
| | | |
| | | // test add s2[1,3,5]; |
| | | // spoolingConfig[2].insert(1); |
| | | // spoolingConfig[2].insert(3); |
| | | // spoolingConfig[2].insert(5); |
| | | // spoolingConfig[3].insert(2); |
| | | // spoolingConfig[3].insert(4); |
| | | // spoolingConfig[3].insert(6); |
| | | // theApp.m_model.m_pHsmsActive->hsmsConfigureSpooling(spoolingConfig); |
| | | |
| | | // test clear S2 |
| | | // spoolingConfig[2].clear(); |
| | | // theApp.m_model.m_pHsmsActive->hsmsConfigureSpooling(spoolingConfig); |
| | | |
| | | spoolingConfig[5].insert(66); |
| | | theApp.m_model.m_pHsmsActive->hsmsConfigureSpooling(spoolingConfig); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | |  |
| | | // EAPSimulatorDlg.h: 头æä»¶ |
| | | // |
| | | |
| | | #pragma once |
| | | #include "LogEdit.h" |
| | | |
| | | |
| | | // CEAPSimulatorDlg å¯¹è¯æ¡ |
| | | class CEAPSimulatorDlg : public CDialogEx |
| | | { |
| | | // æé |
| | | public: |
| | | CEAPSimulatorDlg(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | |
| | | |
| | | private: |
| | | void AppendLog(int level, const char* pszText); |
| | | void InitRxWindow(); |
| | | void SetGroup1Enabled(bool enabled); |
| | | void SetGroup2Enabled(bool enabled); |
| | | |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_EAPSIMULATOR_DIALOG }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | |
| | | // å®ç° |
| | | protected: |
| | | HICON m_hIcon; |
| | | CLogEdit m_logEdit; |
| | | IObserver* m_pObserver; |
| | | |
| | | // çæçæ¶æ¯æ å°å½æ° |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg void OnSysCommand(UINT nID, LPARAM lParam); |
| | | afx_msg void OnPaint(); |
| | | afx_msg HCURSOR OnQueryDragIcon(); |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | afx_msg void OnDestroy(); |
| | | afx_msg void OnBnClickedButtonConnect(); |
| | | afx_msg void OnBnClickedButtonDisconnect(); |
| | | afx_msg void OnBnClickedButtonAreYouThere(); |
| | | afx_msg void OnBnClickedButtonDatetimeSync(); |
| | | afx_msg void OnBnClickedButtonTerminalDisplay(); |
| | | afx_msg void OnBnClickedButtonEdEventReport(); |
| | | afx_msg void OnBnClickedButtonEdAlarmReport(); |
| | | afx_msg void OnBnClickedButtonDefineReport(); |
| | | afx_msg void OnBnClickedButtonLineReport(); |
| | | afx_msg void OnBnClickedButtonConfigureSpooling(); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "pch.h" |
| | | #include "Log.h" |
| | | |
| | | |
| | | static const char* pszLevel[] = {" [Debug] ", " [Info] ", " [Warn] ", " [Error] "}; |
| | | |
| | | CLog::CLog() |
| | | { |
| | | m_nLevel = 0; |
| | | m_nOutputTarget = OT_TRACE; |
| | | m_bAutoAppendTime = TRUE; |
| | | m_strEquipmentId = _T("Unknown"); |
| | | m_nDay = 0; |
| | | m_funOnLog = nullptr; |
| | | InitializeCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | |
| | | CLog::~CLog() |
| | | { |
| | | DeleteCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | | CLog *CLog::GetLog(void) |
| | | { |
| | | static CLog* pLog = NULL; |
| | | if (pLog == NULL) { |
| | | static CLog log; |
| | | pLog = &log; |
| | | } |
| | | |
| | | return pLog; |
| | | } |
| | | |
| | | void CLog::SetOnLogCallback(ONLOG funOnLog) |
| | | { |
| | | m_funOnLog = funOnLog; |
| | | } |
| | | |
| | | void CLog::SetOutputTarget(int flag) |
| | | { |
| | | m_nOutputTarget = flag; |
| | | } |
| | | |
| | | void CLog::SetEquipmentId(const char* pszEquipmentId) |
| | | { |
| | | m_strEquipmentId = pszEquipmentId; |
| | | } |
| | | |
| | | void CLog::SetAutoAppendTimeString(BOOL bAutoAppendTime) |
| | | { |
| | | m_bAutoAppendTime = bAutoAppendTime; |
| | | } |
| | | |
| | | void CLog::Batch() |
| | | { |
| | | if (m_file.m_hFile != CFile::hFileNull) { |
| | | m_file.Close(); |
| | | } |
| | | } |
| | | |
| | | BOOL CLog::BatchAndNew(int& nDay) |
| | | { |
| | | Batch(); |
| | | if ( (m_nOutputTarget & OT_FILE) && m_file.m_hFile == CFile::hFileNull) { |
| | | CString strFilepath; |
| | | BOOL bRet = m_file.Open(MakeFilepathD(strFilepath, nDay), CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite | CFile::shareDenyWrite); |
| | | if (bRet) { |
| | | m_file.SeekToEnd(); |
| | | } |
| | | return bRet; |
| | | } |
| | | |
| | | return FALSE; |
| | | } |
| | | |
| | | #define BUFFERSIZE 1024*10 |
| | | void CLog::LogFormat(int nLevel, const char* pszTag, char* szMessage, ...) |
| | | { |
| | | // æ£æ¥æ¥ææ¯å¦æååï¼æåååç»æ¹ |
| | | Lock(); |
| | | _SYSTEMTIME sysTime; |
| | | GetLocalTime(&sysTime); |
| | | if(m_nDay != sysTime.wDay) { |
| | | int nDay = 0; |
| | | if (BatchAndNew(nDay)) { |
| | | m_nDay = nDay; |
| | | } |
| | | } |
| | | Unlock(); |
| | | |
| | | if (nLevel < m_nLevel) { |
| | | return; |
| | | } |
| | | |
| | | char szFullMessage[BUFFERSIZE]; |
| | | char szFormatMessage[BUFFERSIZE]; |
| | | |
| | | // format message |
| | | va_list ap; |
| | | va_start(ap, szMessage); |
| | | _vsnprintf_s(szFormatMessage, BUFFERSIZE, szMessage, ap); |
| | | va_end(ap); |
| | | |
| | | if (m_bAutoAppendTime) { |
| | | CString strTime; |
| | | strcpy_s(szFullMessage, BUFFERSIZE, (LPTSTR)(LPCTSTR)GetCurTime(strTime)); |
| | | } |
| | | strcat_s(szFullMessage, BUFFERSIZE, pszLevel[nLevel]); |
| | | strcat_s(szFullMessage, szFormatMessage); |
| | | strcat_s(szFullMessage, BUFFERSIZE, "\n"); |
| | | |
| | | if (m_nOutputTarget & OT_FILE) { |
| | | Lock(); |
| | | if (m_file.m_hFile != CFile::hFileNull) { |
| | | m_file.WriteString(szFullMessage); |
| | | } |
| | | Unlock(); |
| | | } |
| | | if (m_nOutputTarget & OT_ODSTRING) { |
| | | OutputDebugStringA(szFullMessage); |
| | | } |
| | | else if(m_nOutputTarget & OT_TRACE) { |
| | | TRACE(szFormatMessage); |
| | | } |
| | | |
| | | if (m_funOnLog != nullptr) { |
| | | m_funOnLog(nLevel, szFullMessage); |
| | | } |
| | | } |
| | | |
| | | void CLog::Log(int nLevel, const char* pszTag, const char* szMessage) |
| | | { |
| | | // æ£æ¥æ¥ææ¯å¦æååï¼æåååç»æ¹ |
| | | Lock(); |
| | | _SYSTEMTIME sysTime; |
| | | GetLocalTime(&sysTime); |
| | | if (m_nDay != sysTime.wDay) { |
| | | int nDay = 0; |
| | | if (BatchAndNew(nDay)) { |
| | | m_nDay = nDay; |
| | | } |
| | | } |
| | | Unlock(); |
| | | |
| | | if (nLevel < m_nLevel) { |
| | | return; |
| | | } |
| | | |
| | | CString strMsg; |
| | | if (m_bAutoAppendTime) { |
| | | CString strTime; |
| | | GetCurTime(strTime); |
| | | strMsg.Append(strTime); |
| | | } |
| | | strMsg.Append(pszTag); |
| | | strMsg.Append(szMessage); |
| | | strMsg.Append("\n"); |
| | | |
| | | if (m_nOutputTarget & OT_FILE) { |
| | | Lock(); |
| | | if (m_file.m_hFile != CFile::hFileNull) { |
| | | m_file.WriteString(strMsg); |
| | | } |
| | | Unlock(); |
| | | } |
| | | if (m_nOutputTarget & OT_ODSTRING) { |
| | | OutputDebugStringA(strMsg); |
| | | } |
| | | else if (m_nOutputTarget & OT_TRACE) { |
| | | TRACE(strMsg); |
| | | } |
| | | |
| | | if (m_funOnLog != nullptr) { |
| | | m_funOnLog(nLevel, strMsg); |
| | | } |
| | | } |
| | | |
| | | CString& CLog::GetCurTime(CString& strTime) |
| | | { |
| | | _SYSTEMTIME sysTime; |
| | | GetLocalTime(&sysTime); |
| | | strTime.Format(_T("%d/%02d/%02d %02d:%02d:%02d.%03d"), sysTime.wYear, sysTime.wMonth, sysTime.wDay, |
| | | sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds); |
| | | return strTime; |
| | | } |
| | | |
| | | CString& CLog::MakeFilepath(CString& strFilepath) |
| | | { |
| | | _SYSTEMTIME sysTime; |
| | | GetLocalTime(&sysTime); |
| | | strFilepath.Format(_T("%s\\Log(%s)_%d_%02d_%02d.log"), (LPTSTR)(LPCTSTR)m_strLogsDir, |
| | | (LPTSTR)(LPCTSTR)m_strEquipmentId, |
| | | sysTime.wYear, sysTime.wMonth, sysTime.wDay); |
| | | |
| | | return strFilepath; |
| | | } |
| | | |
| | | CString& CLog::MakeFilepathD(CString& strFilepath, int& day) |
| | | { |
| | | _SYSTEMTIME sysTime; |
| | | GetLocalTime(&sysTime); |
| | | strFilepath.Format(_T("%s\\Log(%s)_%d_%02d_%02d.log"), (LPTSTR)(LPCTSTR)m_strLogsDir, |
| | | (LPTSTR)(LPCTSTR)m_strEquipmentId, |
| | | sysTime.wYear, sysTime.wMonth, sysTime.wDay); |
| | | day = sysTime.wDay; |
| | | |
| | | return strFilepath; |
| | | } |
| | | |
| | | void CLog::SetLogsDir(CString strDir) |
| | | { |
| | | m_strLogsDir = strDir; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include <functional> |
| | | |
| | | |
| | | #define LEVEL_DEBUG 0 |
| | | #define LEVEL_INFO 1 |
| | | #define LEVEL_WARN 2 |
| | | #define LEVEL_ERROR 3 |
| | | |
| | | |
| | | #define LOGD(msg, ...) CLog::GetLog()->LogFormat(LEVEL_DEBUG, "", msg, __VA_ARGS__) |
| | | #define LOGI(msg, ...) CLog::GetLog()->LogFormat(LEVEL_INFO, "", msg, __VA_ARGS__) |
| | | #define LOGW(msg, ...) CLog::GetLog()->LogFormat(LEVEL_WARN, "", msg, __VA_ARGS__) |
| | | #define LOGE(msg, ...) CLog::GetLog()->LogFormat(LEVEL_ERROR, "", msg, __VA_ARGS__) |
| | | |
| | | |
| | | #define OT_FILE 0x01 |
| | | #define OT_ODSTRING 0x02 |
| | | #define OT_TRACE 0x04 |
| | | #define LOGBATHCH() CLog::GetLog()->Batch() |
| | | #define LOGNEW() CLog::GetLog()->BatchAndNew() |
| | | |
| | | typedef std::function<void(int level, const char* pszMessage)> ONLOG; |
| | | |
| | | class CLog |
| | | { |
| | | public: |
| | | CLog(); |
| | | ~CLog(); |
| | | |
| | | public: |
| | | void SetOnLogCallback(ONLOG funOnLog); |
| | | static CLog *GetLog(void); |
| | | void SetOutputTarget(int flag); |
| | | void SetEquipmentId(const char* pszEquipmentId); |
| | | static CString& GetCurTime(CString& strTime); |
| | | CString& MakeFilepath(CString& strFilepath); |
| | | CString& MakeFilepathD(CString& strFilepath, int& day); |
| | | void LogFormat(int nLevel, const char* pszTag, char* szMessage, ...); |
| | | void Log(int nLevel, const char* pszTag, const char* szMessage); |
| | | void SetAutoAppendTimeString(BOOL bAutoAppendTime); |
| | | void SetLogsDir(CString strDir); |
| | | void Batch(); |
| | | BOOL BatchAndNew(int& nDay); |
| | | |
| | | private: |
| | | inline void Lock() { EnterCriticalSection(&m_criticalSection); } |
| | | inline void Unlock() { LeaveCriticalSection(&m_criticalSection); } |
| | | |
| | | private: |
| | | ONLOG m_funOnLog; |
| | | int m_nOutputTarget; |
| | | int m_nLevel; |
| | | BOOL m_bAutoAppendTime; |
| | | CString m_strLogsDir; |
| | | CString m_strEquipmentId; |
| | | CStdioFile m_file; |
| | | int m_nDay; // ææ¥ä¿å䏿¡è®°å½ï¼æ¯è¾æ¤æ°åï¼ä»¥å³å®æ¯å¦ç»æ¹å¹¶åå»ºæ°æä»¶ |
| | | CRITICAL_SECTION m_criticalSection; |
| | | }; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "pch.h" |
| | | #include "LogEdit.h" |
| | | |
| | | |
| | | #define MENU_ITEM_SEL_ALL 0x666 |
| | | #define MENU_ITEM_COPY 0x667 |
| | | #define MENU_ITEM_CLEAR 0x668 |
| | | |
| | | CLogEdit::CLogEdit() |
| | | { |
| | | m_nMaxLines = 0xffff; |
| | | m_nTrimLines = 100; |
| | | m_bAutoScroll = TRUE; |
| | | } |
| | | |
| | | |
| | | CLogEdit::~CLogEdit() |
| | | { |
| | | } |
| | | |
| | | BEGIN_MESSAGE_MAP(CLogEdit, CEdit) |
| | | ON_WM_CONTEXTMENU() |
| | | ON_WM_VSCROLL() |
| | | ON_WM_MOUSEWHEEL() |
| | | END_MESSAGE_MAP() |
| | | |
| | | void CLogEdit::SetMaxLineCount(int line) |
| | | { |
| | | m_nMaxLines = line; |
| | | m_nTrimLines = min(m_nMaxLines, 4000); |
| | | } |
| | | |
| | | void CLogEdit::OnContextMenu(CWnd* pWnd, CPoint point) |
| | | { |
| | | HMENU hMenu = CreatePopupMenu(); |
| | | InsertMenu(hMenu, 0, MF_BYPOSITION, MENU_ITEM_SEL_ALL, "ȫѡ"); |
| | | InsertMenu(hMenu, 1, MF_BYPOSITION, MENU_ITEM_COPY, "å¤å¶"); |
| | | InsertMenu(hMenu, 2, MF_BYPOSITION | MF_SEPARATOR, NULL, NULL); |
| | | InsertMenu(hMenu, 3, MF_BYPOSITION, MENU_ITEM_CLEAR, "å
¨é¨æ¸
é¤"); |
| | | int cmd = ::TrackPopupMenu(hMenu, |
| | | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, |
| | | point.x, point.y + 2, 0, m_hWnd, NULL); |
| | | DestroyMenu(hMenu); |
| | | |
| | | if (cmd == MENU_ITEM_SEL_ALL) { |
| | | SetFocus(); |
| | | this->SetSel(0, -1); |
| | | } |
| | | else if (cmd == MENU_ITEM_COPY) { |
| | | this->Copy(); |
| | | } |
| | | else if (cmd == MENU_ITEM_CLEAR) { |
| | | SetWindowText(_T("")); |
| | | } |
| | | } |
| | | |
| | | void CLogEdit::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) |
| | | { |
| | | // æ¯æ¬¡æ»å¨æ¶æ£æ¥æ¯å¦è¿å¨åºé¨ |
| | | m_bAutoScroll = IsScrollBarAtBottom(); |
| | | CEdit::OnVScroll(nSBCode, nPos, pScrollBar); |
| | | } |
| | | |
| | | BOOL CLogEdit::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) |
| | | { |
| | | // æ¯æ¬¡æ»å¨æ¶æ£æ¥æ¯å¦è¿å¨åºé¨ |
| | | m_bAutoScroll = IsScrollBarAtBottom(); |
| | | return CEdit::OnMouseWheel(nFlags, zDelta, pt); |
| | | } |
| | | |
| | | BOOL CLogEdit::IsScrollBarAtBottom() |
| | | { |
| | | SCROLLINFO si = { sizeof(si), SIF_ALL }; |
| | | GetScrollInfo(SB_VERT, &si); |
| | | return (si.nPos + (int)si.nPage >= si.nMax); |
| | | } |
| | | |
| | | void CLogEdit::AppendText(const char* pszText) |
| | | { |
| | | SetRedraw(FALSE); |
| | | |
| | | // åªåè¿å¤è¡ |
| | | int totalLines = GetLineCount(); |
| | | if (totalLines > m_nMaxLines) { |
| | | int startChar = LineIndex(0); |
| | | int endChar = LineIndex(m_nTrimLines); |
| | | if (startChar >= 0 && endChar > startChar) { |
| | | SetSel(startChar, endChar); |
| | | ReplaceSel(_T("")); |
| | | } |
| | | } |
| | | |
| | | // ä¿åå½åéæ© |
| | | int start, end; |
| | | GetSel(start, end); |
| | | bool hasSelection = (start != end); |
| | | |
| | | int endPos = GetWindowTextLength(); |
| | | SetSel(endPos, endPos); |
| | | ReplaceSel(pszText); |
| | | |
| | | if (m_bAutoScroll && !hasSelection) { |
| | | LineScroll(GetLineCount()); |
| | | } |
| | | |
| | | // æ¢å¤éæ© |
| | | if (hasSelection) { |
| | | SetSel(start, end); |
| | | } |
| | | |
| | | SetRedraw(TRUE); |
| | | |
| | | if (m_bAutoScroll && !hasSelection) { |
| | | Invalidate(); |
| | | UpdateWindow(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "afxwin.h" |
| | | class CLogEdit : |
| | | public CEdit |
| | | { |
| | | public: |
| | | CLogEdit(); |
| | | ~CLogEdit(); |
| | | |
| | | public: |
| | | void SetMaxLineCount(int line); |
| | | void AppendText(const char* pszText); |
| | | BOOL IsScrollBarAtBottom(); |
| | | |
| | | private: |
| | | int m_nMaxLines; |
| | | int m_nTrimLines; |
| | | BOOL m_bAutoScroll; // æ¯å¦èªå¨æ»å¨ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); |
| | | afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); |
| | | public: |
| | | afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); |
| | | }; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | //{{NO_DEPENDENCIES}} |
| | | // Microsoft Visual C++ çæçå
嫿件ã |
| | | // ä¾ EAPSimulator.rc ä½¿ç¨ |
| | | // |
| | | #define IDM_ABOUTBOX 0x0010 |
| | | #define IDD_ABOUTBOX 100 |
| | | #define IDS_ABOUTBOX 101 |
| | | #define IDD_EAPSIMULATOR_DIALOG 102 |
| | | #define IDR_MAINFRAME 128 |
| | | #define IDD_DIALOG_TERMINAL_DISPLAY 129 |
| | | #define IDD_DIALOG_ED_EVENT_REPORT 131 |
| | | #define IDD_DIALOG_DEFINE_REPORTS 133 |
| | | #define IDD_DIALOG_ADD_IDS 135 |
| | | #define IDD_DIALOG_LINK_REPORT 137 |
| | | #define IDD_DIALOG_LINK_REPORT_DETAIL 139 |
| | | #define IDC_EDIT_LOG 1000 |
| | | #define IDC_EDIT_IP 1001 |
| | | #define IDC_EDIT_PORT 1002 |
| | | #define IDC_BUTTON_CONNECT 1003 |
| | | #define IDC_BUTTON_DISCONNECT 1004 |
| | | #define IDC_BUTTON_ARE_YOU_THERE 1005 |
| | | #define IDC_BUTTON_DATETIME_SYNC 1006 |
| | | #define IDC_BUTTON_TERMINAL_DISPLAY 1007 |
| | | #define IDC_COMBO_TID 1008 |
| | | #define IDC_BUTTON_ED_EVENT_REPORT 1008 |
| | | #define IDC_EDIT_TEXT 1009 |
| | | #define IDC_BUTTON_ED_ALARM_REPORT 1009 |
| | | #define IDC_BUTTON_SEND 1010 |
| | | #define IDC_BUTTON_DEFINE_REPORT 1010 |
| | | #define IDC_BUTTON_LINE_REPORT 1011 |
| | | #define IDC_RADIO_ENABLE 1012 |
| | | #define IDC_BUTTON_LINE_REPORT2 1012 |
| | | #define IDC_BUTTON_CONFIGURE_SPOOLING 1012 |
| | | #define IDC_RADIO_DISABLE 1013 |
| | | #define IDC_EDIT_CEID 1014 |
| | | #define IDC_LIST1 1015 |
| | | #define IDC_EDIT_CE_NAME 1015 |
| | | #define IDC_LIST2 1016 |
| | | #define IDC_EDIT_CE_DESCRIPTIONS 1016 |
| | | #define IDC_BUTTON_ADD_RPTID 1017 |
| | | #define IDC_EDIT_CE_RPTID 1017 |
| | | #define IDC_BUTTON_DEL_REPORT 1018 |
| | | #define IDC_BUTTON_ADD_VID 1019 |
| | | #define IDC_BUTTON_DEL_VID 1020 |
| | | #define IDC_GROUP_IDS 1021 |
| | | #define IDC_EDIT_ID 1022 |
| | | #define IDC_BUTTON1 1023 |
| | | |
| | | // Next default values for new objects |
| | | // |
| | | #ifdef APSTUDIO_INVOKED |
| | | #ifndef APSTUDIO_READONLY_SYMBOLS |
| | | #define _APS_NEXT_RESOURCE_VALUE 141 |
| | | #define _APS_NEXT_COMMAND_VALUE 32771 |
| | | #define _APS_NEXT_CONTROL_VALUE 1025 |
| | | #define _APS_NEXT_SYMED_VALUE 101 |
| | | #endif |
| | | #endif |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | #ifndef VC_EXTRALEAN |
| | | #define VC_EXTRALEAN // ä» Windows 头䏿餿å°ä½¿ç¨çèµæ |
| | | #endif |
| | | |
| | | #include "targetver.h" |
| | | |
| | | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // æäº CString æé 彿°å°æ¯æ¾å¼ç |
| | | |
| | | // å
³é MFC çä¸äºå¸¸è§ä¸ç»å¸¸å¯æ¾å¿å¿½ç¥çéèè¦åæ¶æ¯ |
| | | #define _AFX_ALL_WARNINGS |
| | | |
| | | #include <afxwin.h> // MFC æ ¸å¿ç»ä»¶åæ åç»ä»¶ |
| | | #include <afxext.h> // MFC æ©å± |
| | | |
| | | |
| | | #include <afxdisp.h> // MFC èªå¨åç±» |
| | | |
| | | |
| | | |
| | | #ifndef _AFX_NO_OLE_SUPPORT |
| | | #include <afxdtctl.h> // MFC 对 Internet Explorer 4 å
Œ
±æ§ä»¶çæ¯æ |
| | | #endif |
| | | #ifndef _AFX_NO_AFXCMN_SUPPORT |
| | | #include <afxcmn.h> // MFC 对 Windows å
Œ
±æ§ä»¶çæ¯æ |
| | | #endif // _AFX_NO_AFXCMN_SUPPORT |
| | | |
| | | #include <afxcontrolbars.h> // MFC æ¯æåè½åºåæ§å¶æ¡ |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #ifdef _UNICODE |
| | | #if defined _M_IX86 |
| | | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") |
| | | #elif defined _M_X64 |
| | | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") |
| | | #else |
| | | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") |
| | | #endif |
| | | #endif |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // pch.cpp: ä¸é¢ç¼è¯æ 头对åºçæºæä»¶ |
| | | |
| | | #include "pch.h" |
| | | |
| | | // å½ä½¿ç¨é¢ç¼è¯ç头æ¶ï¼éè¦ä½¿ç¨æ¤æºæä»¶ï¼ç¼è¯æè½æåã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // pch.h: è¿æ¯é¢ç¼è¯æ 头æä»¶ã |
| | | // 䏿¹ååºçæä»¶ä»
ç¼è¯ä¸æ¬¡ï¼æé«äºå°æ¥çæççææ§è½ã |
| | | // è¿è¿å°å½±å IntelliSense æ§è½ï¼å
æ¬ä»£ç 宿å许å¤ä»£ç æµè§åè½ã |
| | | // 使¯ï¼å¦ææ¤å¤ååºçæä»¶ä¸çä»»ä½ä¸ä¸ªå¨çæä¹é´ææ´æ°ï¼å®ä»¬å
¨é¨é½å°è¢«éæ°ç¼è¯ã |
| | | // 请å¿å¨æ¤å¤æ·»å è¦é¢ç¹æ´æ°çæä»¶ï¼è¿å°ä½¿å¾æ§è½ä¼å¿æ æã |
| | | |
| | | #ifndef PCH_H |
| | | #define PCH_H |
| | | |
| | | // æ·»å è¦å¨æ¤å¤é¢ç¼è¯çæ 头 |
| | | #include "framework.h" |
| | | |
| | | #include "..\RxWindows1.0\include\RxWindowsLib.h" |
| | | #include "..\HSMSSDK\Include\HSMSSDK.h" |
| | | |
| | | |
| | | #endif //PCH_H |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
| | | <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> |
| | | <assemblyIdentity |
| | | name="XP style manifest" |
| | | processorArchitecture="amd64" |
| | | version="1.0.0.0" |
| | | type="win32"/> |
| | | <dependency> |
| | | <dependentAssembly> |
| | | <assemblyIdentity |
| | | type="win32" |
| | | name="Microsoft.Windows.Common-Controls" |
| | | version="6.0.0.0" |
| | | processorArchitecture="amd64" |
| | | publicKeyToken="6595b64144ccf1df" |
| | | language="*" |
| | | /> |
| | | </dependentAssembly> |
| | | </dependency> |
| | | </assembly> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | // å
æ¬ SDKDDKVer.h å°å®ä¹å¯ç¨çæé«çæ¬ç Windows å¹³å°ã |
| | | |
| | | //妿è¦ä¸ºä»¥åç Windows å¹³å°çæåºç¨ç¨åºï¼è¯·å
æ¬ WinSDKVer.hï¼å¹¶ |
| | | // å° _WIN32_WINNT å®è®¾ç½®ä¸ºè¦æ¯æçå¹³å°ï¼ç¶ååå
æ¬ SDKDDKVer.hã |
| | | |
| | | #include <SDKDDKVer.h> |
| | |
| | |  |
| | | Microsoft Visual Studio Solution File, Format Version 12.00 |
| | | # Visual Studio 14 |
| | | VisualStudioVersion = 14.0.23107.0 |
| | | # Visual Studio Version 16 |
| | | VisualStudioVersion = 16.0.31729.503 |
| | | MinimumVisualStudioVersion = 10.0.40219.1 |
| | | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BEQLibrary", "BEQLibrary\BEQLibrary.vcxproj", "{8421CE64-06F9-48F4-A3F3-ACFB683C94D4}" |
| | | EndProject |
| | |
| | | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Servo", "Servo\Servo.vcxproj", "{66ADACE5-3166-4D1F-B30B-DE5E01FB01A2}" |
| | | EndProject |
| | | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BoounionPLC", "BoounionPLC\BoounionPLC.vcxproj", "{6DC0600E-5588-4033-A281-3626A4F74B67}" |
| | | EndProject |
| | | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPSimulator", "EAPSimulator\EAPSimulator.vcxproj", "{9EA43050-B71C-47A7-AC90-F0D7A88C5F50}" |
| | | EndProject |
| | | Global |
| | | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
| | |
| | | {6DC0600E-5588-4033-A281-3626A4F74B67}.Release|x64.Build.0 = Release|x64 |
| | | {6DC0600E-5588-4033-A281-3626A4F74B67}.Release|x86.ActiveCfg = Release|Win32 |
| | | {6DC0600E-5588-4033-A281-3626A4F74B67}.Release|x86.Build.0 = Release|Win32 |
| | | {9EA43050-B71C-47A7-AC90-F0D7A88C5F50}.Debug|x64.ActiveCfg = Debug|x64 |
| | | {9EA43050-B71C-47A7-AC90-F0D7A88C5F50}.Debug|x64.Build.0 = Debug|x64 |
| | | {9EA43050-B71C-47A7-AC90-F0D7A88C5F50}.Debug|x86.ActiveCfg = Debug|Win32 |
| | | {9EA43050-B71C-47A7-AC90-F0D7A88C5F50}.Debug|x86.Build.0 = Debug|Win32 |
| | | {9EA43050-B71C-47A7-AC90-F0D7A88C5F50}.Release|x64.ActiveCfg = Release|x64 |
| | | {9EA43050-B71C-47A7-AC90-F0D7A88C5F50}.Release|x64.Build.0 = Release|x64 |
| | | {9EA43050-B71C-47A7-AC90-F0D7A88C5F50}.Release|x86.ActiveCfg = Release|Win32 |
| | | {9EA43050-B71C-47A7-AC90-F0D7A88C5F50}.Release|x86.Build.0 = Release|Win32 |
| | | EndGlobalSection |
| | | GlobalSection(SolutionProperties) = preSolution |
| | | HideSolutionNode = FALSE |
| | |
| | | #pragma once |
| | | #include <functional> |
| | | #include "IPassive.h" |
| | | #include "IActive.h" |
| | | #include "IMessage.h" |
| | | |
| | | |
| | |
| | | int EXPORTED HSMS_Term(); |
| | | int EXPORTED HSMS_CreatePassive(OUT IPassive*& pPassive, const char* pName, const unsigned int nPort); |
| | | int EXPORTED HSMS_DestroyPassive(IPassive* pPassive); |
| | | int EXPORTED HSMS_CreateActive(OUT IActive*& pAcitve, const char* pName, const char* pszIp, const unsigned int nPort); |
| | | int EXPORTED HSMS_DestroyActive(IActive* pAcitve); |
| | | int EXPORTED HSMS_Create1Message(OUT IMessage*& pMessage, unsigned short sessionId, BYTE stream, BYTE function, unsigned int nSystemBytes); |
| | | int EXPORTED HSMS_CreateMessageWithSType(OUT IMessage*& pMessage, BYTE sType, unsigned int nSystemBytes); |
| | | int EXPORTED HSMS_Destroy1Message(IMessage* pMessage); |
| | | |
| | | #ifdef __cplusplus |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include <functional> |
| | | #include "IMessage.h" |
| | | |
| | | |
| | | enum class ACTIVESTATE |
| | | { |
| | | NOT_CONNECTED = 0, |
| | | NOT_SELECTED = 1, |
| | | SELECTED = 2 |
| | | }; |
| | | |
| | | typedef std::function<void(void* pFrom, ACTIVESTATE state)> ONACTIVESTATECHANGED; |
| | | typedef std::function<void(void* pFrom, const char* pszData, int size)> ONRECVRAWDATA; |
| | | typedef std::function<void(void* pFrom, IMessage* pMessage)> ONRECVDATAMSG; |
| | | typedef std::function<void(void* pFrom, IMessage* pMessage)> ONRECVSYSMSG; |
| | | typedef std::function<void(void* pFrom, int error)> ONDATAERROR; |
| | | typedef struct _ActiveListener |
| | | { |
| | | ONACTIVESTATECHANGED funStateChanged; |
| | | ONRECVRAWDATA funRecvRawData; |
| | | ONRECVDATAMSG funRecvDataMessage; |
| | | ONRECVSYSMSG funRecvSysMessage; |
| | | ONDATAERROR funError; |
| | | } ActiveListener; |
| | | |
| | | |
| | | class IActive |
| | | { |
| | | public: |
| | | virtual void setListener(ActiveListener listener) = 0; |
| | | virtual void setTimeout3(int timeout) = 0; |
| | | virtual void setTimeout5(int timeout) = 0; |
| | | virtual void setTimeout6(int timeout) = 0; |
| | | virtual void setTimeout7(int timeout) = 0; |
| | | virtual void setTimeout8(int timeout) = 0; |
| | | virtual int sendMessage(IMessage* pMessage) = 0; |
| | | virtual ACTIVESTATE getState() = 0; |
| | | virtual int connect() = 0; |
| | | virtual int disconnect() = 0; |
| | | }; |
| | |
| | | virtual bool getSubItemU1(int index, unsigned char& value) = 0; |
| | | virtual void reset() = 0; |
| | | virtual ISECS2Item* addItem(const char* pszText, const char* pszNote) = 0; |
| | | virtual ISECS2Item* addBinaryItem(BYTE bin, const char* pszNote) = 0; |
| | | virtual ISECS2Item* addBinaryItem(const char* pszData, unsigned int len, const char* pszNote) = 0; |
| | | virtual ISECS2Item* addBoolItem(bool boolValue, const char* pszNote) = 0; |
| | | virtual ISECS2Item* addI8Item(long long value, const char* pszNote) = 0; |
| | | virtual ISECS2Item* addI4Item(int value, const char* pszNote) = 0; |
| | |
| | | virtual ISECS2Item* addU2Item(unsigned short value, const char* pszNote) = 0; |
| | | virtual ISECS2Item* addU1Item(unsigned char value, const char* pszNote) = 0; |
| | | virtual void setBinary(const char* pszData, unsigned int len, const char* pszNote) = 0; |
| | | virtual void setString(const char* pszText, const char* pszNote) = 0; |
| | | virtual ISECS2Item* addItem() = 0; |
| | | }; |
| | |
| | | { |
| | | CEquipment::onTimer(nTimerid); |
| | | |
| | | // test |
| | | // test |
| | | /* |
| | | static int i[2] = { 0, 0 }; |
| | | i[m_nIndex]++; |
| | | |
| | | if (i[m_nIndex] == 15) { |
| | | char szBuffer[26]; |
| | | decodeJobProcessStartReport(getStep(STEP_ID_JOB_PROCESS_START_REPORT), szBuffer, 26); |
| | | if (m_nIndex == 0 && i[m_nIndex] % 20 == 0) { |
| | | if (m_listener.onAlarm != nullptr) { |
| | | m_listener.onAlarm(this, 1, |
| | | i[m_nIndex], |
| | | getID(), |
| | | 1); |
| | | } |
| | | } |
| | | */ |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "CCollectionEvent.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | | CCollectionEvent::CCollectionEvent() |
| | | { |
| | | m_nCEID = 0; |
| | | } |
| | | |
| | | CCollectionEvent::CCollectionEvent(unsigned int id, const char* pszName, const char* pszDescription, std::vector<unsigned int>& prtids) |
| | | { |
| | | m_nCEID = id; |
| | | m_strName = pszName; |
| | | m_strDescription = pszDescription; |
| | | for (auto item : prtids) { |
| | | m_rptids.push_back(item); |
| | | } |
| | | } |
| | | |
| | | CCollectionEvent::~CCollectionEvent() |
| | | { |
| | | |
| | | } |
| | | |
| | | unsigned int CCollectionEvent::getEventId() |
| | | { |
| | | return m_nCEID; |
| | | } |
| | | |
| | | std::string& CCollectionEvent::getName() |
| | | { |
| | | return m_strName; |
| | | } |
| | | |
| | | std::string& CCollectionEvent::getDescription() |
| | | { |
| | | return m_strDescription; |
| | | } |
| | | |
| | | BOOL CCollectionEvent::addReport(CReport* pReport) |
| | | { |
| | | ASSERT(pReport); |
| | | if (getReport(pReport->getReportId()) != nullptr) { |
| | | return FALSE; |
| | | } |
| | | |
| | | m_reports.push_back(pReport); |
| | | return TRUE; |
| | | } |
| | | |
| | | void CCollectionEvent::setReport(CReport* pReport) |
| | | { |
| | | m_rptids.clear(); |
| | | m_reports.clear(); |
| | | if (pReport != nullptr) { |
| | | m_rptids.push_back(pReport->getReportId()); |
| | | m_reports.push_back(pReport); |
| | | } |
| | | } |
| | | |
| | | unsigned int CCollectionEvent::getPortID() |
| | | { |
| | | if (m_reports.empty()) return -1; |
| | | return m_reports.front()->getReportId(); |
| | | } |
| | | |
| | | BOOL CCollectionEvent::deleteReport(unsigned int nReportId) |
| | | { |
| | | BOOL bDelete = FALSE; |
| | | for (auto iter = m_reports.begin(); iter != m_reports.end(); ++iter) { |
| | | if (nReportId == (*iter)->getReportId()) { |
| | | m_reports.erase(iter); |
| | | bDelete = TRUE; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return bDelete; |
| | | } |
| | | |
| | | CReport* CCollectionEvent::getReport(unsigned int nReportId) |
| | | { |
| | | for (auto item : m_reports) { |
| | | if (nReportId == item->getReportId()) { |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | std::vector<CReport*>& CCollectionEvent::getReports() |
| | | { |
| | | return m_reports; |
| | | } |
| | | |
| | | std::string CCollectionEvent::getReportIdsText() |
| | | { |
| | | std::string strResult, strName; |
| | | for (int i = 0; i < m_rptids.size(); i++) { |
| | | strResult += std::to_string(m_rptids[i]);// (getReport(m_rptids[i]) ? |
| | | if (nullptr == getReport(m_rptids[i])) { |
| | | strResult += "?"; |
| | | } |
| | | if (i != m_rptids.size() - 1) { |
| | | strResult += ","; |
| | | } |
| | | } |
| | | |
| | | return strResult; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CReport.h" |
| | | #include <vector> |
| | | |
| | | |
| | | namespace SERVO { |
| | | class CCollectionEvent |
| | | { |
| | | public: |
| | | CCollectionEvent(); |
| | | CCollectionEvent(unsigned int id, const char* pszName, const char* pszDescription, std::vector<unsigned int>& prtids); |
| | | virtual ~CCollectionEvent(); |
| | | |
| | | public: |
| | | unsigned int getEventId(); |
| | | std::string& getName(); |
| | | std::string& getDescription(); |
| | | std::vector<CReport*>& getReports(); |
| | | std::string getReportIdsText(); |
| | | BOOL addReport(CReport* pReport); |
| | | BOOL deleteReport(unsigned int nReportId); |
| | | CReport* getReport(unsigned int nReportId); |
| | | |
| | | /* 妿ä¸ä¸ªCEIDåªæä¸ä¸ªReportçåºæ¯,è°ç¨æ¤å½æ°è®¾ç½®æåæ¶ */ |
| | | void setReport(CReport* pReport); |
| | | unsigned int getPortID(); |
| | | private: |
| | | unsigned int m_nCEID; |
| | | std::string m_strName; |
| | | std::string m_strDescription; |
| | | std::vector<unsigned int> m_rptids; |
| | | std::vector<CReport*> m_reports; |
| | | }; |
| | | } |
| | |
| | | m_pActiveRobotTask = nullptr; |
| | | m_nLastError = 0; |
| | | m_isCompareMapsBeforeProceeding = FALSE; |
| | | m_bEnableEventReport = true; |
| | | m_bEnableAlarmReport = true; |
| | | InitializeCriticalSection(&m_criticalSection); |
| | | } |
| | | |
| | |
| | | { |
| | | m_isCompareMapsBeforeProceeding = bCompare; |
| | | } |
| | | |
| | | void CMaster::datetimeSync(SYSTEMTIME& time) |
| | | { |
| | | for (auto item : m_listEquipment) { |
| | | item->setDateTime(time.wYear, time.wMonth, time.wDay, |
| | | time.wHour, time.wMinute, time.wSecond); |
| | | } |
| | | } |
| | | |
| | | void CMaster::enableEventReport(bool bEnable) |
| | | { |
| | | m_bEnableEventReport = bEnable; |
| | | } |
| | | |
| | | void CMaster::enableAlarmReport(bool bEnable) |
| | | { |
| | | m_bEnableAlarmReport = bEnable; |
| | | } |
| | | |
| | | bool CMaster::isAlarmReportEnable() |
| | | { |
| | | return m_bEnableAlarmReport; |
| | | } |
| | | } |
| | |
| | | int cassetteType, int transferMode, BOOL autoChangeEnable); |
| | | void setPortCassetteType(unsigned int index, SERVO::CassetteType type); |
| | | void setCompareMapsBeforeProceeding(BOOL bCompare); |
| | | void datetimeSync(SYSTEMTIME& time); |
| | | void enableEventReport(bool bEnable); |
| | | void enableAlarmReport(bool bEnable); |
| | | bool isAlarmReportEnable(); |
| | | |
| | | private: |
| | | inline void lock() { EnterCriticalSection(&m_criticalSection); } |
| | |
| | | CRobotTask* createTransferTask_bake_to_cooling(CEquipment* pSrcEq); |
| | | CRobotTask* createTransferTask_bakecooling_to_measurement(CEquipment* pSrcEq, CEquipment* pTarEq); |
| | | CRobotTask* createTransferTask_restore(CEquipment* pEqSrc, CLoadPort** pPorts); |
| | | |
| | | |
| | | private: |
| | | CRITICAL_SECTION m_criticalSection; |
| | | MasterListener m_listener; |
| | |
| | | |
| | | // å¨å¼å§å·¥èºåæ¯å¦å
éè¦å
æ¯è¾map |
| | | BOOL m_isCompareMapsBeforeProceeding; |
| | | private: |
| | | bool m_bEnableEventReport; |
| | | bool m_bEnableAlarmReport; |
| | | }; |
| | | } |
| | | |
| | |
| | | SetDlgItemText(IDC_BUTTON_ROBOTTASK, pszText); |
| | | } |
| | | |
| | | void CMyStatusbar::setCimBtnText(const char* pszText) |
| | | { |
| | | SetDlgItemText(IDC_BUTTON_CIM, pszText); |
| | | } |
| | | |
| | | BOOL CMyStatusbar::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | |
| | | m_btnCurTask.SetFrameColor(BS_HOVER, RGB(218, 218, 218)); |
| | | m_btnCurTask.SetFrameColor(BS_PRESS, RGB(168, 168, 168)); |
| | | |
| | | m_btnCim.SubclassDlgItem(IDC_BUTTON_CIM, this); |
| | | m_btnCim.SetFaceColor(m_crBkgnd); |
| | | m_btnCim.SetFrameColor(m_crBkgnd); |
| | | m_btnCim.SetFrameColor(BS_HOVER, RGB(218, 218, 218)); |
| | | m_btnCim.SetFrameColor(BS_PRESS, RGB(168, 168, 168)); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | |
| | | pItem->GetWindowRect(rcItem); |
| | | GetParent()->SendMessage(ID_MSG_STATUSBAR_BTN_CLICKED, rcItem.left, LOWORD(wParam)); |
| | | break; |
| | | case IDC_BUTTON_CIM: |
| | | pItem = GetDlgItem(IDC_BUTTON_CIM); |
| | | pItem->GetWindowRect(rcItem); |
| | | GetParent()->SendMessage(ID_MSG_STATUSBAR_BTN_CLICKED, rcItem.left, LOWORD(wParam)); |
| | | break; |
| | | } |
| | | |
| | | return CDialogEx::OnCommand(wParam, lParam); |
| | |
| | | pItem->GetClientRect(rcItem); |
| | | pItem->MoveWindow(x, (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height()); |
| | | x += rcItem.Width(); |
| | | |
| | | x += 8; |
| | | pItem = GetDlgItem(IDC_LABEL_CIM); |
| | | pItem->GetClientRect(rcItem); |
| | | pItem->MoveWindow(x, (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height()); |
| | | x += rcItem.Width(); |
| | | |
| | | x += 8; |
| | | pItem = GetDlgItem(IDC_BUTTON_CIM); |
| | | pItem->GetClientRect(rcItem); |
| | | pItem->MoveWindow(x, (rcClient.Height() - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height()); |
| | | x += rcItem.Width(); |
| | | } |
| | |
| | | void setForegroundColor(COLORREF cr); |
| | | void setRunTimeText(const char* pszText); |
| | | void setCurTaskBtnText(const char* pszText); |
| | | void setCimBtnText(const char* pszText); |
| | | |
| | | private: |
| | | void Resize(); |
| | |
| | | COLORREF m_crBkgnd; |
| | | CBrush m_brBkgnd; |
| | | CBlButton m_btnCurTask; |
| | | CBlButton m_btnCim; |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CPageCollectionEvent.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "Servo.h" |
| | | #include "CPageCollectionEvent.h" |
| | | #include "afxdialogex.h" |
| | | |
| | | |
| | | // CPageCollectionEvent å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CPageCollectionEvent, CHMPropertyPage) |
| | | |
| | | CPageCollectionEvent::CPageCollectionEvent(CWnd* pParent /*=nullptr*/) |
| | | : CHMPropertyPage(IDD_PAGE_COLLECTION_EVENT, pParent) |
| | | { |
| | | |
| | | } |
| | | |
| | | CPageCollectionEvent::~CPageCollectionEvent() |
| | | { |
| | | } |
| | | |
| | | void CPageCollectionEvent::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_LIST1, m_listCtrl); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CPageCollectionEvent, CHMPropertyPage) |
| | | ON_WM_CTLCOLOR() |
| | | ON_WM_DESTROY() |
| | | ON_WM_SIZE() |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CPageCollectionEvent æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CPageCollectionEvent::OnInitDialog() |
| | | { |
| | | CHMPropertyPage::OnInitDialog(); |
| | | |
| | | // 读åºå宽 |
| | | CString strIniFile, strItem; |
| | | strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir); |
| | | int width[8] = { 0, 218, 180, 180, 180, 180, 180, 180 }; |
| | | for (int i = 0; i < 8; i++) { |
| | | strItem.Format(_T("Col_%d_Width"), i); |
| | | width[i] = GetPrivateProfileInt("PageCollectionListCtrl", strItem, width[i], strIniFile); |
| | | } |
| | | |
| | | |
| | | // æ¥è¡¨æ§ä»¶ |
| | | DWORD dwStyle = m_listCtrl.GetExtendedStyle(); |
| | | dwStyle |= LVS_EX_FULLROWSELECT; |
| | | dwStyle |= LVS_EX_GRIDLINES; |
| | | m_listCtrl.SetExtendedStyle(dwStyle); |
| | | |
| | | HIMAGELIST imageList = ImageList_Create(24, 24, ILC_COLOR24, 1, 1); |
| | | ListView_SetImageList(m_listCtrl.GetSafeHwnd(), imageList, LVSIL_SMALL); |
| | | m_listCtrl.InsertColumn(0, _T(""), LVCFMT_RIGHT, width[0]); |
| | | m_listCtrl.InsertColumn(1, _T("CEID"), LVCFMT_LEFT, width[1]); |
| | | m_listCtrl.InsertColumn(2, _T("CE Name"), LVCFMT_LEFT, width[2]); |
| | | m_listCtrl.InsertColumn(3, _T("Descriptions"), LVCFMT_LEFT, width[3]); |
| | | m_listCtrl.InsertColumn(4, _T("Attached RPTID"), LVCFMT_LEFT, width[4]); |
| | | loadCollectionEvents(); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | |
| | | HBRUSH CPageCollectionEvent::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) |
| | | { |
| | | HBRUSH hbr = CHMPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor); |
| | | |
| | | // TODO: 卿¤æ´æ¹ DC çä»»ä½ç¹æ§ |
| | | |
| | | // TODO: 妿é»è®¤ç䏿¯æéç»ç¬ï¼åè¿åå¦ä¸ä¸ªç»ç¬ |
| | | return hbr; |
| | | } |
| | | |
| | | |
| | | void CPageCollectionEvent::OnDestroy() |
| | | { |
| | | CHMPropertyPage::OnDestroy(); |
| | | |
| | | // ä¿åå宽 |
| | | CString strIniFile, strItem, strTemp; |
| | | strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir); |
| | | CHeaderCtrl* pHeader = m_listCtrl.GetHeaderCtrl(); |
| | | for (int i = 0; i < pHeader->GetItemCount(); i++) { |
| | | RECT rect; |
| | | pHeader->GetItemRect(i, &rect); |
| | | strItem.Format(_T("Col_%d_Width"), i); |
| | | strTemp.Format(_T("%d"), rect.right - rect.left); |
| | | WritePrivateProfileString("PageCollectionListCtrl", strItem, strTemp, strIniFile); |
| | | } |
| | | } |
| | | |
| | | |
| | | void CPageCollectionEvent::OnSize(UINT nType, int cx, int cy) |
| | | { |
| | | CHMPropertyPage::OnSize(nType, cx, cy); |
| | | if (GetDlgItem(IDC_LIST1) == nullptr) return; |
| | | |
| | | CWnd* pItem; |
| | | CRect rcClient, rcItem; |
| | | GetClientRect(&rcClient); |
| | | m_listCtrl.MoveWindow(12, 12, rcClient.Width() - 24, rcClient.Height() - 24); |
| | | } |
| | | |
| | | void CPageCollectionEvent::loadCollectionEvents() |
| | | { |
| | | auto& collectionEvent = theApp.m_model.m_hsmsPassive.getCollectionEvents(); |
| | | for (auto item : collectionEvent) { |
| | | int index = m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), _T("")); |
| | | m_listCtrl.SetItemData(index, (DWORD_PTR)item); |
| | | m_listCtrl.SetItemText(index, 1, std::to_string(item->getEventId()).c_str()); |
| | | m_listCtrl.SetItemText(index, 2, item->getName().c_str()); |
| | | m_listCtrl.SetItemText(index, 3, item->getDescription().c_str()); |
| | | m_listCtrl.SetItemText(index, 4, item->getReportIdsText().c_str()); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CHMPropertyPage.h" |
| | | #include "ListCtrlEx.h" |
| | | |
| | | |
| | | // CPageCollectionEvent å¯¹è¯æ¡ |
| | | |
| | | class CPageCollectionEvent : public CHMPropertyPage |
| | | { |
| | | DECLARE_DYNAMIC(CPageCollectionEvent) |
| | | |
| | | public: |
| | | CPageCollectionEvent(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | virtual ~CPageCollectionEvent(); |
| | | void loadCollectionEvents(); |
| | | |
| | | private: |
| | | CListCtrlEx m_listCtrl; |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_PAGE_COLLECTION_EVENT }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); |
| | | afx_msg void OnDestroy(); |
| | | afx_msg void OnSize(UINT nType, int cx, int cy); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CPageReport.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "Servo.h" |
| | | #include "CPageReport.h" |
| | | #include "afxdialogex.h" |
| | | |
| | | |
| | | // CPageReport å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CPageReport, CHMPropertyPage) |
| | | |
| | | CPageReport::CPageReport(CWnd* pParent /*=nullptr*/) |
| | | : CHMPropertyPage(IDD_PAGE_REPORT, pParent) |
| | | { |
| | | |
| | | } |
| | | |
| | | CPageReport::~CPageReport() |
| | | { |
| | | } |
| | | |
| | | void CPageReport::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CHMPropertyPage::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_LIST1, m_listCtrl); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CPageReport, CHMPropertyPage) |
| | | ON_WM_CTLCOLOR() |
| | | ON_WM_DESTROY() |
| | | ON_WM_SIZE() |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CPageReport æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CPageReport::OnInitDialog() |
| | | { |
| | | CHMPropertyPage::OnInitDialog(); |
| | | |
| | | |
| | | // 读åºå宽 |
| | | CString strIniFile, strItem; |
| | | strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir); |
| | | int width[8] = { 0, 218, 180, 180, 180, 180, 180, 180 }; |
| | | for (int i = 0; i < 8; i++) { |
| | | strItem.Format(_T("Col_%d_Width"), i); |
| | | width[i] = GetPrivateProfileInt("PageReportListCtrl", strItem, width[i], strIniFile); |
| | | } |
| | | |
| | | |
| | | // æ¥è¡¨æ§ä»¶ |
| | | DWORD dwStyle = m_listCtrl.GetExtendedStyle(); |
| | | dwStyle |= LVS_EX_FULLROWSELECT; |
| | | dwStyle |= LVS_EX_GRIDLINES; |
| | | m_listCtrl.SetExtendedStyle(dwStyle); |
| | | |
| | | HIMAGELIST imageList = ImageList_Create(24, 24, ILC_COLOR24, 1, 1); |
| | | ListView_SetImageList(m_listCtrl.GetSafeHwnd(), imageList, LVSIL_SMALL); |
| | | m_listCtrl.InsertColumn(0, _T(""), LVCFMT_RIGHT, width[0]); |
| | | m_listCtrl.InsertColumn(1, _T("RPT ID"), LVCFMT_LEFT, width[1]); |
| | | m_listCtrl.InsertColumn(2, _T("VID"), LVCFMT_LEFT, width[2]); |
| | | loadReports(); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | |
| | | HBRUSH CPageReport::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) |
| | | { |
| | | HBRUSH hbr = CHMPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor); |
| | | |
| | | // TODO: 卿¤æ´æ¹ DC çä»»ä½ç¹æ§ |
| | | |
| | | // TODO: 妿é»è®¤ç䏿¯æéç»ç¬ï¼åè¿åå¦ä¸ä¸ªç»ç¬ |
| | | return hbr; |
| | | } |
| | | |
| | | |
| | | void CPageReport::OnDestroy() |
| | | { |
| | | CHMPropertyPage::OnDestroy(); |
| | | |
| | | // ä¿åå宽 |
| | | CString strIniFile, strItem, strTemp; |
| | | strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir); |
| | | CHeaderCtrl* pHeader = m_listCtrl.GetHeaderCtrl(); |
| | | for (int i = 0; i < pHeader->GetItemCount(); i++) { |
| | | RECT rect; |
| | | pHeader->GetItemRect(i, &rect); |
| | | strItem.Format(_T("Col_%d_Width"), i); |
| | | strTemp.Format(_T("%d"), rect.right - rect.left); |
| | | WritePrivateProfileString("PageReportListCtrl", strItem, strTemp, strIniFile); |
| | | } |
| | | } |
| | | |
| | | |
| | | void CPageReport::OnSize(UINT nType, int cx, int cy) |
| | | { |
| | | CHMPropertyPage::OnSize(nType, cx, cy); |
| | | if (GetDlgItem(IDC_LIST1) == nullptr) return; |
| | | |
| | | CWnd* pItem; |
| | | CRect rcClient, rcItem; |
| | | GetClientRect(&rcClient); |
| | | m_listCtrl.MoveWindow(12, 12, rcClient.Width() - 24, rcClient.Height() - 24); |
| | | } |
| | | |
| | | void CPageReport::loadReports() |
| | | { |
| | | auto& reports = theApp.m_model.m_hsmsPassive.getReports(); |
| | | for (auto item : reports) { |
| | | int index = m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), _T("")); |
| | | m_listCtrl.SetItemData(index, (DWORD_PTR)item); |
| | | m_listCtrl.SetItemText(index, 1, std::to_string(item->getReportId()).c_str()); |
| | | m_listCtrl.SetItemText(index, 2, item->getVariablesIdsText().c_str()); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CHMPropertyPage.h" |
| | | #include "ListCtrlEx.h" |
| | | |
| | | |
| | | // CPageReport å¯¹è¯æ¡ |
| | | |
| | | class CPageReport : public CHMPropertyPage |
| | | { |
| | | DECLARE_DYNAMIC(CPageReport) |
| | | |
| | | public: |
| | | CPageReport(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | virtual ~CPageReport(); |
| | | void loadReports(); |
| | | |
| | | private: |
| | | CListCtrlEx m_listCtrl; |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_PAGE_REPORT }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); |
| | | afx_msg void OnDestroy(); |
| | | afx_msg void OnSize(UINT nType, int cx, int cy); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // CPageVarialbles.cpp: å®ç°æä»¶ |
| | | // |
| | | |
| | | #include "stdafx.h" |
| | | #include "Servo.h" |
| | | #include "CPageVarialbles.h" |
| | | #include "afxdialogex.h" |
| | | |
| | | |
| | | // CPageVarialbles å¯¹è¯æ¡ |
| | | |
| | | IMPLEMENT_DYNAMIC(CPageVarialbles, CHMPropertyPage) |
| | | |
| | | CPageVarialbles::CPageVarialbles(CWnd* pParent /*=nullptr*/) |
| | | : CHMPropertyPage(IDD_PAGE_VARIABLE, pParent) |
| | | { |
| | | |
| | | } |
| | | |
| | | CPageVarialbles::~CPageVarialbles() |
| | | { |
| | | } |
| | | |
| | | void CPageVarialbles::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CHMPropertyPage::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_LIST1, m_listCtrl); |
| | | } |
| | | |
| | | |
| | | BEGIN_MESSAGE_MAP(CPageVarialbles, CHMPropertyPage) |
| | | ON_WM_CTLCOLOR() |
| | | ON_WM_DESTROY() |
| | | ON_WM_SIZE() |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | | // CPageVarialbles æ¶æ¯å¤çç¨åº |
| | | |
| | | |
| | | BOOL CPageVarialbles::OnInitDialog() |
| | | { |
| | | CHMPropertyPage::OnInitDialog(); |
| | | |
| | | |
| | | // 读åºå宽 |
| | | CString strIniFile, strItem; |
| | | strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir); |
| | | int width[8] = { 0, 218, 180, 180, 180, 180, 180, 180 }; |
| | | for (int i = 0; i < 8; i++) { |
| | | strItem.Format(_T("Col_%d_Width"), i); |
| | | width[i] = GetPrivateProfileInt("PageVariableListCtrl", strItem, width[i], strIniFile); |
| | | } |
| | | |
| | | |
| | | // æ¥è¡¨æ§ä»¶ |
| | | DWORD dwStyle = m_listCtrl.GetExtendedStyle(); |
| | | dwStyle |= LVS_EX_FULLROWSELECT; |
| | | dwStyle |= LVS_EX_GRIDLINES; |
| | | m_listCtrl.SetExtendedStyle(dwStyle); |
| | | |
| | | HIMAGELIST imageList = ImageList_Create(24, 24, ILC_COLOR24, 1, 1); |
| | | ListView_SetImageList(m_listCtrl.GetSafeHwnd(), imageList, LVSIL_SMALL); |
| | | m_listCtrl.InsertColumn(0, _T(""), LVCFMT_RIGHT, width[0]); |
| | | m_listCtrl.InsertColumn(1, _T("SV ID"), LVCFMT_LEFT, width[1]); |
| | | m_listCtrl.InsertColumn(2, _T("SV Name"), LVCFMT_LEFT, width[2]); |
| | | m_listCtrl.InsertColumn(3, _T("SV Format"), LVCFMT_LEFT, width[3]); |
| | | m_listCtrl.InsertColumn(4, _T("SV Remark"), LVCFMT_LEFT, width[4]); |
| | | loadVariables(); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE |
| | | } |
| | | |
| | | |
| | | HBRUSH CPageVarialbles::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) |
| | | { |
| | | HBRUSH hbr = CHMPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor); |
| | | |
| | | // TODO: 卿¤æ´æ¹ DC çä»»ä½ç¹æ§ |
| | | |
| | | // TODO: 妿é»è®¤ç䏿¯æéç»ç¬ï¼åè¿åå¦ä¸ä¸ªç»ç¬ |
| | | return hbr; |
| | | } |
| | | |
| | | |
| | | void CPageVarialbles::OnDestroy() |
| | | { |
| | | CHMPropertyPage::OnDestroy(); |
| | | |
| | | // ä¿åå宽 |
| | | CString strIniFile, strItem, strTemp; |
| | | strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir); |
| | | CHeaderCtrl* pHeader = m_listCtrl.GetHeaderCtrl(); |
| | | for (int i = 0; i < pHeader->GetItemCount(); i++) { |
| | | RECT rect; |
| | | pHeader->GetItemRect(i, &rect); |
| | | strItem.Format(_T("Col_%d_Width"), i); |
| | | strTemp.Format(_T("%d"), rect.right - rect.left); |
| | | WritePrivateProfileString("PageVariableListCtrl", strItem, strTemp, strIniFile); |
| | | } |
| | | } |
| | | |
| | | |
| | | void CPageVarialbles::OnSize(UINT nType, int cx, int cy) |
| | | { |
| | | CHMPropertyPage::OnSize(nType, cx, cy); |
| | | |
| | | if (GetDlgItem(IDC_LIST1) == nullptr) return; |
| | | |
| | | CWnd* pItem; |
| | | CRect rcClient, rcItem; |
| | | GetClientRect(&rcClient); |
| | | m_listCtrl.MoveWindow(12, 12, rcClient.Width() - 24, rcClient.Height() - 24); |
| | | } |
| | | |
| | | void CPageVarialbles::OnApply() |
| | | { |
| | | __super::OnApply(); |
| | | } |
| | | |
| | | void CPageVarialbles::loadVariables() |
| | | { |
| | | auto& variables = theApp.m_model.m_hsmsPassive.getVariables(); |
| | | for (auto item : variables) { |
| | | int index = m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), _T("")); |
| | | m_listCtrl.SetItemData(index, (DWORD_PTR)item); |
| | | m_listCtrl.SetItemText(index, 1, std::to_string(item->getVarialbleId()).c_str()); |
| | | m_listCtrl.SetItemText(index, 2, item->getName().c_str()); |
| | | m_listCtrl.SetItemText(index, 3, SERVO::CVariable::formatToString(item->getFormat()).c_str()); |
| | | m_listCtrl.SetItemText(index, 4, item->getRemark().c_str()); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CHMPropertyPage.h" |
| | | #include "ListCtrlEx.h" |
| | | |
| | | |
| | | // CPageVarialbles å¯¹è¯æ¡ |
| | | |
| | | class CPageVarialbles : public CHMPropertyPage |
| | | { |
| | | DECLARE_DYNAMIC(CPageVarialbles) |
| | | |
| | | public: |
| | | CPageVarialbles(CWnd* pParent = nullptr); // æ åæé 彿° |
| | | virtual ~CPageVarialbles(); |
| | | virtual void OnApply(); |
| | | void loadVariables(); |
| | | |
| | | private: |
| | | CListCtrlEx m_listCtrl; |
| | | |
| | | |
| | | // å¯¹è¯æ¡æ°æ® |
| | | #ifdef AFX_DESIGN_TIME |
| | | enum { IDD = IDD_PAGE_VARIABLE }; |
| | | #endif |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV æ¯æ |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | | virtual BOOL OnInitDialog(); |
| | | afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); |
| | | afx_msg void OnDestroy(); |
| | | afx_msg void OnSize(UINT nType, int cx, int cy); |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "CReport.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | | CReport::CReport() |
| | | { |
| | | m_nReportId = 0; |
| | | } |
| | | |
| | | CReport::CReport(unsigned int reportId, std::vector<unsigned int>& vids) |
| | | { |
| | | m_nReportId = reportId; |
| | | for (auto vid : vids) { |
| | | m_vids.push_back(vid); |
| | | } |
| | | } |
| | | |
| | | CReport::~CReport() |
| | | { |
| | | |
| | | } |
| | | |
| | | unsigned int CReport::getReportId() |
| | | { |
| | | return m_nReportId; |
| | | } |
| | | |
| | | BOOL CReport::addVariable(CVariable* pVariable) |
| | | { |
| | | ASSERT(pVariable); |
| | | if (getVariable(pVariable->getVarialbleId()) != nullptr) { |
| | | return FALSE; |
| | | } |
| | | |
| | | m_variabels.push_back(pVariable); |
| | | return TRUE; |
| | | } |
| | | |
| | | BOOL CReport::deleteVarialble(unsigned int nVarialbleId) |
| | | { |
| | | BOOL bDelete = FALSE; |
| | | for (auto iter = m_variabels.begin(); iter != m_variabels.end(); ++iter) { |
| | | if (nVarialbleId == (*iter)->getVarialbleId()) { |
| | | m_variabels.erase(iter); |
| | | bDelete = TRUE; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return bDelete; |
| | | } |
| | | |
| | | CVariable* CReport::getVariable(unsigned int nVarialbleId) |
| | | { |
| | | for (auto item : m_variabels) { |
| | | if (nVarialbleId == item->getVarialbleId()) { |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | std::vector<CVariable*>& CReport::getVariables() |
| | | { |
| | | return m_variabels; |
| | | } |
| | | |
| | | std::string CReport::getVariablesIdsText() |
| | | { |
| | | std::string strResult, strName; |
| | | for (int i = 0; i < m_vids.size(); i++) { |
| | | strResult += std::to_string(m_vids[i]); |
| | | strResult += "("; |
| | | strResult += (getVariableName(m_vids[i], strName) ? |
| | | strName : _T("null")); |
| | | strResult += ")"; |
| | | if (i != m_vids.size() - 1) { |
| | | strResult += ","; |
| | | } |
| | | } |
| | | |
| | | return strResult; |
| | | } |
| | | |
| | | bool CReport::getVariableName(unsigned int vid, std::string& strName) |
| | | { |
| | | for (auto item : m_variabels) { |
| | | if (item->getVarialbleId() == vid) { |
| | | strName = item->getName(); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "CVariable.h" |
| | | #include <vector> |
| | | |
| | | namespace SERVO { |
| | | class CReport |
| | | { |
| | | public: |
| | | CReport(); |
| | | CReport(unsigned int reportId, std::vector<unsigned int>& vids); |
| | | virtual ~CReport(); |
| | | |
| | | public: |
| | | unsigned int getReportId(); |
| | | BOOL addVariable(CVariable* pVariable); |
| | | BOOL deleteVarialble(unsigned int nVarialbleId); |
| | | CVariable* getVariable(unsigned int nVarialbleId); |
| | | std::vector<CVariable*>& getVariables(); |
| | | std::string getVariablesIdsText(); |
| | | bool getVariableName(unsigned int vid, std::string& strName); |
| | | |
| | | private: |
| | | unsigned int m_nReportId; |
| | | std::vector<unsigned int> m_vids; |
| | | std::vector<CVariable*> m_variabels; |
| | | }; |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "CVariable.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | | CVariable::CVariable() |
| | | { |
| | | m_nVarialbeId = 0; |
| | | m_format = SVFromat::U1; |
| | | } |
| | | |
| | | CVariable::CVariable(const char* pszId, const char* pszName, const char* pszFormat, const char* pszRemark) |
| | | { |
| | | m_nVarialbeId = atoi(pszId); |
| | | m_strName = pszName; |
| | | m_format = toFormat(pszFormat); |
| | | m_strRemark = pszRemark; |
| | | TRACE("CVariable .....%d,%s,%d,%s\n", m_nVarialbeId, m_strName.c_str(), |
| | | m_format, m_strRemark.c_str()); |
| | | |
| | | } |
| | | |
| | | CVariable::~CVariable() |
| | | { |
| | | |
| | | } |
| | | |
| | | SVFromat CVariable::toFormat(const char* pszFormat) |
| | | { |
| | | if (_strcmpi("U1", pszFormat) == 0) { |
| | | return SVFromat::U1; |
| | | } |
| | | if (_strcmpi("U2", pszFormat) == 0) { |
| | | return SVFromat::U2; |
| | | } |
| | | if (_strcmpi("I2", pszFormat) == 0) { |
| | | return SVFromat::I2; |
| | | } |
| | | if (_strcmpi("A50", pszFormat) == 0) { |
| | | return SVFromat::A50; |
| | | } |
| | | if (_strcmpi("A20", pszFormat) == 0) { |
| | | return SVFromat::A20; |
| | | } |
| | | |
| | | return SVFromat::U1; |
| | | } |
| | | |
| | | |
| | | std::string CVariable::formatToString(SVFromat format) |
| | | { |
| | | if (SVFromat::U1 == format) { |
| | | return "U1"; |
| | | } |
| | | if (SVFromat::U2 == format) { |
| | | return "U1"; |
| | | } |
| | | if (SVFromat::I2 == format) { |
| | | return "I2"; |
| | | } |
| | | if (SVFromat::A50 == format) { |
| | | return "A50"; |
| | | } |
| | | if (SVFromat::A20 == format) { |
| | | return "A20"; |
| | | } |
| | | |
| | | return "U1"; |
| | | } |
| | | |
| | | unsigned int CVariable::getVarialbleId() |
| | | { |
| | | return m_nVarialbeId; |
| | | } |
| | | |
| | | std::string& CVariable::getName() |
| | | { |
| | | return m_strName; |
| | | } |
| | | |
| | | SVFromat CVariable::getFormat() |
| | | { |
| | | return m_format; |
| | | } |
| | | |
| | | std::string& CVariable::getRemark() |
| | | { |
| | | return m_strRemark; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include <string> |
| | | |
| | | |
| | | namespace SERVO { |
| | | // åéæ ¼å¼ |
| | | enum class SVFromat { |
| | | U1 = 0, |
| | | U2, |
| | | I2, |
| | | A20, |
| | | A50 |
| | | }; |
| | | |
| | | class CVariable |
| | | { |
| | | public: |
| | | CVariable(); |
| | | CVariable(const char* pszId, const char* pszName, const char* pszFormat, const char* pszRemark); |
| | | ~CVariable(); |
| | | |
| | | public: |
| | | static SVFromat toFormat(const char* pszFormat); |
| | | static std::string formatToString(SVFromat format); |
| | | unsigned int getVarialbleId(); |
| | | std::string& getName(); |
| | | SVFromat getFormat(); |
| | | std::string& getRemark(); |
| | | |
| | | private: |
| | | unsigned int m_nVarialbeId; |
| | | std::string m_strName; |
| | | SVFromat m_format; |
| | | std::string m_strRemark; |
| | | }; |
| | | } |
| | | |
| | |
| | | #include "stdafx.h" |
| | | #include "stdafx.h" |
| | | #include "HsmsPassive.h" |
| | | #include "Log.h" |
| | | #include "Model.h" |
| | |
| | | #include <time.h> |
| | | #include <stdlib.h> |
| | | #include <string.h> |
| | | #include <regex> |
| | | |
| | | |
| | | const char ACK[2] = {0, 1}; |
| | | const char* ACK0 = &ACK[0]; |
| | | const char* ACK1 = &ACK[1]; |
| | | |
| | | unsigned __stdcall CimWorkThreadFunction(LPVOID lpParam) |
| | | { |
| | |
| | | |
| | | void CHsmsPassive::setListener(SECSListener listener) |
| | | { |
| | | m_listener.onEQOffLine = listener.onEQOffLine; |
| | | m_listener.onEQOnLine = listener.onEQOnLine; |
| | | m_listener.onCommand = listener.onCommand; |
| | | m_listener.onEQConstantRequest = listener.onEQConstantRequest; |
| | | m_listener.onEQConstantSend = listener.onEQConstantSend; |
| | | m_listener = listener; |
| | | } |
| | | |
| | | void CHsmsPassive::setActionTimeout(int nSecond) |
| | |
| | | |
| | | } |
| | | |
| | | void CHsmsPassive::addReport(unsigned int id, const char* pszName) |
| | | void CHsmsPassive::linkEventReport(unsigned int CEID, unsigned int RPTID) |
| | | { |
| | | Lock(); |
| | | REPORT report; |
| | | report.id = id; |
| | | strcpy_s(report.szName, REPORT_NAME_MAX, pszName); |
| | | m_mapReport[id] = report; |
| | | Unlock(); |
| | | } |
| | | |
| | | void CHsmsPassive::linkEventReport(unsigned int RPTID, unsigned int CEID) |
| | | { |
| | | m_mapReportIdToCEID[RPTID] = CEID; |
| | | SERVO::CCollectionEvent* pEvent = getEvent(CEID); |
| | | SERVO::CReport* pReport = getReport(RPTID); |
| | | if (pEvent != nullptr) { |
| | | pEvent->setReport(pReport); |
| | | } |
| | | } |
| | | |
| | | void CHsmsPassive::unlinkEventReport(unsigned int CEID) |
| | | { |
| | | for (auto it = m_mapReportIdToCEID.begin(); it != m_mapReportIdToCEID.end(); ) { |
| | | if (it->second == CEID) { |
| | | m_mapReportIdToCEID.erase(it++); // æ´æ°è¿ä»£å¨ |
| | | } |
| | | else { |
| | | ++it; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | unsigned int CHsmsPassive::getCEID(int RPTID) |
| | | { |
| | | auto iter = m_mapReportIdToCEID.find(RPTID); |
| | | if (iter != m_mapReportIdToCEID.end()) return iter->second; |
| | | return 0; |
| | | } |
| | | |
| | | void CHsmsPassive::deleteReport(unsigned int RPTID) |
| | | { |
| | | for (auto it = m_mapValueIdToPRTID.begin(); it != m_mapValueIdToPRTID.end(); ) { |
| | | if (it->second == RPTID) { |
| | | m_mapValueIdToPRTID.erase(it++); // æ´æ°è¿ä»£å¨ |
| | | } |
| | | else { |
| | | ++it; |
| | | } |
| | | SERVO::CCollectionEvent* pEvent = getEvent(CEID); |
| | | if (pEvent != nullptr) { |
| | | pEvent->setReport(nullptr); |
| | | } |
| | | } |
| | | |
| | | void CHsmsPassive::deleteAllReport() |
| | | SERVO::CReport* CHsmsPassive::defineReport(unsigned int RPTID, std::vector<unsigned int>& vids) |
| | | { |
| | | m_mapValueIdToPRTID.clear(); |
| | | } |
| | | // æ·»å å®ä¹report |
| | | SERVO::CReport* pReport = new SERVO::CReport(RPTID, vids); |
| | | for (auto vid : vids) { |
| | | SERVO::CVariable* pVariable = getVariable(vid); |
| | | if (pVariable != nullptr) { |
| | | pReport->addVariable(pVariable); |
| | | } |
| | | } |
| | | m_reports.push_back(pReport); |
| | | |
| | | void CHsmsPassive::defineReport(unsigned int VID, unsigned int RPTID) |
| | | { |
| | | m_mapValueIdToPRTID[VID] = RPTID; |
| | | return pReport; |
| | | } |
| | | |
| | | void CHsmsPassive::OnTimer(UINT nTimerid) |
| | | { |
| | | // ææå·²åéçActionèªå 1 |
| | | // ææå·²åéçActionèªå 1 |
| | | Lock(); |
| | | for (auto iter = m_listActionSent.begin(); iter != m_listActionSent.end();) { |
| | | if ((*iter)->incrementAndCheckTimeout()) { |
| | | TRACE("CHsmsPassive::è¶
æ¶\n"); |
| | | TRACE("CHsmsPassive::è¶
æ¶\n"); |
| | | delete (*iter); |
| | | m_listActionSent.erase(iter++); |
| | | } |
| | |
| | | CHsmsAction* pAction = nullptr; |
| | | for (auto iter = m_listActionSent.begin(); iter != m_listActionSent.end(); iter++) { |
| | | if ((*iter)->getSendMessage()->getHeader()->systemBytes == pMessage->getHeader()->systemBytes) { |
| | | LOGI("CHsmsPassive::æ¾å°"); |
| | | LOGI("CHsmsPassive::æ¾å°"); |
| | | pAction = (*iter); |
| | | m_listActionSent.erase(iter); |
| | | break; |
| | |
| | | Unlock(); |
| | | |
| | | if (pAction != nullptr) { |
| | | LOGI("onRecvMsg::ç¸åºå¤ç"); |
| | | LOGI("onRecvMsg::ç¸åºå¤ç"); |
| | | delete pAction; |
| | | } |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsPassive::loadVarialbles(const char* pszFilepath) |
| | | { |
| | | CStdioFile file; |
| | | if (!file.Open(pszFilepath, CFile::modeRead)) { |
| | | return -1; |
| | | } |
| | | |
| | | std::regex pattern("^\\d+,.*"); // å¹é
以æ°å+éå·å¼å¤´çå符串 |
| | | std::vector<SERVO::CVariable*> variables; |
| | | int index, last; |
| | | CString strLine; |
| | | CString strId, strName, strFormat, strRemark; |
| | | while (file.ReadString(strLine)) { |
| | | if (!std::regex_match((LPTSTR)(LPCTSTR)strLine, pattern)) { |
| | | continue; |
| | | } |
| | | |
| | | last = 0; |
| | | index = strLine.Find(",", last); |
| | | if (index < 0) continue; |
| | | strId = strLine.Left(index); |
| | | last = index + 1; |
| | | |
| | | index = strLine.Find(",", last); |
| | | if (index < 0) continue; |
| | | strName = strLine.Mid(last, index - last); |
| | | last = index + 1; |
| | | |
| | | index = strLine.Find(",", last); |
| | | if (index < 0) continue; |
| | | strFormat = strLine.Mid(last, index - last); |
| | | strRemark = strLine.Right(strLine.GetLength() - index - 1); |
| | | strRemark.Replace(_T("\\r\\n"), _T("\r\n")); |
| | | |
| | | SERVO::CVariable* pVarialble = new SERVO::CVariable( |
| | | (LPTSTR)(LPCTSTR)strId, (LPTSTR)(LPCTSTR)strName, (LPTSTR)(LPCTSTR)strFormat, (LPTSTR)(LPCTSTR)strRemark); |
| | | variables.push_back(pVarialble); |
| | | } |
| | | |
| | | if (!variables.empty()) { |
| | | clearAllVariabel(); |
| | | for (auto item : variables) { |
| | | m_variabels.push_back(item); |
| | | } |
| | | } |
| | | |
| | | |
| | | file.Close(); |
| | | return 0; |
| | | } |
| | | |
| | | std::vector<SERVO::CVariable*>& CHsmsPassive::getVariables() |
| | | { |
| | | return m_variabels; |
| | | } |
| | | |
| | | SERVO::CVariable* CHsmsPassive::getVariable(int variableId) |
| | | { |
| | | for (auto item : m_variabels) { |
| | | if (item->getVarialbleId() == variableId) { |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | void CHsmsPassive::clearAllVariabel() |
| | | { |
| | | for (auto item : m_variabels) { |
| | | delete item; |
| | | } |
| | | m_variabels.clear(); |
| | | } |
| | | |
| | | int CHsmsPassive::loadReports(const char* pszFilepath) |
| | | { |
| | | CStdioFile file; |
| | | if (!file.Open(pszFilepath, CFile::modeRead)) { |
| | | return -1; |
| | | } |
| | | |
| | | std::regex pattern("^\\d+,\\(\\d+(,\\d+)*\\).*"); // å¹é
以æ°å+éå·å¼å¤´çå符串 |
| | | std::vector<SERVO::CReport*> reports; |
| | | int index; |
| | | CString strLine, strVariable; |
| | | CString strId; |
| | | while (file.ReadString(strLine)) { |
| | | if (!std::regex_match((LPTSTR)(LPCTSTR)strLine, pattern)) { |
| | | continue; |
| | | } |
| | | |
| | | index = strLine.Find(",", 0); |
| | | if (index < 0) continue; |
| | | strId = strLine.Left(index); |
| | | strVariable = strLine.Right(strLine.GetLength() - index - 1); |
| | | strVariable.Delete(0); |
| | | strVariable.Delete(strVariable.GetLength() - 1); |
| | | auto vids = parseVidList(strVariable); |
| | | |
| | | SERVO::CReport* pReport = new SERVO::CReport(atoi((LPTSTR)(LPCTSTR)strId), vids); |
| | | for (auto vid : vids) { |
| | | SERVO::CVariable* pVariable = getVariable(vid); |
| | | if (pVariable != nullptr) { |
| | | pReport->addVariable(pVariable); |
| | | } |
| | | } |
| | | |
| | | reports.push_back(pReport); |
| | | } |
| | | |
| | | if (!reports.empty()) { |
| | | clearAllReport(); |
| | | for (auto item : reports) { |
| | | m_reports.push_back(item); |
| | | } |
| | | } |
| | | |
| | | |
| | | file.Close(); |
| | | return 0; |
| | | } |
| | | |
| | | std::vector<SERVO::CReport*>& CHsmsPassive::getReports() |
| | | { |
| | | return m_reports; |
| | | } |
| | | |
| | | SERVO::CReport* CHsmsPassive::getReport(int rptid) |
| | | { |
| | | for (auto item : m_reports) { |
| | | if (item->getReportId() == rptid) { |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | bool CHsmsPassive::removeReport(int rptid) |
| | | { |
| | | for (auto iter = m_reports.begin(); iter != m_reports.end(); ++iter) { |
| | | if ((*iter)->getReportId() == rptid) { |
| | | delete (*iter); |
| | | m_reports.erase(iter); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | void CHsmsPassive::clearAllReport() |
| | | { |
| | | for (auto item : m_reports) { |
| | | delete item; |
| | | } |
| | | m_reports.clear(); |
| | | } |
| | | |
| | | int CHsmsPassive::loadCollectionEvents(const char* pszFilepath) |
| | | { |
| | | CStdioFile file; |
| | | if (!file.Open(pszFilepath, CFile::modeRead)) { |
| | | return -1; |
| | | } |
| | | |
| | | std::regex pattern("^\\d+,[^,]*,[^,]*,\\(\\d+(,\\d+)*\\).*"); // å¹é
以æ°å+éå·å¼å¤´çå符串 |
| | | std::vector<SERVO::CCollectionEvent*> events; |
| | | int index, last; |
| | | CString strLine, strRPTIDs; |
| | | CString strId, strName, strDescription; |
| | | while (file.ReadString(strLine)) { |
| | | if (!std::regex_match((LPTSTR)(LPCTSTR)strLine, pattern)) { |
| | | continue; |
| | | } |
| | | |
| | | last = 0; |
| | | index = strLine.Find(",", last); |
| | | if (index < 0) continue; |
| | | strId = strLine.Left(index); |
| | | last = index + 1; |
| | | |
| | | index = strLine.Find(",", last); |
| | | if (index < 0) continue; |
| | | strName = strLine.Mid(last, index - last); |
| | | last = index + 1; |
| | | |
| | | index = strLine.Find(",", last); |
| | | if (index < 0) continue; |
| | | strDescription = strLine.Mid(last, index - last); |
| | | strRPTIDs = strLine.Right(strLine.GetLength() - index - 1); |
| | | strRPTIDs.Delete(0); |
| | | strRPTIDs.Delete(strRPTIDs.GetLength() - 1); |
| | | auto prtids = parseVidList(strRPTIDs); |
| | | |
| | | SERVO::CCollectionEvent* pEvent = new SERVO::CCollectionEvent( |
| | | atoi(strId), (LPTSTR)(LPCTSTR)strName, (LPTSTR)(LPCTSTR)strDescription, prtids); |
| | | for (auto rptid : prtids) { |
| | | SERVO::CReport* pReport = getReport(rptid); |
| | | if (pReport != nullptr) { |
| | | pEvent->addReport(pReport); |
| | | } |
| | | } |
| | | events.push_back(pEvent); |
| | | } |
| | | |
| | | if (!events.empty()) { |
| | | clearAllCollectionEvent(); |
| | | for (auto item : events) { |
| | | m_collectionEvents.push_back(item); |
| | | } |
| | | } |
| | | |
| | | |
| | | file.Close(); |
| | | return 0; |
| | | } |
| | | |
| | | std::vector<SERVO::CCollectionEvent*>& CHsmsPassive::getCollectionEvents() |
| | | { |
| | | return m_collectionEvents; |
| | | } |
| | | |
| | | void CHsmsPassive::clearAllCollectionEvent() |
| | | { |
| | | for (auto item : m_collectionEvents) { |
| | | delete item; |
| | | } |
| | | m_collectionEvents.clear(); |
| | | } |
| | | |
| | | SERVO::CCollectionEvent* CHsmsPassive::getEvent(unsigned short CEID) |
| | | { |
| | | for (auto item : m_collectionEvents) { |
| | | if (item->getEventId() == CEID) { |
| | | return item; |
| | | } |
| | | } |
| | | |
| | | return nullptr; |
| | | } |
| | | |
| | | std::vector<unsigned int> CHsmsPassive::parseVidList(CString& strNums) |
| | | { |
| | | // 1. å
廿å¯è½åºç°ç空ç½ç¬¦ï¼ç©ºæ ¼ãå¶è¡¨ç¬¦çï¼ |
| | | strNums.Trim(); |
| | | |
| | | // 2ï¸. |
| | | std::vector<unsigned int> result; |
| | | int i = 0; |
| | | CString strVid; |
| | | while (1) { |
| | | if (!AfxExtractSubString(strVid, (LPCTSTR)strNums, i, ',')) { |
| | | break; |
| | | } |
| | | if (!strVid.IsEmpty()) // é²å¾¡æ§æ£æ¥ |
| | | result.push_back(std::stoi((LPTSTR)(LPCTSTR)strVid)); |
| | | i++; |
| | | |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | int CHsmsPassive::init(CModel* pModel, const char* pszName, unsigned int port) |
| | |
| | | auto onStatusChanged = [&](void* pFrom, STATE state) -> void { |
| | | m_pModel->notifyInt(RX_CODE_PASSIVE_STATUS_CHANGED, (int)state); |
| | | |
| | | // è¿ä¸ä¹ååS1F1 |
| | | // ä¿®æ¹ä¸ºä¸ä¸»å¨åéï¼èæ¯ååº |
| | | // è¿ä¸ä¹ååS1F1 |
| | | // ä¿®æ¹ä¸ºä¸ä¸»å¨åéï¼èæ¯ååº |
| | | /* |
| | | if (STATE::SELECTED == state) { |
| | | m_bAreYouThereRequest = FALSE; |
| | |
| | | HEADER* pHeader = pMessage->getHeader(); |
| | | int nStream = (pHeader->stream & 0x7F); |
| | | |
| | | LOGI("<HSMS>æ¶å°æ¶æ¯ S%dF%d", nStream, pHeader->function); |
| | | LOGI("<HSMS>æ¶å°æ¶æ¯ S%dF%d", nStream, pHeader->function); |
| | | if (nStream == 1 && pHeader->function == 1) { |
| | | // S1F1 |
| | | replyAreYouThere(pMessage); |
| | |
| | | else if (nStream == 2 && pHeader->function == 41) { |
| | | replyCommand(pMessage); |
| | | } |
| | | else if (nStream == 2 && pHeader->function == 43) { |
| | | replyConfigureSpooling(pMessage); |
| | | } |
| | | else if (nStream == 5 && pHeader->function == 3) { |
| | | replyEanbleDisableAlarmReport(pMessage); |
| | | } |
| | |
| | | listener.funError = onError; |
| | | m_pPassive->setListener(listener); |
| | | |
| | | // å¯å¨å·¥ä½çº¿ç¨ |
| | | // å¯å¨å·¥ä½çº¿ç¨ |
| | | m_bCimWorking = TRUE; |
| | | m_hCimWorkThreadHandle = (HANDLE)_beginthreadex(NULL, 0, ::CimWorkThreadFunction, this, |
| | | 0, &m_nCimWorkThrdaddr); |
| | |
| | | |
| | | int CHsmsPassive::term() |
| | | { |
| | | // ç»æçº¿ç¨ |
| | | // ç»æçº¿ç¨ |
| | | m_bCimWorking = FALSE; |
| | | SetEvent(m_hCimWorkEvent); |
| | | if (m_hCimWorkThreadHandle != NULL) { |
| | |
| | | m_pPassive = NULL; |
| | | } |
| | | |
| | | clearAllVariabel(); |
| | | clearAllReport(); |
| | | clearAllCollectionEvent(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | |
| | | { |
| | | while (m_bCimWorking) { |
| | | |
| | | // å¾
éåºä¿¡å·ææ¶é´å° |
| | | // å¾
éåºä¿¡å·ææ¶é´å° |
| | | int nRet = WaitForSingleObject(m_hCimWorkEvent, INFINITE); |
| | | ResetEvent(m_hCimWorkEvent); |
| | | if (!m_bCimWorking) break; |
| | | |
| | | // ååºè¯·æ±å表并è¿è¡å¤ç |
| | | // ååºè¯·æ±å表并è¿è¡å¤ç |
| | | std::list<CHsmsAction*> list; |
| | | Lock(); |
| | | list.splice(list.end(), m_listAction); |
| | |
| | | LOGI("<HSMS> [SEND] SysByte=%u sessionId:%d", pMessage->getHeader()->systemBytes, pMessage->getHeader()->sessionId); |
| | | |
| | | if (pAction->isNeedWaitReply()) { |
| | | // 妿éè¦çå¾
åå¤ |
| | | // 妿éè¦çå¾
åå¤ |
| | | int nRet = WaitForSingleObject(pAction->getEvent(), pAction->getTimeout() * 1000); |
| | | if (nRet == WAIT_TIMEOUT) { |
| | | TRACE("Timeout...\n"); |
| | | CContext* pContext = pAction->getContext(); |
| | | if (pContext != NULL) { |
| | | //pContext->setRetCode(CRC_TIMEOUT); |
| | | //pContext->setRetMsg("è¶
æ¶"); |
| | | //pContext->setRetMsg("è¶
æ¶"); |
| | | //pContext->setEvent(); |
| | | } |
| | | } |
| | |
| | | return 0; |
| | | } |
| | | |
| | | // éç¨çreply ack彿° |
| | | // éç¨çreply ack彿° |
| | | void CHsmsPassive::replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName) |
| | | { |
| | | IMessage* pMessage = NULL; |
| | |
| | | } |
| | | |
| | | |
| | | // 交ç±ä¸å±åºç¨æ¥è·åæºå¨å¸¸éå¼ |
| | | // 交ç±ä¸å±åºç¨æ¥è·åæºå¨å¸¸éå¼ |
| | | if (m_listener.onEQOffLine != nullptr) { |
| | | m_listener.onEQOffLine(this); |
| | | } |
| | | |
| | | |
| | | // åå¤ |
| | | // åå¤ |
| | | replyAck(1, 16, pRecv->getHeader()->systemBytes, BYTE(0), "OFLACK"); |
| | | return 0; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // 交ç±ä¸å±åºç¨æ¥è·åæºå¨å¸¸éå¼ |
| | | // 交ç±ä¸å±åºç¨æ¥è·åæºå¨å¸¸éå¼ |
| | | if (m_listener.onEQOnLine != nullptr) { |
| | | m_listener.onEQOnLine(this); |
| | | } |
| | | |
| | | |
| | | // åå¤ |
| | | // åå¤ |
| | | replyAck(1, 18, pRecv->getHeader()->systemBytes, BYTE(0), "ONLACK"); |
| | | return 0; |
| | | } |
| | |
| | | ASSERT(pMessage); |
| | | |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->addBinaryItem(BYTE(0), "COMMACK"); |
| | | pItem->addBinaryItem(ACK0, 1, "COMMACK"); |
| | | ISECS2Item* pList = pItem->addItem(); |
| | | pList->addItem(m_strEquipmentModelType.c_str(), "MDLN"); |
| | | pList->addItem(m_strSoftRev.c_str(), "SOFTREV"); |
| | | m_pPassive->sendMessage(pMessage); |
| | | LOGI("<HSMS>[SECS Msg SEND]S1F14 (SysByte=%u)", pMessage->getHeader()->systemBytes); |
| | | LOGI("<HSMS>[SECS Msg SEND]%s", pMessage->toString()); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | return 0; |
| | |
| | | } |
| | | |
| | | |
| | | // è¦è·åç常é表表 |
| | | // è¦è·åç常é表表 |
| | | BOOL bCheckData = FALSE; |
| | | std::vector<EQConstant> eqcs; |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | // 交ç±ä¸å±åºç¨æ¥è·åæºå¨å¸¸éå¼ |
| | | // 交ç±ä¸å±åºç¨æ¥è·åæºå¨å¸¸éå¼ |
| | | if (m_listener.onEQConstantRequest != nullptr) { |
| | | m_listener.onEQConstantRequest(this, eqcs); |
| | | } |
| | | |
| | | |
| | | // åå¤ |
| | | // åå¤ |
| | | IMessage* pMessage = NULL; |
| | | HSMS_Create1Message(pMessage, m_nSessionId, 1, 14, pRecv->getHeader()->systemBytes); |
| | | ASSERT(pMessage); |
| | |
| | | } |
| | | |
| | | |
| | | // è¦è®¾ç½®ç常é表表 |
| | | // è¦è®¾ç½®ç常é表表 |
| | | BOOL bCheckData = FALSE; |
| | | std::vector<EQConstant> eqcs; |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | // 交ç±ä¸å±åºç¨æ¥ä¿åå设置æºå¨å¸¸éå¼ |
| | | // 交ç±ä¸å±åºç¨æ¥ä¿åå设置æºå¨å¸¸éå¼ |
| | | std::vector<unsigned int> ecvs; |
| | | if (m_listener.onEQConstantSend != nullptr) { |
| | | m_listener.onEQConstantSend(this, eqcs); |
| | | } |
| | | |
| | | |
| | | // åå¤ |
| | | // åå¤ |
| | | replyAck(2, 16, pRecv->getHeader()->systemBytes, BYTE(0), "EACK"); |
| | | return 0; |
| | | } |
| | |
| | | if (pBody == nullptr || pBody->getType() != SITYPE::A) ER_PARAM_ERROR; |
| | | const char* pszMessage; |
| | | if (pBody->getString(pszMessage)) { |
| | | // æ´æ°æ¶é´ |
| | | // æ´æ°æ¶é´ |
| | | SYSTEMTIME time; |
| | | char szBuffer[20]; |
| | | memcpy(szBuffer, pszMessage, 16); |
| | |
| | | time.wYear = atoi(&szBuffer[0]); |
| | | time.wMilliseconds = 0; |
| | | SetLocalTime(&time); |
| | | if (m_listener.onDatetimeSync != nullptr) { |
| | | m_listener.onDatetimeSync(this, time); |
| | | } |
| | | } |
| | | |
| | | replyAck(2, 32, pRecv->getHeader()->systemBytes, BYTE(0), "TIACK"); |
| | |
| | | ISECS2Item* pBody = pRecv->getBody(); |
| | | ISECS2Item* defineItem, *rptListItem, * vidListItem; |
| | | unsigned int dataId, rptid, vid; |
| | | |
| | | if (!pBody->getSubItemU4(0, dataId)) goto MYREPLY; |
| | | rptListItem = pBody->getSubItem(1); |
| | | if (rptListItem == nullptr) goto MYREPLY; |
| | | if (rptListItem->getSubItemSize() == 0) { |
| | | deleteAllReport(); |
| | | clearAllReport(); |
| | | goto MYREPLY; |
| | | } |
| | | |
| | | for (int i = 0; i < rptListItem->getSubItemSize(); i++) { |
| | | defineItem = rptListItem->getSubItem(i); |
| | | if (defineItem == nullptr) continue; |
| | | |
| | | std::vector<unsigned int> vids; |
| | | SERVO::CReport* pReport = nullptr; |
| | | vidListItem = defineItem->getSubItem(1); |
| | | if (defineItem->getSubItemU4(0, rptid) |
| | | && vidListItem != nullptr) { |
| | | int vidCount = vidListItem->getSubItemSize(); |
| | | if (vidCount == 0) { |
| | | deleteReport(rptid); |
| | | } |
| | | else { |
| | | for (int k = 0; k < vidCount; k++) { |
| | | if (vidListItem->getSubItemU4(k, vid)) { |
| | | defineReport(vid, rptid); |
| | | } |
| | | for (int k = 0; k < vidListItem->getSubItemSize(); k++) { |
| | | if (vidListItem->getSubItemU4(k, vid)) { |
| | | vids.push_back(vid); |
| | | } |
| | | } |
| | | } |
| | | |
| | | removeReport(rptid); |
| | | if (!vids.empty()) { |
| | | pReport = defineReport(rptid, vids); |
| | | } |
| | | |
| | | // æ£éªç»ææ¯å¦æ£ç¡® |
| | | if (pReport != nullptr) { |
| | | auto variables = pReport->getVariables(); |
| | | for (auto item : variables) { |
| | | LOGE("=== prtid:%d, vid:%d", rptid, item->getVarialbleId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | MYREPLY: |
| | | // æ£éªç»ææ¯å¦æ£ç¡® |
| | | for (auto item : m_mapValueIdToPRTID) { |
| | | LOGE("=== vid:%d, prtid:%d", item.first, item.second); |
| | | } |
| | | |
| | | replyAck(2, 34, pRecv->getHeader()->systemBytes, BYTE(0), "DRACK"); |
| | | return 0; |
| | | } |
| | |
| | | else { |
| | | for (int k = 0; k < prtCount; k++) { |
| | | if (rptListItem->getSubItemU4(k, rptid)) { |
| | | linkEventReport(rptid, ceid); |
| | | linkEventReport(ceid, rptid); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | // æ£éªç»ææ¯å¦æ£ç¡® |
| | | for (auto item : m_mapReportIdToCEID) { |
| | | LOGE("=== prtid:%d, ceid:%d", item.first, item.second); |
| | | // æ£éªç»ææ¯å¦æ£ç¡® |
| | | for (auto item : m_collectionEvents) { |
| | | LOGE("=== ceid:%d, prtid:%d", item->getEventId(), item->getPortID()); |
| | | } |
| | | |
| | | |
| | | MYREPLY: |
| | | replyAck(2, 36, pRecv->getHeader()->systemBytes, BYTE(0), "LRACK"); |
| | | return 0; |
| | |
| | | } |
| | | } |
| | | bCheckData = TRUE; |
| | | LOGI("EanbleDisableAlarm bEnable:%s", bEnable ? _T("YES") : _T("NO")); |
| | | for (auto item : ids) { |
| | | LOGI("ID:%u", item); |
| | | if (m_listener.onEnableDisableEventReport != nullptr) { |
| | | m_listener.onEnableDisableEventReport(this, bEnable, ids); |
| | | } |
| | | } |
| | | |
| | | |
| | | MYREPLY: |
| | | replyAck(2, 38, pRecv->getHeader()->systemBytes, BYTE(0), "ERACK"); |
| | | replyAck(2, 38, pRecv->getHeader()->systemBytes, |
| | | bCheckData ? BYTE(0) : BYTE(1), "ERACK"); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | // åè°å°åºç¨å± |
| | | // åè°å°åºç¨å± |
| | | if (bCheckData) { |
| | | if (m_listener.onCommand != nullptr) { |
| | | m_listener.onCommand(this, pszCmdName, params); |
| | | } |
| | | } |
| | | |
| | | MYREPLY: |
| | | replyAck(2, 42, pRecv->getHeader()->systemBytes, BYTE(0), "ERACK"); |
| | | return 0; |
| | | } |
| | | |
| | | // S2F43 |
| | | int CHsmsPassive::replyConfigureSpooling(IMessage* pRecv) |
| | | { |
| | | if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) { |
| | | return ER_NOTSELECT; |
| | | } |
| | | ISECS2Item* pBody = pRecv->getBody(); |
| | | if (pBody == nullptr || pBody->getType() != SITYPE::L) ER_PARAM_ERROR; |
| | | |
| | | // æ¸
ç©ºææ |
| | | if (pBody->getSubItemSize() == 0) { |
| | | m_spoolingConfig.clear(); |
| | | goto MYREPLY; |
| | | } |
| | | |
| | | // 便¬¡é
ç½®Stream |
| | | for (int i = 0; i < pBody->getSubItemSize(); i++) { |
| | | ISECS2Item* pStreamItem = pBody->getSubItem(i); |
| | | ASSERT(pStreamItem); |
| | | unsigned char STRID, FCNID; |
| | | pStreamItem->getSubItemU1(0, STRID); |
| | | ISECS2Item* pFcnItemList = pStreamItem->getSubItem(1); |
| | | if (pFcnItemList->getSubItemSize() == 0) { |
| | | m_spoolingConfig[STRID].clear(); |
| | | } |
| | | else { |
| | | for (int j = 0; j < pFcnItemList->getSubItemSize(); j++) { |
| | | pFcnItemList->getSubItemU1(j, FCNID); |
| | | m_spoolingConfig[STRID].insert(FCNID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æå°éªè¯ç»æ |
| | | for (auto s : m_spoolingConfig) { |
| | | LOGI("====> stream:%d", s.first); |
| | | for (auto f : s.second) { |
| | | LOGI("function:%d", f); |
| | | } |
| | | } |
| | | MYREPLY: |
| | | replyAck(2, 42, pRecv->getHeader()->systemBytes, BYTE(0), "ERACK"); |
| | | return 0; |
| | |
| | | if (!pItem->getSubItemU4(1, ALID)) goto MYREPLY; |
| | | bCheckData = TRUE; |
| | | LOGI("EanbleDisableAlarmReport ALED:0x%02x, ALID:%d", ALED[0], ALID); |
| | | |
| | | double d; |
| | | float f; |
| | | pItem->getSubItemF4(2, f); |
| | | pItem->getSubItemF8(3, d); |
| | | LOGI("EanbleDisableAlarmReport d:%lf, f:%f", |
| | | d, f); |
| | | /* |
| | | unsigned long long n1; |
| | | unsigned int n2; |
| | | unsigned short n3; |
| | | unsigned char n4; |
| | | long long sn1; |
| | | int sn2; |
| | | short sn3; |
| | | char sn4; |
| | | pItem->getSubItemU8(2, n1); |
| | | pItem->getSubItemU4(3, n2); |
| | | pItem->getSubItemU2(4, n3); |
| | | pItem->getSubItemU1(5, n4); |
| | | pItem->getSubItemI8(6, sn1); |
| | | pItem->getSubItemI4(7, sn2); |
| | | pItem->getSubItemI2(8, sn3); |
| | | pItem->getSubItemI1(9, sn4); |
| | | |
| | | LOGI("EanbleDisableAlarmReport n1:%llu, n2:%u, n3:%hu, n4:%hhu", |
| | | n1, n2, n3, n4); |
| | | LOGI("EanbleDisableAlarmReport sn1:%lld, sn2:%d, sn3:%hd, sn4:%hhd", |
| | | sn1, sn2, sn3, sn4); |
| | | */ |
| | | if (m_listener.onEnableDisableAlarmReport != nullptr) { |
| | | m_listener.onEnableDisableAlarmReport(this, ALED[0] != 0, ALID); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | return ER_NOTSELECT; |
| | | } |
| | | |
| | | char szALCD[1]; |
| | | szALCD[0] = ALCD & 0xff; |
| | | |
| | | Lock(); |
| | | CHsmsAction* pAction = new CHsmsAction(ACTION_ALARM_REPORT, TRUE, m_nActionTimeout); |
| | | m_listAction.push_back(pAction); |
| | |
| | | HSMS_Create1Message(pMessage, m_nSessionId, 5 | REPLY, 1, ++m_nSystemByte); |
| | | ASSERT(pMessage); |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->addBinaryItem(BYTE(ALCD & 0xff), "ALCD"); |
| | | pItem->addBinaryItem(szALCD, 1, "ALCD"); |
| | | pItem->addU4Item(ALID, "ALID"); |
| | | pItem->addItem(ALTX, "ALTX"); |
| | | pAction->setSendMessage(pMessage); |
| | |
| | | } |
| | | |
| | | // S6F11 |
| | | int CHsmsPassive::requestEventReportSend(unsigned int DATAID, unsigned int RPTID, const std::vector<std::string>& values) |
| | | int CHsmsPassive::requestEventReportSend(unsigned int DATAID, unsigned int CEID, const std::vector<std::string>& values) |
| | | { |
| | | if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) { |
| | | return ER_NOTSELECT; |
| | | } |
| | | |
| | | SERVO::CCollectionEvent* pEvent = getEvent(CEID); |
| | | if (pEvent == nullptr) { |
| | | return ER_NO_EVENT; |
| | | } |
| | | if (pEvent == nullptr) { |
| | | return ER_UNLINK_EVENT_REPORT; |
| | | } |
| | | |
| | | Lock(); |
| | |
| | | ASSERT(pMessage); |
| | | ISECS2Item* pItem = pMessage->getBody(); |
| | | pItem->addU4Item(DATAID, "DATAID"); |
| | | pItem->addU4Item(getCEID(RPTID), "CEID"); |
| | | pItem->addU4Item(CEID, "CEID"); |
| | | ISECS2Item* pItemList1 = pItem->addItem(); |
| | | ISECS2Item* pItemList2 = pItemList1->addItem(); |
| | | pItemList2->addU4Item(RPTID, "RPTID"); |
| | | pItemList2->addU4Item(pEvent->getPortID(), "RPTID"); |
| | | ISECS2Item* pItemList3 = pItemList2->addItem(); |
| | | for (auto item : values) { |
| | | pItemList3->addItem(item.c_str(), "V"); |
| | |
| | | #include <functional> |
| | | #include <vector> |
| | | #include <map> |
| | | #include <set> |
| | | #include "CCollectionEvent.h" |
| | | |
| | | |
| | | #define EQCONSTANT_VALUE_MAX 64 |
| | |
| | | #define VALUE_NAME_MAX 64 |
| | | |
| | | |
| | | #define ER_NOERROR 0 |
| | | #define ER_NOTSELECT -1 |
| | | #define ER_BUSY -2 |
| | | #define ER_PARAM_ERROR -3 |
| | | #define ER_NOERROR 0 |
| | | #define ER_NOTSELECT -1 |
| | | #define ER_BUSY -2 |
| | | #define ER_PARAM_ERROR -3 |
| | | #define ER_NO_EVENT -4 |
| | | #define ER_UNLINK_EVENT_REPORT -5 |
| | | |
| | | |
| | | /* |
| | |
| | | typedef std::function<void(void* pFrom)> SECSEQOFFLINE; |
| | | typedef std::function<void(void* pFrom, std::vector<EQConstant>&)> SECSEQCONSTANTREQUEST; |
| | | typedef std::function<void(void* pFrom, const char*, std::vector<CommandParameter>&)> SECSCommand; |
| | | typedef std::function<void(void* pFrom, SYSTEMTIME& time)> DATETIMESYNC; |
| | | typedef std::function<void(void* pFrom, bool bEnable, std::vector<unsigned int>& ids)> EDEVENTREPORT; |
| | | typedef std::function<void(void* pFrom, bool bEnable, unsigned int id)> EDALARMREPORT; |
| | | typedef struct _SECSListener |
| | | { |
| | | SECSEQOFFLINE onEQOffLine; |
| | |
| | | SECSEQCONSTANTREQUEST onEQConstantRequest; |
| | | SECSEQCONSTANTREQUEST onEQConstantSend; |
| | | SECSCommand onCommand; |
| | | DATETIMESYNC onDatetimeSync; |
| | | EDEVENTREPORT onEnableDisableEventReport; |
| | | EDALARMREPORT onEnableDisableAlarmReport; |
| | | } SECSListener; |
| | | |
| | | |
| | |
| | | /* è®¾ç½®è½¯ä»¶çæ¬å· æå¤§é¿åº¦ 20 bytes */ |
| | | void setSoftRev(const char* pszRev); |
| | | |
| | | /* æ·»å Report */ |
| | | void addReport(unsigned int id, const char* pszName); |
| | | |
| | | // è¿æ¥Report |
| | | void linkEventReport(unsigned int RPTID, unsigned int CEID); |
| | | void linkEventReport(unsigned int CEID, unsigned int RPTID); |
| | | |
| | | // åæ¶è¿æ¥report |
| | | void unlinkEventReport(unsigned int CEID); |
| | | |
| | | unsigned int getCEID(int RPTID); |
| | | |
| | | // define Report |
| | | void defineReport(unsigned int VID, unsigned int RPTID); |
| | | SERVO::CReport* defineReport(unsigned int RPTID, std::vector<unsigned int>& vids); |
| | | |
| | | // åæ¶ define report |
| | | void deleteReport(unsigned int RPTID); |
| | | bool removeReport(int rptid); |
| | | void clearAllReport(); |
| | | |
| | | // åæ¶/å 餿æ define report |
| | | void deleteAllReport(); |
| | | // 仿件ä¸å è½½CVariableå表 |
| | | int loadVarialbles(const char* pszFilepath); |
| | | |
| | | // åå¾CVariableå表 |
| | | std::vector<SERVO::CVariable*>& getVariables(); |
| | | |
| | | // å徿å®Variable |
| | | SERVO::CVariable* getVariable(int variableId); |
| | | |
| | | // 仿件ä¸å è½½CReportå表 |
| | | int loadReports(const char* pszFilepath); |
| | | |
| | | // åå¾Reportå表 |
| | | std::vector<SERVO::CReport*>& getReports(); |
| | | |
| | | // 仿件ä¸å è½½CCollectionEventå表 |
| | | int loadCollectionEvents(const char* pszFilepath); |
| | | |
| | | // åå¾CCollectionEventå表 |
| | | std::vector<SERVO::CCollectionEvent*>& getCollectionEvents(); |
| | | |
| | | // åæ¶/å 餿æCollectionEvent |
| | | void clearAllCollectionEvent(); |
| | | |
| | | // åå¾CCollectionEvent |
| | | SERVO::CCollectionEvent* getEvent(unsigned short CEID); |
| | | |
| | | // åå¾Report |
| | | SERVO::CReport* getReport(int rptid); |
| | | |
| | | void setListener(SECSListener listener); |
| | | unsigned OnCimWork(); |
| | |
| | | /* requestå¼å¤´ç彿°ä¸ºä¸»å¨åéæ°æ®ç彿° */ |
| | | int requestAreYouThere(); |
| | | int requestAlarmReport(int ALCD, int ALID, const char* ALTX); |
| | | int requestEventReportSend(unsigned int DATAID, unsigned int RPTID, const std::vector<std::string>& values); |
| | | int requestEventReportSend(unsigned int DATAID, unsigned int CEID, const std::vector<std::string>& values); |
| | | |
| | | private: |
| | | void replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName); |
| | |
| | | int replyLinkEventReport(IMessage* pRecv); |
| | | int replyEanbleDisableEventReport(IMessage* pRecv); |
| | | int replyCommand(IMessage* pRecv); |
| | | int replyConfigureSpooling(IMessage* pRecv); |
| | | int replyEanbleDisableAlarmReport(IMessage* pRecv); |
| | | int replyQueryPPIDList(IMessage* pRecv); |
| | | int replyTerminalDisplay(IMessage* pRecv); |
| | |
| | | inline void Lock() { EnterCriticalSection(&m_criticalSection); } |
| | | inline void Unlock() { LeaveCriticalSection(&m_criticalSection); } |
| | | int onRecvMsg(IMessage* pMessage); |
| | | void clearAllVariabel(); |
| | | std::vector<unsigned int> parseVidList(CString& strNums); |
| | | |
| | | private: |
| | | CModel* m_pModel; |
| | |
| | | unsigned m_nCimWorkThrdaddr; |
| | | |
| | | private: |
| | | // RPTID to CEID |
| | | std::map<unsigned int, unsigned int> m_mapReportIdToCEID; |
| | | |
| | | // RPTID to Report |
| | | std::map<unsigned int, REPORT> m_mapReport; |
| | | // CVariable vector |
| | | std::vector<SERVO::CVariable*> m_variabels; |
| | | |
| | | // VID to RPTID |
| | | std::map<unsigned int, unsigned int> m_mapValueIdToPRTID; |
| | | // CReport vector |
| | | std::vector<SERVO::CReport*> m_reports; |
| | | |
| | | // VID to Report |
| | | std::map<unsigned int, VALUE> m_mapValue; |
| | | // CollectionEvent vector |
| | | std::vector<SERVO::CCollectionEvent*> m_collectionEvents; |
| | | |
| | | // Spooling Config |
| | | std::map<uint16_t, std::set<uint16_t>> m_spoolingConfig; |
| | | }; |
| | | |
| | |
| | | LOGI("onEQConstantRequest: %d, %s", item.id, item.szValue); |
| | | } |
| | | }; |
| | | |
| | | listener.onDatetimeSync = [&](void* pFrom, SYSTEMTIME& time) -> void { |
| | | LOGI("onDatetimeSync: %d%02d%02d%02d%02d%02d", time.wYear, |
| | | time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond); |
| | | m_master.datetimeSync(time); |
| | | }; |
| | | listener.onEnableDisableEventReport = [&](void* pFrom, bool bEnable, std::vector<unsigned int> ids) -> void { |
| | | LOGI("EanbleDisableEventReport bEnable:%s", bEnable ? _T("YES") : _T("NO")); |
| | | if (ids.empty()) { |
| | | m_master.enableEventReport(bEnable); |
| | | } |
| | | }; |
| | | listener.onEnableDisableAlarmReport = [&](void* pFrom, bool bEnable, unsigned int id) -> void { |
| | | LOGI("onEnableDisableAlarmReport bEnable:%s, id:%d", bEnable ? _T("YES") : _T("NO"), id); |
| | | if (id == 0) { |
| | | m_master.enableAlarmReport(bEnable); |
| | | } |
| | | }; |
| | | m_hsmsPassive.setListener(listener); |
| | | m_hsmsPassive.setEquipmentModelType((LPTSTR)(LPCTSTR)strModeType); |
| | | m_hsmsPassive.setSoftRev((LPTSTR)(LPCTSTR)strSoftRev); |
| | | CString strVarialbleFile; |
| | | strVarialbleFile.Format(_T("%s\\VariableList.txt"), (LPTSTR)(LPCTSTR)m_strWorkDir); |
| | | m_hsmsPassive.loadVarialbles((LPTSTR)(LPCTSTR)strVarialbleFile); |
| | | m_hsmsPassive.init(this, "APP", 7000); |
| | | strVarialbleFile.Format(_T("%s\\ReportList.txt"), (LPTSTR)(LPCTSTR)m_strWorkDir); |
| | | m_hsmsPassive.loadReports((LPTSTR)(LPCTSTR)strVarialbleFile); |
| | | strVarialbleFile.Format(_T("%s\\CollectionEventList.txt"), (LPTSTR)(LPCTSTR)m_strWorkDir); |
| | | m_hsmsPassive.loadCollectionEvents((LPTSTR)(LPCTSTR)strVarialbleFile); |
| | | |
| | | |
| | | SERVO::MasterListener masterListener; |
| | |
| | | notify(RX_CODE_ALARM_CLEAR); |
| | | } |
| | | |
| | | m_hsmsPassive.requestAlarmReport(state, |
| | | pEquipment->getBaseAlarmId() + alarmId, |
| | | strAlarmText.c_str()); |
| | | if (m_master.isAlarmReportEnable()) { |
| | | m_hsmsPassive.requestAlarmReport(state, |
| | | pEquipment->getBaseAlarmId() + alarmId, |
| | | strAlarmText.c_str()); |
| | | } |
| | | }; |
| | | masterListener.onEqVcrEventReport = [&](void* pMaster, SERVO::CEquipment* pEquipment, SERVO::CVcrEventReport* pReport) { |
| | | LOGE("<CModel>onEqVcrEventReport."); |
| | |
| | | <ItemGroup> |
| | | <ClInclude Include="CBaseDlg.h" /> |
| | | <ClInclude Include="CCustomCheckBox.h" /> |
| | | <ClInclude Include="CCollectionEvent.h" /> |
| | | <ClInclude Include="CEquipmentPage3.h" /> |
| | | <ClInclude Include="CGlassPool.h" /> |
| | | <ClInclude Include="ChangePasswordDlg.h" /> |
| | | <ClInclude Include="CMyStatusbar.h" /> |
| | | <ClInclude Include="CPageCollectionEvent.h" /> |
| | | <ClInclude Include="CPageLinkSignal.h" /> |
| | | <ClInclude Include="CPageReport.h" /> |
| | | <ClInclude Include="CPageVarialbles.h" /> |
| | | <ClInclude Include="CReport.h" /> |
| | | <ClInclude Include="CRobotCmdContainerDlg.h" /> |
| | | <ClInclude Include="CRobotCmdTestDlg.h" /> |
| | | <ClInclude Include="CPagePortStatus.h" /> |
| | | <ClInclude Include="CPortStatusReport.h" /> |
| | | <ClInclude Include="CRobotTaskDlg.h" /> |
| | | <ClInclude Include="CVariable.h" /> |
| | | <ClInclude Include="GridControl\CellRange.h" /> |
| | | <ClInclude Include="GridControl\GridCell.h" /> |
| | | <ClInclude Include="GridControl\GridCellBase.h" /> |
| | |
| | | <ItemGroup> |
| | | <ClCompile Include="CBaseDlg.cpp" /> |
| | | <ClCompile Include="CCustomCheckBox.cpp" /> |
| | | <ClCompile Include="CCollectionEvent.cpp" /> |
| | | <ClCompile Include="CEquipmentPage3.cpp" /> |
| | | <ClCompile Include="CGlassPool.cpp" /> |
| | | <ClCompile Include="ChangePasswordDlg.cpp" /> |
| | | <ClCompile Include="CMyStatusbar.cpp" /> |
| | | <ClCompile Include="CPageCollectionEvent.cpp" /> |
| | | <ClCompile Include="CPageLinkSignal.cpp" /> |
| | | <ClCompile Include="CPageReport.cpp" /> |
| | | <ClCompile Include="CPageVarialbles.cpp" /> |
| | | <ClCompile Include="CReport.cpp" /> |
| | | <ClCompile Include="CRobotCmdContainerDlg.cpp" /> |
| | | <ClCompile Include="CRobotCmdTestDlg.cpp" /> |
| | | <ClCompile Include="CPagePortStatus.cpp" /> |
| | | <ClCompile Include="CPortStatusReport.cpp" /> |
| | | <ClCompile Include="CRobotTaskDlg.cpp" /> |
| | | <ClCompile Include="CVariable.cpp" /> |
| | | <ClCompile Include="GridControl\GridCell.cpp" /> |
| | | <ClCompile Include="GridControl\GridCellBase.cpp" /> |
| | | <ClCompile Include="GridControl\GridCellButton.cpp" /> |
| | |
| | | <ClCompile Include="RecipeManager.cpp" /> |
| | | <ClCompile Include="RecipeDeviceBindDlg.cpp" /> |
| | | <ClCompile Include="CCustomCheckBox.cpp" /> |
| | | <ClCompile Include="CCollectionEvent.cpp" /> |
| | | <ClCompile Include="CReport.cpp" /> |
| | | <ClCompile Include="CVariable.cpp" /> |
| | | <ClCompile Include="CPageVarialbles.cpp" /> |
| | | <ClCompile Include="CPageReport.cpp" /> |
| | | <ClCompile Include="CPageCollectionEvent.cpp" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="AlarmManager.h" /> |
| | |
| | | <ClInclude Include="RecipeManager.h" /> |
| | | <ClInclude Include="RecipeDeviceBindDlg.h" /> |
| | | <ClInclude Include="CCustomCheckBox.h" /> |
| | | <ClInclude Include="CCollectionEvent.h" /> |
| | | <ClInclude Include="CReport.h" /> |
| | | <ClInclude Include="CVariable.h" /> |
| | | <ClInclude Include="CPageVarialbles.h" /> |
| | | <ClInclude Include="CPageReport.h" /> |
| | | <ClInclude Include="CPageCollectionEvent.h" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="Servo.rc" /> |
| | |
| | | <RemoteDebuggerCommand>\\DESKTOP-IODBVIQ\Servo\Debug\Servo.exe</RemoteDebuggerCommand> |
| | | <RemoteDebuggerWorkingDirectory>\\DESKTOP-IODBVIQ\Servo\Debug\</RemoteDebuggerWorkingDirectory> |
| | | <RemoteDebuggerServerName>DESKTOP-IODBVIQ</RemoteDebuggerServerName> |
| | | <DebuggerFlavor>WindowsRemoteDebugger</DebuggerFlavor> |
| | | <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> |
| | | </PropertyGroup> |
| | | </Project> |
| | |
| | | #include "UserManager.h" |
| | | #include "SystemLogManager.h" |
| | | #include "PortConfigurationDlg.h" |
| | | #include "CHMPropertyDlg.h" |
| | | #include "CPageVarialbles.h" |
| | | #include "CPageReport.h" |
| | | #include "CPageCollectionEvent.h" |
| | | |
| | | |
| | | #ifdef _DEBUG |
| | |
| | | ON_UPDATE_COMMAND_UI(ID_MENU_FILE_SETTINGS, &CServoDlg::OnUpdateMenuFileSettings) |
| | | ON_COMMAND(ID_MENU_FILE_SECSTEST, &CServoDlg::OnMenuFileSecsTest) |
| | | ON_UPDATE_COMMAND_UI(ID_MENU_FILE_SECSTEST, &CServoDlg::OnUpdateMenuFileSecsTest) |
| | | ON_COMMAND(ID_MENU_PROJECT_VARIABLE_LIST, &CServoDlg::OnMenuProjectVarialbleList) |
| | | ON_UPDATE_COMMAND_UI(ID_MENU_PROJECT_VARIABLE_LIST, &CServoDlg::OnUpdateMenuProjectVarialbleList) |
| | | ON_COMMAND(ID_MENU_TEST_MESSAGE_SET, &CServoDlg::OnMenuTestMessageSet) |
| | | ON_UPDATE_COMMAND_UI(ID_MENU_TEST_MESSAGE_SET, &CServoDlg::OnUpdateMenuTestMessageSet) |
| | | ON_COMMAND(ID_MENU_TEST_MESSAGE_CLEAR, &CServoDlg::OnMenuTestMessageClear) |
| | |
| | | } |
| | | } |
| | | |
| | | if (RX_CODE_PASSIVE_STATUS_CHANGED == code) { |
| | | int state = 0; |
| | | pAny->getIntValue("exCode", state); |
| | | |
| | | if (STATE::NOT_CONNECTED == state) { |
| | | m_pMyStatusbar->setCimBtnText("Disconnected"); |
| | | //m_labelPassiveState.setBackground(DISCONNECTED_BACKGROUND); |
| | | //m_labelPassiveState.setForeground(DISCONNECTED_FOREGROUND, TRUE); |
| | | } |
| | | else if (STATE::NOT_SELECTED == state) { |
| | | m_pMyStatusbar->setCimBtnText("Not Selected"); |
| | | //m_labelPassiveState.setBackground(NOT_SELECTED_BACKGROUND); |
| | | //m_labelPassiveState.setForeground(NOT_SELECTED_FOREGROUND, TRUE); |
| | | } |
| | | else if (STATE::SELECTED == state) { |
| | | m_pMyStatusbar->setCimBtnText("Selected"); |
| | | //m_labelPassiveState.setBackground(SELECTED_BACKGROUND); |
| | | //m_labelPassiveState.setForeground(SELECTED_FOREGROUND, TRUE); |
| | | } |
| | | } |
| | | pAny->release(); |
| | | }, [&]() -> void { |
| | | // onComplete |
| | |
| | | } |
| | | |
| | | void CServoDlg::OnUpdateMenuFileExit(CCmdUI* pCmdUI) |
| | | { |
| | | pCmdUI->Enable(TRUE); |
| | | } |
| | | |
| | | void CServoDlg::OnMenuProjectVarialbleList() |
| | | { |
| | | CHMPropertyDlg dlg(_T("Variable | Rreport | Collection Event"), 658, 788); |
| | | |
| | | CPageCollectionEvent* pPage1 = new CPageCollectionEvent(); |
| | | pPage1->Create(IDD_PAGE_COLLECTION_EVENT); |
| | | dlg.addPage(pPage1, "Event"); |
| | | |
| | | CPageReport* pPage2 = new CPageReport(); |
| | | pPage2->Create(IDD_PAGE_REPORT); |
| | | dlg.addPage(pPage2, "Report"); |
| | | |
| | | CPageVarialbles* pPage3 = new CPageVarialbles(); |
| | | pPage3->Create(IDD_PAGE_VARIABLE); |
| | | dlg.addPage(pPage3, "Variable"); |
| | | |
| | | dlg.DoModal(); |
| | | } |
| | | |
| | | void CServoDlg::OnUpdateMenuProjectVarialbleList(CCmdUI* pCmdUI) |
| | | { |
| | | pCmdUI->Enable(TRUE); |
| | | } |
| | |
| | | m_pRobotTaskDlg->MoveWindow(x, rcBar.top - h, w, h); |
| | | m_pRobotTaskDlg->ShowWindow(SW_SHOW); |
| | | } |
| | | else if (id == IDC_BUTTON_CIM) { |
| | | AfxMessageBox("IDC_BUTTON_CIM"); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | |
| | | afx_msg void OnUpdateMenuFileSecsTest(CCmdUI* pCmdUI); |
| | | afx_msg void OnMenuFileExit(); |
| | | afx_msg void OnUpdateMenuFileExit(CCmdUI* pCmdUI); |
| | | afx_msg void OnMenuProjectVarialbleList(); |
| | | afx_msg void OnUpdateMenuProjectVarialbleList(CCmdUI* pCmdUI); |
| | | afx_msg void OnMenuTestMessageSet(); |
| | | afx_msg void OnUpdateMenuTestMessageSet(CCmdUI* pCmdUI); |
| | | afx_msg void OnMenuTestMessageClear(); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 300,AccessMode_To_Manual,,(300) |
| | | 301,AccessMode_To_Auto,,(301) |
| | | 600,ControlStateChanged,,(600) |
| | | 700,ProcessStateChanged,,(700) |
| | | 10000,RecipeChanged,,(10000) |
| | | 10030,CarrierArrived,,(10300) |
| | | 10031,CarrierRemoved,,(10300) |
| | | 10040,ReadyToLoad,,(10300) |
| | | 10041,ReadyToUnLoad,,(10300) |
| | | 10051,CarrierIDWaitingForHost,,(10051) |
| | | 10052,CarrierIDVerificationOK,,(10052) |
| | | 10053,CarrierIDVerificationNG,,(10052) |
| | | 10061,SlotMapWaitingForHost,,(10061) |
| | | 10062,SlotMapVerificationOK,,(10062) |
| | | 10063,SlotMapVerificationNG,,(10062) |
| | | 10071,GlassIDReadWaitingForHost,,(10071) |
| | | 10072,GlassIDReadVerificationOK,,(10072) |
| | | 10073,GlassIDReadVerificationNG,,(10072) |
| | | 10080,CarrierStart,,(10080) |
| | | 10081,CarrierCompleted,,(10080) |
| | | 10082,CarrierStopped,,(10080) |
| | | 20000,GlassSlotStart,,(20000) |
| | | 20001,GlassSlotCompleted,,(20000) |
| | | 30000,PrJobPooled,,(30000) |
| | | 30001,PrJobAbort,,(30000) |
| | | 30010,PrJobProcessing,,(30000) |
| | | 30011,PrJobCompleted,,(30000) |
| | | 30013,PrJobPaused,,(30000) |
| | | 30014,PrJobResume,,(30000) |
| | | 30020,PrJobDeleted,,(30000) |
| | | 31000,CJobQueued,,(31000) |
| | | 31001,CJobAbort,,(31000) |
| | | 31010,CJobExecuting,,(31000) |
| | | 31020,CJobCompleted,,(31000) |
| | | 31021,CJobDeleted,,(31000) |
| | | 31031,CJobPaused,,(31000) |
| | | 31032,CJobResume,,(31000) |
| | | 40000,E90_SPSM_NoState_To_NeedsProcessing,,(40000) |
| | | 40001,E90_SPSM_InProcess_To_ProcessCompleted,,(40000) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | RPTID,(VID1,VID2,...) |
| | | 300,(1,300) |
| | | 301,(1,300) |
| | | 600,(500,600,601) |
| | | 700,(500,700,701) |
| | | 10000,(200,201) |
| | | 10300,(1,10000) |
| | | 10051,(1,10000,10100,10101) |
| | | 10061,(1,10000,10100,10200) |
| | | 10062,(1,10000,10100,10201,10202) |
| | | 10071,(1,10000,10100,10203,20000) |
| | | 10072,(1,10000,10100,10203,20000,20001) |
| | | 10080,(1,10000,10100) |
| | | 20000,(1,10000,10203) |
| | | 30000,(1,30000,30001) |
| | | 31000,(1,31000,31001) |
| | | 40000,(1,10203,20000) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | SVID,SV Name,SV Format,SV Remark |
| | | 100,PortTransferState,U1,0=OutOfService\r\n1=TransferBlocked\r\n2=ReadyToLoad\r\n3=ReadyToUnload\r\n4=InService\r\n5=TransferReady |
| | | 300,AccessMode,U1,1=Manual\r\n2=Auto |
| | | 500,Clock,A50, |
| | | 600,CurrentControlState,U1,0:Offline:equipment\r\n1:Offline-Attempt\r\n2:Online\r\n3:Offline:host\r\n4:Online:Local\r\n5:Online:Remote |
| | | 601,PreviousControlState,U1, |
| | | 700,CurrentProcessState,U1,0:DOWN\r\n1:IDLE\r\n2.SETUP\r\n3.EXCUTING\r\n4.MAINTAIN\r\n5.ALARM |
| | | 701,PreviousProcessState,U1, |
| | | 800,EFEMPPExecName,A20, |
| | | 801,EQPPExecName,A20, |
| | | 1000,CJobSpace,U1, |
| | | 2000,RbRAxisTorque,I2,æºå¨äººRè½´æç© |
| | | 2001,RbLAxisTorque,l2,æºå¨äººLè½´æç© |
| | | 2002,RbZAxisTorque,l2,æºå¨äººZè½´æç© |
| | | 2003,RbTHAxisTorque,l2,æºå¨äººTHè½´æç© |
| | | 2004,RbXAxisTorque,l2,æºå¨äººXè½´æç© |
| | | 2005,AxisX111,l2,X111ç¸æºåç§»æ ½çµæºæç© |
| | | 2006,AxisX112,l2,X112ç¸æºåç§»æ ½çµæºæç© |
| | | 2007,AxisU113,l2,U113产åæè½¬çµæºæç© |
| | | 2008,AxisX114,l2,X114产åå·¦æ´åçµæºæç© |
| | | 2009,AxisY121,l2,Y121产å峿´åçµæºæç© |
| | | 2010,AxisY122,l2,Y122产ååæ´åçµæºæç© |
| | | 2011,AxisY123,l2,Y123产ååéµåçµæºæç© |
| | | 2012,MainAir,U2,æ»è¿æ°ååå¼ |
| | | 2013,MainVacuum,l2,æ»ç空ååå¼ |
| | | 2014,RbMainVacuum,l2,æºå¨äººçç©ºå¼ |
| | | 2015,LPMainVacuum,l2,LPç空å¼#D265 |
| | | 2016,LPMainAir,U2,LPåç©ºå¼ |
| | | 2017,ALVacuum,l2,Alignerçç©ºå¼ |
| | | 2018,FFU1RPM,U2,FFU1转é |
| | | 2019,FFU2RPM,U2,FFU2转é |
| | | 2020,FFU3RPM,U2,FFU3转é |
| | | 2021,FFU4RPM,U2,FFU4转é |
| | | 2022,ESDValue,I2,éçµæ£æµå¼ |
| | | 2023,OCREnable,U2,"OCR使è½ï¼O:å¼å¯ 1ï¼å±è½" |
| | | 2024,CCDEnable,U2,"CCD使è½ï¼O:å¼å¯ 1ï¼å±è½" |
| | | 2025,FFUParameter,U2,FFU设å®å¼ |