modulecomm_impl_tcp.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef MODULECOMM_IMPL_TCP_H
  2. #define MODULECOMM_IMPL_TCP_H
  3. #include <QDateTime>
  4. #include "TopicsPublisher.h"
  5. #include "TopicsSubscriber.h"
  6. typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
  7. class modulecomm_impl_tcp
  8. {
  9. public:
  10. const static int type_send = 1;
  11. const static int type_recv = 2;
  12. public:
  13. modulecomm_impl_tcp(const char * strcommname,int ntype = 2,const unsigned short nport =1,const char * strip = 0);
  14. int listenmsg(SMCallBack pCall);
  15. int listenmsg(ModuleFun xFun);
  16. void writemsg(const char * str,int nlen);
  17. private:
  18. char mstrtopic[256];
  19. int mnType = type_recv;
  20. TopicsPublisher * mpPub;
  21. TopicsSubscriber * mpSub;
  22. SMCallBack mpCall;
  23. ModuleFun mFun;
  24. void callbackTopic(const char * strdata,const unsigned int nSize,const unsigned int index,QDateTime * dt,const char * strmemname);
  25. int GetTempConfPath(char * strpath);
  26. bool mbFunPlus = false;
  27. };
  28. #endif // MODULECOMM_IMPL_H