modulecomm.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef MODULECOMM_H
  2. #define MODULECOMM_H
  3. #include <QtCore/qglobal.h>
  4. #include <QDateTime>
  5. #include <functional>
  6. #include "modulecomm_shm.h"
  7. #include "modulecomm_fastrtps.h"
  8. #include "modulecomm_inter.h"
  9. #include "modulecomm_fastrtps_tcp.h"
  10. #if defined(MODULECOMM_LIBRARY)
  11. # define MODULECOMMSHARED_EXPORT Q_DECL_EXPORT
  12. #else
  13. # define MODULECOMMSHARED_EXPORT Q_DECL_IMPORT
  14. #endif
  15. //#include <iostream>
  16. //#include <thread>
  17. //using namespace std::placeholders;
  18. #ifndef IV_MODULE_FUN
  19. typedef std::function<void(const char * ,const unsigned int , const unsigned int , QDateTime * ,const char *)> ModuleFun;
  20. typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  21. #define IV_MODULE_FUN
  22. #endif
  23. namespace iv {
  24. namespace modulecomm {
  25. enum ModuleComm_TYPE
  26. {
  27. ModuleComm_SHAREMEM = 0,
  28. ModuleComm_INTERIOR = 1,
  29. ModuleComm_FASTRTPS = 2,
  30. ModuleComm_FASTRTPS_TCP = 3
  31. };
  32. void * MODULECOMMSHARED_EXPORT RegisterSend(const char * strcommname,const unsigned int nBufSize,const unsigned int nMsgBufCount
  33. ,ModuleComm_TYPE xmctype = ModuleComm_SHAREMEM,const unsigned short nport = 5100);
  34. void * MODULECOMMSHARED_EXPORT RegisterRecv(const char * strcommname,SMCallBack pCall,
  35. ModuleComm_TYPE xmctype = ModuleComm_SHAREMEM,const char * strip = 0,const unsigned short = 5100);
  36. void * MODULECOMMSHARED_EXPORT RegisterRecvPlus(const char * strcommname,ModuleFun xFun,
  37. ModuleComm_TYPE xmctype = ModuleComm_SHAREMEM,const char * strip = 0,const unsigned short = 5100);
  38. void MODULECOMMSHARED_EXPORT ModuleSendMsg(void * pHandle,const char * strdata,const unsigned int nDataLen);
  39. void MODULECOMMSHARED_EXPORT Unregister(void * pHandle);
  40. void MODULECOMMSHARED_EXPORT PauseComm(void * pHandle);
  41. void MODULECOMMSHARED_EXPORT ContintuComm(void * pHandle);
  42. }
  43. }
  44. #endif // MODULECOMM_H