modulecomm.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #if defined(MODULECOMM_LIBRARY)
  10. # define MODULECOMMSHARED_EXPORT Q_DECL_EXPORT
  11. #else
  12. # define MODULECOMMSHARED_EXPORT Q_DECL_IMPORT
  13. #endif
  14. enum ModuleComm_TYPE
  15. {
  16. ModuleComm_SHAREMEM = 0,
  17. ModuleComm_INTERIOR = 1,
  18. ModuleComm_FASTRTPS = 2
  19. };
  20. //#include <iostream>
  21. //#include <thread>
  22. //using namespace std::placeholders;
  23. #ifndef IV_MODULE_FUN
  24. typedef std::function<void(const char * ,const unsigned int , const unsigned int , QDateTime * ,const char *)> ModuleFun;
  25. typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  26. #define IV_MODULE_FUN
  27. #endif
  28. namespace iv {
  29. namespace modulecomm {
  30. void * MODULECOMMSHARED_EXPORT RegisterSend(const char * strcommname,const unsigned int nBufSize,const unsigned int nMsgBufCount
  31. ,ModuleComm_TYPE xmctype = ModuleComm_SHAREMEM);
  32. void * MODULECOMMSHARED_EXPORT RegisterRecv(const char * strcommname,SMCallBack pCall,
  33. ModuleComm_TYPE xmctype = ModuleComm_SHAREMEM);
  34. void * MODULECOMMSHARED_EXPORT RegisterRecvPlus(const char * strcommname,ModuleFun xFun,
  35. ModuleComm_TYPE xmctype = ModuleComm_SHAREMEM);
  36. void MODULECOMMSHARED_EXPORT ModuleSendMsg(void * pHandle,const char * strdata,const unsigned int nDataLen);
  37. void MODULECOMMSHARED_EXPORT Unregister(void * pHandle);
  38. void MODULECOMMSHARED_EXPORT PauseComm(void * pHandle);
  39. void MODULECOMMSHARED_EXPORT ContintuComm(void * pHandle);
  40. }
  41. }
  42. #endif // MODULECOMM_H