ProtocolFactory.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // // ******************************************************************
  2. // // /\ /| @File ProtocolFactory.h
  3. // // \ V/ @Brief
  4. // // | "") @Author lijinwen, ghz005@uni-trend.com.cn
  5. // // / | @Creation 2024-5-6
  6. // // / \\ @Modified 2024-5-13
  7. // // *(__\_\
  8. // // ******************************************************************
  9. #pragma once
  10. #include <memory>
  11. #include "ProtocolDecodeBase.h"
  12. #define DLL_VERSION "0.1.1"
  13. #ifdef LIBMATH_EXPORTS
  14. #define LIBMATH_API __declspec(dllexport)
  15. #else
  16. #define LIBMATH_API __declspec(dllimport)
  17. #endif
  18. namespace Protocol
  19. {
  20. static std::unique_ptr<ProtocolDecodeBase> glDecoderPtr;
  21. class LIBMATH_API ProtocolFactory
  22. {
  23. public:
  24. static bool CreateProtocol(SerialProtocolType protocolType);
  25. //获取解码库内部版本
  26. static void GetVersion(uint8_t* version);
  27. static ProtocolDecodeBase* GetDecoderPtrExport();
  28. static void ReleaseDecoder()
  29. {
  30. if (glDecoderPtr)
  31. {
  32. // 释放对象
  33. glDecoderPtr.reset();
  34. }
  35. }
  36. private:
  37. };
  38. extern "C" {
  39. LIBMATH_API ProtocolDecodeBase* CreateProtocolExport(SerialProtocolType protocolType, LogLevel level);
  40. LIBMATH_API void GetVersionExport(uint8_t* version);
  41. LIBMATH_API void ReleaseExport();
  42. }
  43. }