// CCOS.Dev.FPD.DEMO.cpp : 定义 DLL 应用程序的导出函数。 // #include "stdafx.h" #include #include "CCOS.Dev.FPD2OtherDevice.hpp" #include "Logger.temp.h" using namespace CCOS::Dev; using namespace CCOS::Dev::Detail::Detector; namespace nsFPD = CCOS::Dev::Detail::Detector; // FPDCommunicateWithOtherDevice.cpp : 定义 DLL 应用程序的导出函数。 // #include "stdafx.h" #include "common_api.h" // 这是已导出类的构造函数。 // 有关类定义的信息,请参阅 FPDCommunicateWithOtherDevice.h CFPDCommunicateWithOtherDevice::CFPDCommunicateWithOtherDevice(void) { m_strPanelSN = ""; m_nCAL = 0; m_nCAM = 0; m_nHWcrop = 0; m_nPanelRotate = 0; m_nCollimatorAlign = 0; m_fCollimatorWidth = 0.0f; m_fCollimatorLen = 0.0f; m_fAPRms = 0.0f; m_nWorkStation = 0; m_fLTEthreshold = 0.0; m_bLTEenable = new BaseJsonDataObject; m_bLTEenable->SetKey("LTEenable"); *m_bLTEenable = false; m_bXrayStatus = new BaseJsonDataObject; m_bXrayStatus->SetKey("XrayStatus"); //0:No xray;1:Xray *m_bXrayStatus = false; //CreateLogger("FPD2Other"); return; } CFPDCommunicateWithOtherDevice::~CFPDCommunicateWithOtherDevice(void) { //ReleaseLogger(); return; } RET_STATUS CFPDCommunicateWithOtherDevice::GetPanelSN(string& strValue) { strValue = m_strPanelSN; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::GetCAL(unsigned int& nValue) { nValue = m_nCAL; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::GetCAM(unsigned int& nValue) { nValue = m_nCAM; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::OnHWcrop(unsigned int nValue) { m_nHWcrop = nValue; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::OnPANEL_ROTATE(unsigned int nValue) { m_nPanelRotate = nValue; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::OnCollimatorAlign(unsigned int nValue) { m_nCollimatorAlign = nValue; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::OnCollimatorWidth(float fValue) { m_fCollimatorWidth = fValue; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::OnCollimatorLen(float fValue) { m_fCollimatorLen = fValue; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::OnAPRms(float fValue) { m_fAPRms = fValue; PRINTA_INFO("Set APR ms %f, LTEthreshold %f", fValue,m_fLTEthreshold); //printf("CFPDCommunicateWithOtherDevice::OnAPRms: ms %f\n", fValue); if (m_fLTEthreshold > 0.1f) { bool bLTEenable = *m_bLTEenable; if (fValue > m_fLTEthreshold && !bLTEenable) { *m_bLTEenable = true; m_EventCenter->OnNotify((int)ATTRACTION_SET, m_bLTEenable->GetKey(), m_bLTEenable->GetVal()); PRINTA_INFO("send notify LTE enable"); printf("CFPDCommunicateWithOtherDevice::m_fLTEthreshold: %f ms, send notify LTE enable\n", m_fLTEthreshold); } if (fValue <= m_fLTEthreshold && bLTEenable) { *m_bLTEenable = false; m_EventCenter->OnNotify((int)ATTRACTION_SET, m_bLTEenable->GetKey(), m_bLTEenable->GetVal()); printf("CFPDCommunicateWithOtherDevice::m_fLTEthreshold: %f ms, send notify LTE disable\n", m_fLTEthreshold); PRINTA_INFO("send notify LTE disable"); } } return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::OnWorkStation(unsigned int nValue) { m_nWorkStation = nValue; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::OnXrayStatus(bool bXRayStatus) { PRINTA_INFO("Get XrayStatus: %d", bXRayStatus); if (bXRayStatus) { *m_bXrayStatus = true; } else { *m_bXrayStatus = false; } m_EventCenter->OnNotify((int)ATTRACTION_SET, m_bXrayStatus->GetKey(), m_bXrayStatus->GetVal()); return RET_STATUS::RET_SUCCEED; } void CFPDCommunicateWithOtherDevice::SetEventCenter(std::shared_ptr EventCenter) { m_EventCenter = EventCenter; } RET_STATUS CFPDCommunicateWithOtherDevice::JSSetPanelSN(std::string in, std::string& out) { ResDataObject json; json.decode(in.c_str()); string strValue = json[0]; m_strPanelSN = strValue; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSSetLTEthreshold(std::string in, std::string& out) { PRINTA_INFO("SetLTEthreshold %s", in.c_str()); ResDataObject json; json.decode(in.c_str()); float fValue = json[0]; m_fLTEthreshold = fValue; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSSetFPDCalibrationStatus(std::string in, std::string& out) { ResDataObject json; json.decode(in.c_str()); unsigned int nValue = json[0]; m_nCAL = nValue; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSSetCalibrationHSWStatus(std::string in, std::string& out) { ResDataObject json; json.decode(in.c_str()); unsigned int nValue = json[0]; m_nCAM = nValue; return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSSendFPDError(std::string in, std::string& out) { PRINTA_INFO("FPDError: %s", in.c_str()); return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSClearFPDError(std::string in, std::string& out) { PRINTA_INFO("clearFPDError: %s", in.c_str()); return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSSendFPDWarn(std::string in, std::string& out) { PRINTA_INFO("FPDWarn: %s", in.c_str()); return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSGetIMGCropStatus(std::string& out) { char szFDinfo[MAX_STRING] = { 0 }; sprintf_s(szFDinfo, "%d", m_nHWcrop); out = szFDinfo; PRINTA_INFO("GetIMGCropStatus: %s", out.c_str()); return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSGetFPDRotate(std::string& out) { char szFDinfo[MAX_STRING] = { 0 }; sprintf_s(szFDinfo, "%d", m_nPanelRotate); out = szFDinfo; PRINTA_INFO("GetFPDRotate: %s", out.c_str()); return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSGetCollimatorAlign(std::string& out) { char szFDinfo[MAX_STRING] = { 0 }; sprintf_s(szFDinfo, "%d", m_nCollimatorAlign); out = szFDinfo; PRINTA_INFO("GetCollimatorAlign: %s", out.c_str()); return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSGetCollimatorWidth(std::string& out) { char szFDinfo[MAX_STRING] = { 0 }; sprintf_s(szFDinfo, "%f", m_fCollimatorWidth); out = szFDinfo; PRINTA_INFO("GetCollimatorWidth: %s", out.c_str()); return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSGetCollimatorLength(std::string& out) { char szFDinfo[MAX_STRING] = { 0 }; sprintf_s(szFDinfo, "%f", m_fCollimatorLen); out = szFDinfo; PRINTA_INFO("GetCollimatorLength: %s", out.c_str()); return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSGetAPRms(std::string& out) { char szFDinfo[MAX_STRING] = { 0 }; sprintf_s(szFDinfo, "%f", m_fAPRms); out = szFDinfo; PRINTA_INFO("GetAPRms: %s", out.c_str()); return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSGetWorkStation(std::string& out) { char szFDinfo[MAX_STRING] = { 0 }; sprintf_s(szFDinfo, "%d", m_nWorkStation); out = szFDinfo; PRINTA_INFO("GetWorkStation: %s", out.c_str()); return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSLTEenable(std::string& out) { char szFDinfo[MAX_STRING] = { 0 }; bool bEnable = *m_bLTEenable; sprintf_s(szFDinfo, "%d", bEnable); out = szFDinfo; PRINTA_INFO("GetLTEenable: %s", out.c_str()); return RET_STATUS::RET_SUCCEED; } RET_STATUS CFPDCommunicateWithOtherDevice::JSXrayStatus(std::string& out) { char szFDinfo[MAX_STRING] = { 0 }; bool bXrayStatus = *m_bXrayStatus; sprintf_s(szFDinfo, "%d", bXrayStatus); out = szFDinfo; PRINTA_INFO("GetXrayStatus: %s", out.c_str()); return RET_STATUS::RET_SUCCEED; }