You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
4.5 KiB
C++
84 lines
4.5 KiB
C++
#pragma once
|
|
#include "module.h"
|
|
#include "GlobalDefine.h"
|
|
#include "Subject.h"
|
|
#include "PciPort.h"
|
|
#include "EnumPropertieType.h"
|
|
|
|
#if 1//端口控制的种类
|
|
#define PCI_PORT_NULL _T("NULL")
|
|
//输出端口
|
|
#define PCI_PORT_PLUS_X _T("X 轴脉冲")//X 轴脉冲
|
|
#define PCI_PORT_DIR_X _T("X 轴方向")//X 轴方向
|
|
#define PCI_PORT_DIR_Y _T("Y 轴方向")//Y 轴方向
|
|
#define PCI_PORT_PLUS_Y _T("Y 轴脉冲")//Y 轴脉冲
|
|
#define PCI_PORT_DIR_Z _T("Z 轴方向")//Y 轴方向
|
|
#define PCI_PORT_PLUS_Z _T("Z 轴脉冲")//Y 轴脉冲
|
|
#define PCI_PORT_LASER _T("激光")
|
|
#define PCI_PORT_LASER_2 _T("辅助激光")
|
|
#define PCI_PORT_EXHAUST_FAN _T("抽风")
|
|
#define PCI_PORT_LIGHT_R _T("红灯")
|
|
#define PCI_PORT_LIGHT_Y _T("黄灯")
|
|
#define PCI_PORT_LIGHT_G _T("绿灯")
|
|
#define PCI_PORT_ALARM _T("蜂鸣器")
|
|
#define PCI_PORT_AIR _T("吹气")
|
|
#define PCI_PORT_VACUUM_OUT1 _T("真空OUT1") //真空开关
|
|
#define PCI_PORT_VACUUM_OUT2 _T("真空OUT2")
|
|
#define PCI_PORT_DOOR _T("门")
|
|
|
|
#define PCI_PORT_PLC_1 _T("PLC通信位1")
|
|
#define PCI_PORT_PLC_2 _T("PLC通信位2")
|
|
#define PCI_PORT_PLC_3 _T("PLC通信位3")
|
|
#define PCI_PORT_PLC_4 _T("PLC通信位4")
|
|
#define PCI_PORT_PLC_5 _T("PLC通信位5")
|
|
#define PCI_PORT_PLC_6 _T("PLC通信位6")
|
|
//输入端口----------------------------------------------
|
|
#define PCI_PORT_LIMIT_SWITCH_X_F _T("X 正限位")
|
|
#define PCI_PORT_LIMIT_SWITCH_X_N _T("X 负限位")
|
|
#define PCI_PORT_LIMIT_SWITCH_Y_F _T("Y 正限位")
|
|
#define PCI_PORT_LIMIT_SWITCH_Y_N _T("Y 负限位")
|
|
#define PCI_PORT_LIMIT_SWITCH_Z_F _T("Z 正限位")
|
|
#define PCI_PORT_LIMIT_SWITCH_Z_N _T("Z 负限位")
|
|
#define PCI_PORT_VACUUM_IN1 _T("真空IN1")
|
|
#define PCI_PORT_VACUUM_IN2 _T("真空IN2")
|
|
#define PCI_PORT_FIBER1 _T("光纤IN1")
|
|
#define PCI_PORT_FIBER2 _T("光纤IN2")
|
|
#define PCI_PORT_AIR_CYLINDER_1 _T("气缸上点位")
|
|
#define PCI_PORT_AIR_CYLINDER_2 _T("气缸下点位")
|
|
#define PCI_PORT_DOOR_CHECK _T("门禁")
|
|
#define PCI_PORT_GRATING _T("光栅")
|
|
#define PCI_PORT_STOP _T("停止")
|
|
#endif
|
|
|
|
|
|
//继承CModule 是为了获得属性存储的功能
|
|
//继承CSubject 是成为观察者模式的一个具体主题
|
|
class CPciPortMgr :public CModule,public CSubject
|
|
{
|
|
public:
|
|
CPciPortMgr(void);
|
|
~CPciPortMgr(void);
|
|
virtual void Ini();
|
|
virtual CMFCPropertyGridProperty *CreatGridProperty();
|
|
virtual void ExportPar(ofstream *pFile);
|
|
virtual MODULE GetModuleType(){return _PCI_PORT_PROP;};
|
|
virtual void OnPropertyChanged();
|
|
SPciPort GetCtrlPort(CString);
|
|
int GetOutPortDefaultStateL(){return m_OutPortDefaultStateL;};
|
|
int GetOutPortDefaultStateH(){return m_OutPortDefaultStateH;};
|
|
private:
|
|
void InsertOutCtrlType(CMFCPropertyGridProperty* p);
|
|
void InsertInCtrlType(CMFCPropertyGridProperty* p);
|
|
void IniPciPortVec();
|
|
void IniPortCtrlType();
|
|
void IniObserver();
|
|
private:
|
|
int m_PciPortCnt;//端口的个数
|
|
vector<CString> m_OutPortCtrlType;//out 端口可以控制的全部类型
|
|
vector<CString> m_InPortCtrlType;//in 端口可以控制的全部类型
|
|
vector<pair<CString,bool>> m_PciPortVec;//存储pci 卡每个口控制的内容PCI_PORT_NULL 为什么都不控制(bool 表示端口是否反转)
|
|
int m_OutPortDefaultStateL;//输出端口低八位的默认状态
|
|
int m_OutPortDefaultStateH;//输出端口高八位的默认状态
|
|
};
|
|
|
|
extern CPciPortMgr *gPciPortMgr; |