#pragma once #include "BaseClient.h" #include "../config/bean/AlarmCfg.h" class IPGLaserState { public: IPGLaserState() { currentSetpoint=0.0f; laserTemperature=0.0f; moduleErrorCode=0; outputPower = "OFF"; isOverheat=false; isEmissionOn = false; isHighBackReflectionLevel = false; isExtCtrlEnable = false; isModuleDisconnected = false; isAimingBeamON = false; isModuleAlarm = false; // isPulseTooShort = false; // isPulseMode = false; isPowerSupplyOff = false; isModulationEnabled = false; isEmission = false; // isGateModeEnabled = false; // isHighPulseEnergy = false; isExtEmissionCtrlEnabled = false; isPowerSupplyFailure = false; // isLockFrontPanel = false; // isKeyswitchInREMPosition = false; // isWaveformPulseModeEnabled = false; // isHighDutyCycle = false; isLeakageCurrentTooHigh = false; isLowTemperature = false; isPowerSupplyVotageAlarm = false; isExtRedLightCtrlEnabled = false; isCritialError = false; isOpticalInterlockActive = false; //isAveragePowerTooHigh = false; } public: float currentSetpoint; //激光二极管电流设置 float laserTemperature; //内部实际温度 string outputPower; //输出功率W int moduleErrorCode; //模块错误代码 bool isOverheat; //温度过热 bool isEmissionOn; //使能 bool isHighBackReflectionLevel; //高反报警 bool isExtCtrlEnable; //外部控制模式 bool isModuleDisconnected; //激光模块失连 bool isModuleAlarm; //激光模块故障 bool isAimingBeamON; //红光开 //bool isPulseTooShort; //脉冲宽度太小 //bool isPulseMode; //脉冲模式 bool isPowerSupplyOff; //模块主电源关闭 bool isModulationEnabled; //调制模式开启 bool isEmission; //激光发射 // bool isGateModeEnabled; //Gate模式开启 // bool isHighPulseEnergy; //脉冲能量太大 bool isExtEmissionCtrlEnabled; //外部Emission控制开启 bool isPowerSupplyFailure; //模块主电源故障 //bool isLockFrontPanel; //前显示面板锁定 //bool isKeyswitchInREMPosition; //钥匙开关REM位置 //bool isWaveformPulseModeEnabled;//波形脉冲模式开启 //bool isHighDutyCycle; //脉冲周期太长 bool isLowTemperature; //温度过低 bool isPowerSupplyVotageAlarm; //模块主电源电压超范围 bool isLeakageCurrentTooHigh; //漏电流过大 bool isExtRedLightCtrlEnabled; //外部红光控制开启 bool isCritialError; //关键错误 bool isOpticalInterlockActive; //光学回路安全互锁开路 //bool isAveragePowerTooHigh; //平均功率太高 }; class IPGLaserClient:public TcpClient { public: IPGLaserClient(CommunicationCfg* pconfig, AlarmCfg* laserAlarm, int freq = 100); ~IPGLaserClient(); void InitCommand(); void ResetAlarm(); void GetState(IPGLaserState& state); private: void static PorcReadCurrentSetpoint(void* pobject, Command* pcommand); void static PorcReadLaserTemp(void* pobject, Command* pcommand); void static PorcReadOutputPower(void* pobject, Command* pcommand); void static PorcModuleErrorCode(void* pobject, Command* pcommand); void static PorcDeviceStatus(void* pobject, Command* pcommand); private: IPGLaserState m_State; AlarmCfg* m_LaserAlarm; }; class IPGLaserStateV1 { public: IPGLaserStateV1() { currentSetpoint = 0.0f; laserTemperature = 0.0f; moduleErrorCode = 0; outputPower = "OFF"; isCommandBufferOverload = false; isOverheat = false; isEmissionOn = false; isHighBackReflectionLevel = false; isAnalogPowerControlEnable = false; isAimingBeamON = false; isPowerSupplyOff = false; isModulationEnabled = false; isEmission = false; isGateModeEnable = false; isHardwareEmissionCtrlEnabled = false; isPowerSupplyFailure = false; isLowTemperature = false; isPowerSupplyAlarm = false; isHardwareAimingBeanControlEnable = false; isCritialError = false; isFiberInterlockActive = false; //isAveragePowerTooHigh = false; } public: float currentSetpoint; //激光二极管电流设置 float laserTemperature; //内部实际温度 string outputPower; //输出功率W int moduleErrorCode; //模块错误代码 bool isCommandBufferOverload; //指令溢出 bool isOverheat; //温度过热 bool isEmissionOn; //使能 bool isHighBackReflectionLevel; //高反报警 bool isAnalogPowerControlEnable; //功率外控 bool isAimingBeamON; //红光开 bool isPowerSupplyOff; //模块主电源关闭 bool isModulationEnabled; //调制模式开启 bool isEmission; //激光发射 bool isGateModeEnable; //门模式开启 bool isHardwareEmissionCtrlEnabled; //硬控发射开启 bool isPowerSupplyFailure; //模块主电源故障 bool isLowTemperature; //温度过低 bool isPowerSupplyAlarm; //供电报警 bool isHardwareAimingBeanControlEnable; //硬控红光开启 bool isCritialError; //关键错误 bool isFiberInterlockActive; //光路内部锁定 }; class IPGLaserClientV1 :public TcpClient { public: IPGLaserClientV1(CommunicationCfg* pconfig, AlarmCfg* laserAlarm); ~IPGLaserClientV1(); //void Init(); void InitCommand(); void ResetAlarm(); void GetState(IPGLaserStateV1& state); void DrawClientState(); private: void static PorcReadCurrentSetpoint(void* pobject, Command* pcommand); void static PorcReadLaserTemp(void* pobject, Command* pcommand); void static PorcReadOutputPower(void* pobject, Command* pcommand); void static PorcModuleErrorCode(void* pobject, Command* pcommand); void static PorcDeviceStatus(void* pobject, Command* pcommand); private: IPGLaserStateV1 m_State; AlarmCfg* m_LaserAlarm; AlarmCfgWrapper* m_AlarmCfgWrapper; };