DIOS.Dev.FPDDeviceMould.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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* gLogger = nullptr;
  16. FPDDeviceMould::FPDDeviceMould(/*std::shared_ptr <IOEventCenter> center) : super(center*/)
  17. {
  18. m_strIODevicePath = "/Detector";
  19. if (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. gLogger = Log4CPP::LogManager::GetLogger("FPD.Mould");
  25. }
  26. Info("------------version 3.0.0.0------------");
  27. }
  28. FPDDeviceMould::~FPDDeviceMould()
  29. {}
  30. nsFPD::FPDDriverMould::FPDDriverMould()
  31. {
  32. }
  33. nsFPD::FPDDriverMould::~FPDDriverMould()
  34. {
  35. }
  36. std::string nsFPD::FPDDriverMould::GetGUID() const
  37. {
  38. return UltrasonicDriverType;
  39. }
  40. void nsFPD::FPDDriverMould::AddConfig(ConfigInfo config)
  41. {
  42. m_ConfigInfo << config;
  43. }
  44. ConfigInfo::ConfigInfo(const char* Key, const char* strType, const char* strAccess, const char* strRequired, const char* strDefaultValue)
  45. {
  46. strConfKey = Key;
  47. ResDataObject temp;
  48. temp.update(AttributeType, strType);
  49. temp.update(AttributeAccess, strAccess);
  50. temp.update(AttributeRequired, strRequired);
  51. temp.update(AttributeDefaultValue, strDefaultValue);
  52. resDescription = temp.encode();
  53. }
  54. ConfigInfo::~ConfigInfo()
  55. {
  56. }
  57. void ConfigInfo::SetList(const char* str)
  58. {
  59. ResDataObject temp;
  60. temp.decode(resDescription.c_str());
  61. temp.update(AttributeList, str);
  62. resDescription = temp.encode();
  63. }
  64. void ConfigInfo::SetRange(const char* strmin, const char* strmax)
  65. {
  66. ResDataObject temp;
  67. temp.decode(resDescription.c_str());
  68. temp.update(AttributeRangeMin, strmin);
  69. temp.update(AttributeRangeMax, strmax);
  70. resDescription = temp.encode();
  71. }
  72. const char* ConfigInfo::GetDescription()
  73. {
  74. return resDescription.c_str();
  75. }
  76. const char* ConfigInfo::GetCurrentValue()
  77. {
  78. return resValue.c_str();
  79. }
  80. void ConfigInfo::SetCurrentValue(const char* res)
  81. {
  82. resValue = res;
  83. }
  84. const char* ConfigInfo::GetKey()
  85. {
  86. return strConfKey.c_str();
  87. }