123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- // CCOS.Dev.FPD.DEMO.cpp : 定义 DLL 应用程序的导出函数。
- //
- #include "stdafx.h"
- #include <stdio.h>
- #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<bool>;
- m_bLTEenable->SetKey("LTEenable");
- *m_bLTEenable = false;
- m_bXrayStatus = new BaseJsonDataObject<bool>;
- 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 <CCOS::Dev::IOEventCenter> 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;
- }
|