DIOS.Dev.FPDDeviceMould.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // CCOS.Dev.FPDDriverMould.cpp : 定义 DLL 应用程序的导出函数。
  2. //
  3. #include "stdafx.h"
  4. #include "EasyJSONEncoder.hpp"
  5. #include "CCOS.Dev.FPDDeviceMould.hpp"
  6. #include "common_api.h"
  7. using namespace CCOS::Dev::Detail::Detector;
  8. namespace nsFPD = CCOS::Dev::Detail::Detector;
  9. template <typename _Container, typename T>
  10. inline _Container & operator << (_Container & ar, const T & t)
  11. {
  12. //ar.push_back(t);
  13. return ar;
  14. }
  15. Log4CPP::Logger* //mLog::gLogger = nullptr;
  16. FPDDeviceMould::FPDDeviceMould()
  17. {
  18. m_strIODevicePath = "/Detector";
  19. if (//mLog::gLogger == nullptr)
  20. {
  21. string strLogPath = GetProcessDirectory() + R"(\OEMDrivers\Detector\Conf\Log4CPP.Config.FPD.xml)";
  22. Log4CPP::GlobalContext::Map::Set(ZSKK::Utility::Hash("LogFileName"), "FPD.Mould");
  23. auto rc = Log4CPP::LogManager::LoadConfigFile(strLogPath.c_str());
  24. //mLog::gLogger = Log4CPP::LogManager::GetLogger("FPD.Mould");
  25. //mLog::Info("FPDDeviceMould Construction");
  26. }
  27. }
  28. FPDDeviceMould::~FPDDeviceMould()
  29. {
  30. }
  31. nsFPD::FPDDriverMould::FPDDriverMould()
  32. {
  33. }
  34. nsFPD::FPDDriverMould::~FPDDriverMould()
  35. {
  36. }
  37. std::string nsFPD::FPDDriverMould::GetGUID() const
  38. {
  39. return DetectorDriverType;
  40. }
  41. void nsFPD::FPDDriverMould::AddConfig(ConfigInfo config)
  42. {
  43. m_ConfigInfo << config;
  44. }
  45. ConfigInfo::ConfigInfo(const char* Key, const char* strType, const char* strAccess, const char* strRequired, const char* strDefaultValue)
  46. {
  47. strConfKey = Key;
  48. ResDataObject temp;
  49. temp.update(AttributeType, strType);
  50. temp.update(AttributeAccess, strAccess);
  51. temp.update(AttributeRequired, strRequired);
  52. temp.update(AttributeDefaultValue, strDefaultValue);
  53. resDescription = temp.encode();
  54. }
  55. ConfigInfo::~ConfigInfo()
  56. {
  57. }
  58. void ConfigInfo::SetList(const char* str)
  59. {
  60. ResDataObject temp;
  61. temp.decode(resDescription.c_str());
  62. temp.update(AttributeList, str);
  63. resDescription = temp.encode();
  64. }
  65. void ConfigInfo::SetRange(const char* strmin, const char* strmax)
  66. {
  67. ResDataObject temp;
  68. temp.decode(resDescription.c_str());
  69. temp.update(AttributeRangeMin, strmin);
  70. temp.update(AttributeRangeMax, strmax);
  71. resDescription = temp.encode();
  72. }
  73. const char* ConfigInfo::GetDescription()
  74. {
  75. return resDescription.c_str();
  76. }
  77. const char* ConfigInfo::GetCurrentValue()
  78. {
  79. return resValue.c_str();
  80. }
  81. void ConfigInfo::SetCurrentValue(const char* res)
  82. {
  83. resValue = res;
  84. }
  85. const char* ConfigInfo::GetKey()
  86. {
  87. return strConfKey.c_str();
  88. }