123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- // CCOS.Dev.FPDDriverMould.cpp : 定义 DLL 应用程序的导出函数。
- //
- #include "FileVersion.hpp"
- #include "EasyJSONEncoder.hpp"
- #include "CCOS.Dev.FPDDeviceMould.hpp"
- #include "common_api.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 <typename _Container, typename T>
- 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)";
- // 初始化日志系统
- if (!Log4CPP::init(logHostName, "FPD.Modle", strLogPath, true)) {
- std::cerr << "Failed to initialize log system! Using default configuration." << std::endl;
- // 即使配置文件加载失败,也可以继续使用默认配置
- }
- //
- 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();
- }
|