// CCOS.Dev.FPDDriverMould.cpp : 定义 DLL 应用程序的导出函数。 // #include "FileVersion.hpp" #include "EasyJSONEncoder.hpp" #include "CCOS.Dev.FPDDeviceMould.hpp" #include "common_api.h" #include "LogLocalHelper.h" #include "Log4CPP.h" using namespace CCOS::Dev::Detail::Detector; namespace nsFPD = CCOS::Dev::Detail::Detector; extern const char* g_szMouldPath; //Log4CPP::Logger* //gLogger = nullptr; template inline _Container & operator << (_Container & ar, const T & t) { //ar.push_back(t); return ar; } FPDDeviceMould::FPDDeviceMould() { m_strIODevicePath = "/Detector"; string strLogPath = GetProcessDirectory() + R"(/Conf/log_config.xml)"; logHostName = getLogHostName(); // 初始化日志系统 bool ret = initLogModule( logHostName, // 主机名(用于日志路径中的{host}占位符) "FPD.Modle", // 唯一模块名 strLogPath, // 配置文件路径 true // 是否输出到控制台(可选) ); if (!ret) { std::cerr << "Log init failed!" << std::endl; return; } FPDSetLocalModuleName("FPD.Modle"); // FINFO("Code Build datetime [{$} {$}]", __DATE__, __TIME__); } FPDDeviceMould::~FPDDeviceMould() { } nsFPD::FPDDriverMould::FPDDriverMould() { } nsFPD::FPDDriverMould::~FPDDriverMould() { } std::string nsFPD::FPDDriverMould::GetGUID() const { return DetectorDriverType; } void nsFPD::FPDDriverMould::AddConfig(ConfigInfo config) { m_ConfigInfo << config; } ConfigInfo::ConfigInfo(const char* Key, const char* strType, const char* strAccess, const char* strRequired, const char* strDefaultValue) { strConfKey = Key; ResDataObject temp; temp.update(AttributeType, strType); temp.update(AttributeAccess, strAccess); temp.update(AttributeRequired, strRequired); temp.update(AttributeDefaultValue, strDefaultValue); resDescription = temp.encode(); } ConfigInfo::~ConfigInfo() { } void ConfigInfo::SetList(const char* str) { ResDataObject temp; temp.decode(resDescription.c_str()); temp.update(AttributeList, str); resDescription = temp.encode(); } void ConfigInfo::SetRange(const char* strmin, const char* strmax) { ResDataObject temp; temp.decode(resDescription.c_str()); temp.update(AttributeRangeMin, strmin); temp.update(AttributeRangeMax, strmax); resDescription = temp.encode(); } const char* ConfigInfo::GetDescription() { return resDescription.c_str(); } const char* ConfigInfo::GetCurrentValue() { return resValue.c_str(); } void ConfigInfo::SetCurrentValue(const char* res) { resValue = res; } const char* ConfigInfo::GetKey() { return strConfKey.c_str(); }