| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #pragma once
- #include "HDDSNetDefine.h"
- // 跨平台导出宏
- #if defined(_WIN32)
- #ifdef UDP_NET_DLL
- #define UDP_NET_CLASS __declspec(dllexport)
- #else
- #define UDP_NET_CLASS __declspec(dllimport)
- #endif
- #else
- #ifdef UDP_NET_DLL
- #define UDP_NET_CLASS __attribute__((visibility("default")))
- #else
- #define UDP_NET_CLASS
- #endif
- #endif
- enum HDDSType {
- HDDSType_sCourseChange = 0,
- HDDSType_sRealFromMain = 1,
- HDDSType_sRealToMain = 2,
- HDDSType_sTrainItem = 3,
- HDDSType_sTrainItemAll = 4,
- HDDSType_sCourse = 5,
- HDDSType_sNZQX = 6,
- HDDSType_sOCCCMD = 7,
- };
- // 定义目标结构
- struct UDPTargetConfig {
- const char* ip;
- int port;
- };
- extern "C" UDP_NET_CLASS bool NetDll_InitUDPNet();
- extern "C" UDP_NET_CLASS bool NetDll_DestroyUDPNet();
- extern "C" UDP_NET_CLASS void NetDll_StartThread();
- extern "C" UDP_NET_CLASS void NetDll_StopThread();
- extern "C" UDP_NET_CLASS bool NetDll_SendUDPData(HDDSType nType, void* pData, long nLen);
- extern "C" UDP_NET_CLASS bool NetDll_SetNetQueue(HDDSCMDQueue * pCMDQueue);
- extern "C" UDP_NET_CLASS bool NetDll_LibraryInit();
- extern "C" UDP_NET_CLASS void NetDll_LibraryCleanup();
- // 新增接口 发送到多个目标
- extern "C" UDP_NET_CLASS bool NetDll_SetMultiSendParams(UDPTargetConfig * targets, int count);
- extern "C" UDP_NET_CLASS bool NetDll_AddSendTarget(const char* hostIP, int nPort);
- extern "C" UDP_NET_CLASS bool NetDll_RemoveSendTarget(const char* hostIP, int nPort);
- extern "C" UDP_NET_CLASS void NetDll_ClearSendTargets();
- extern "C" UDP_NET_CLASS bool NetDll_SendUDPDataToMulti(HDDSType nType, void* pData, long nLen);
|