#pragma once #define C_MACHINE_EXPORTS #include "Machine.h" #include "CDieBondFsm.h" #include "CMessageBox.h" #pragma comment(lib,"CLog.lib") #pragma comment(lib,"Module.lib") #pragma comment(lib,"Control.lib") namespace ns_module { struct ST_BUTTON_FUN { int nId; // 0~12 int DirectoryId; // 绑定的ID std::string strCallFun; // 执行函数名 std::map mapPar; // 参数 }; class __declspec(dllexport) CViewInterface { public: struct THREAD_BUTTON_RUN { CViewInterface* pClass; ST_BUTTON_FUN stButtonInfo; }; private: static CViewInterface* m_instance; static HANDLE m_hEvent; bool m_bIsInitSuccess = false; CManageDB* m_pCManageDB = nullptr; Machine* m_pMachine = nullptr; CCameraManage* m_pCameraManage = nullptr; CBondHead* m_pBondHead = nullptr; CResources* m_pResource = nullptr; CDieBondFsm* m_pDieBondFsm = nullptr; LONG Init(); public: static CViewInterface* GetInstance(); #pragma region 界面方面接口 private: CXYCalib* GetCalibXY(int iCameraId); public: //界面退出通知 long ViewExit(); //机台回零 long ToHome(); //机台重新加载所有配置 long ResetLoadAllConfig(); //将所有数据保存到数据库 long SaveAllConfigToDateBase(); /// /// 设置红光 /// /// 相机Id /// 灯光值 /// 成功返回0,否则返回错误码 long SetRedLight(int iCameraId, int LightValue); /// /// 设置绿光 /// /// 灯光值 /// 成功返回0,否则返回错误码 long SetGreenLight(int iCameraId, int LightValue); /// /// 设置蓝光 /// /// 相机Id /// 灯光值 /// 成功返回0,否则返回错误码 long SetBlueLight(int iCameraId, int LightValue); /// /// 设置点光 /// /// 相机Id /// 灯光值 /// 成功返回0,否则返回错误码 long SetPointLight(int iCameraId, int LightValue); /// /// 获取灯光值 /// /// 相机Id /// 红光。值为-1时,表示没有该灯 /// 绿光。值为-1时,表示没有该灯 /// 蓝光。值为-1时,表示没有该灯 /// 点光。值为-1时,表示没有该灯 /// 成功返回0,否则返回错误码 long GetLight(int iCameraId, int& redLightValue, int& greenLightValue, int& blueLightValue, int& pointLightValue); /// /// 获取相机图像。调用后会阻塞,直到有新的相机图像时才返回 /// /// 相机Id /// /// 成功返回0,否则返回错误码 long GrabImage(int iCameraId, ImageInfo& image); /// /// 获取CPK数据信息 /// /// CPK数据 /// 成功返回0,否则返回错误码 long GetCpkList(std::vector& CpkList); /// /// 读取表中指定GroupId的配置信息 /// /// 组Id /// 表名 /// 返回的配置信息 /// 成功返回0,否则返回错误码 long LoadConfigDB(string strTableName, vector iGroupId, vector& vecConfig); /// /// 保存配置信息 /// /// 表名 /// 要保存的配置信息 /// 成功返回0,否则返回错误码 long SaveConfigDB(string strTableName, vector vecConfig); /// /// 获取相机列表 /// /// 相机列表 /// 成功返回0,否则返回错误码 long GetCameraList(vector& vecCamera); /// /// 相机移动到显示位置 /// /// /// /// /// long CameraMove(int iCameraId, double x, double y); long SetVideoCallBackFunc(int iCameraId, CallVideoBack func); //设置弹出框 long SetPopMessageBoxFunc(CallMessageBox func); //获取所有轴信息 vector GetAxisList(); //移动轴 long ModuleMove(string ModuleType, string AxisType, double pos); long ModuleMoveTo(string ModuleType, string AxisType, double pos); //获取轴实时位置 long GetAxisPosition(string ModuleType, string AxisType, double& pos); //数据更改后发送通知 long DataChangNotice(string strDbName,string strTableName); //接收数据更改后的通知 void RecvDataChangNotice(string strDbName, string strTableName, DataNoticeCallbackFun callBackFun); //停止 long RunStop(); //自动固晶 long RunAutoBond(); //执行按钮命令 long RunButton(ST_BUTTON_FUN stInfo); static VOID CALLBACK threadRunButton(PTP_CALLBACK_INSTANCE Instance, PVOID Parameter, PTP_WORK Work); long RunButtonByThread(ST_BUTTON_FUN stInfo); long RunTest(ST_BUTTON_FUN stInfo); #pragma endregion }; }