AsioUDPNetDLL.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include "HDDSNetDefine.h"
  3. // 跨平台导出宏
  4. #if defined(_WIN32)
  5. #ifdef UDP_NET_DLL
  6. #define UDP_NET_CLASS __declspec(dllexport)
  7. #else
  8. #define UDP_NET_CLASS __declspec(dllimport)
  9. #endif
  10. #else
  11. #ifdef UDP_NET_DLL
  12. #define UDP_NET_CLASS __attribute__((visibility("default")))
  13. #else
  14. #define UDP_NET_CLASS
  15. #endif
  16. #endif
  17. enum HDDSType {
  18. HDDSType_sCourseChange = 0,
  19. HDDSType_sRealFromMain = 1,
  20. HDDSType_sRealToMain = 2,
  21. HDDSType_sTrainItem = 3,
  22. HDDSType_sTrainItemAll = 4,
  23. HDDSType_sCourse = 5,
  24. HDDSType_sNZQX = 6,
  25. HDDSType_sOCCCMD = 7,
  26. };
  27. // 定义目标结构
  28. struct UDPTargetConfig {
  29. const char* ip;
  30. int port;
  31. };
  32. extern "C" UDP_NET_CLASS bool NetDll_InitUDPNet();
  33. extern "C" UDP_NET_CLASS bool NetDll_DestroyUDPNet();
  34. extern "C" UDP_NET_CLASS void NetDll_StartThread();
  35. extern "C" UDP_NET_CLASS void NetDll_StopThread();
  36. extern "C" UDP_NET_CLASS bool NetDll_SendUDPData(HDDSType nType, void* pData, long nLen);
  37. extern "C" UDP_NET_CLASS bool NetDll_SetNetQueue(HDDSCMDQueue * pCMDQueue);
  38. extern "C" UDP_NET_CLASS bool NetDll_LibraryInit();
  39. extern "C" UDP_NET_CLASS void NetDll_LibraryCleanup();
  40. // 新增接口 发送到多个目标
  41. extern "C" UDP_NET_CLASS bool NetDll_SetMultiSendParams(UDPTargetConfig * targets, int count);
  42. extern "C" UDP_NET_CLASS bool NetDll_AddSendTarget(const char* hostIP, int nPort);
  43. extern "C" UDP_NET_CLASS bool NetDll_RemoveSendTarget(const char* hostIP, int nPort);
  44. extern "C" UDP_NET_CLASS void NetDll_ClearSendTargets();
  45. extern "C" UDP_NET_CLASS bool NetDll_SendUDPDataToMulti(HDDSType nType, void* pData, long nLen);