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.
96 lines
3.6 KiB
C++
96 lines
3.6 KiB
C++
#pragma once
|
|
#include "module.h"
|
|
#include "CommPortMgr.h"
|
|
#include "WorkTime.h"
|
|
|
|
//激光器类型
|
|
enum LASER_DEVICE_TYPE
|
|
{
|
|
_LASER_SPECTRA_PHYSICS=0,//美国光谱物理
|
|
_LASER_INNOLASE,//德国innolase
|
|
};
|
|
|
|
enum INNOLAS_LASER_OP_TYPE
|
|
{
|
|
_INNOLAS_NULL = 0,
|
|
_INNOLAS_FRE,//频率
|
|
_INNOLAS_CURRENT,//电流
|
|
_INNOLAS_SYS_STATE,//设备状态
|
|
_INNOLAS_SYS_ENABLE,//外控启动
|
|
};
|
|
//操作激光器的参数格式
|
|
class CInnolasOpPar
|
|
{
|
|
public:
|
|
INNOLAS_LASER_OP_TYPE Type;
|
|
bool bSet;
|
|
double SetVal;
|
|
double GetVal1;
|
|
double GetVal2;
|
|
};
|
|
|
|
//激光器参数管理类
|
|
class CLaserDeviceMgr :public CModule
|
|
{
|
|
public:
|
|
CLaserDeviceMgr(void);
|
|
~CLaserDeviceMgr(void);
|
|
virtual CMFCPropertyGridProperty *CreatGridProperty();
|
|
virtual void ExportPar(ofstream *pFile);
|
|
virtual MODULE GetModuleType(){return _SPECTRA_PHYSICS_LASER_PROP;};
|
|
virtual void Ini();
|
|
virtual void WriteWorkFileExt(vector<CLab> &LabVec);
|
|
virtual void ReadWorkFile(CLabVecRang &LabVecRang);
|
|
virtual void OnWorkStart();//开始加工之前的操作
|
|
virtual void OnWorkEnd();//加工结束之后的操作
|
|
virtual void OnExitApp();
|
|
|
|
CString GetWarmTime();
|
|
void TurnOnEmission();
|
|
void TurnOffEmission();
|
|
void SetParToLaserDevice(bool bException);
|
|
double GetPower(){return m_Power;};
|
|
void SetPower(double val){m_Power = val;};
|
|
int GetLaserFre(){return m_Fre;};
|
|
void SetFre(int val){m_Fre = val;};
|
|
CString GetLaserState();
|
|
double SendMsgToDevice(INNOLAS_LASER_OP_TYPE type,bool bSet,double val,bool bException);
|
|
double GetCurLaserCurr(){return m_CurLaserCurr;};
|
|
double GetCurLaserFre(){return m_CurLaserFre;};
|
|
void ReadLaserPar();
|
|
void StartLaserSleepTime();
|
|
void StopLaserSleepTime();
|
|
void LaserSleepTimeExt();
|
|
CString GetCurLeftTimes(){return m_CurLeftTimes;};
|
|
void StartReadInfo();
|
|
void ReadInfoExt();
|
|
private:
|
|
void SendMsgToDeviceExt(CCommPortMgr&Comm,CInnolasOpPar &OpPar);
|
|
unsigned char GetMsgID(INNOLAS_LASER_OP_TYPE Type);
|
|
unsigned char GetOpType(bool bSet);
|
|
unsigned char GetOpCode1(INNOLAS_LASER_OP_TYPE Type);
|
|
unsigned char GetOpCode2(INNOLAS_LASER_OP_TYPE Type);
|
|
double GetLaserUnit(INNOLAS_LASER_OP_TYPE Type);
|
|
unsigned char GetLenOfCmd(INNOLAS_LASER_OP_TYPE Type);
|
|
void CheckInnolaseLaserPar(double Power,double Fre,bool bException);
|
|
void SetParToLaserSpectraPhysics();
|
|
void SetParToLaserInnolase(bool bException);
|
|
private:
|
|
LASER_DEVICE_TYPE m_DeviceType;//激光器类型
|
|
bool m_bUse;//是否串口控制激光器
|
|
bool m_bExitAppCloseLaser;//退出软件时关闭激光器
|
|
CCommPortMgr m_ComMgr;
|
|
int m_ComPort;//通信用com 口编号
|
|
int m_ComBaudrate;//通信波特率(innolase 19200)(SpectraPhysics 9600)
|
|
double m_Power;//功率 (德国innolase 为百分比% ) (美国光谱是电流值)
|
|
int m_Fre;//激光频率hz
|
|
|
|
double m_CurLaserCurr;//当前激光器的电流
|
|
double m_CurLaserFre;//当前激光器的频率
|
|
|
|
CWorkTime m_LaserSleepTime;//用来控制激光器休眠的时间对象
|
|
int m_LaserSleepTimeMinutes;//绿光激光器休眠计时(分钟)
|
|
bool m_bStopLaserSleepTime;//用于结束线程
|
|
CString m_CurLeftTimes;//当前剩余时间
|
|
};
|
|
extern CLaserDeviceMgr *gCLaserDeviceMgr; |