cumsgbuffer.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef CUMSGBUFFER_H
  2. #define CUMSGBUFFER_H
  3. #include <QDateTime>
  4. #include <QMutex>
  5. #include <string>
  6. #include <iostream>
  7. #include <vector>
  8. #include <memory>
  9. namespace iv {
  10. struct cumsg
  11. {
  12. int id;
  13. qint64 ntime;
  14. std::string strVIN;
  15. std::string strqueryMD5;
  16. std::string strctrlMD5;
  17. std::vector<char> xdata;
  18. qint64 mlastuptime; //更新时间
  19. bool mbImportant = false;
  20. int mkeeptime;
  21. bool mbhavequery = false;
  22. qint64 mnlatency;
  23. };
  24. }
  25. class cumsgbuffer
  26. {
  27. public:
  28. cumsgbuffer();
  29. private:
  30. std::vector<iv::cumsg> mvectormsg;
  31. QMutex mMutex;
  32. public:
  33. void addmsg(int id,qint64 ntime,std::string strVIN,std::string strqueryMD5,
  34. std::string strctrlMD5,std::vector<char> * pxdata,bool bImportant,int nkeeptime,qint64 nculatency);
  35. //if no new msg return 0
  36. // -1 no this vin
  37. // -2 queryMD5 error
  38. int getmsg(std::string strVIN,std::string strqueryMD5,qint64 nlasttime, int & id,qint64 & ntime,
  39. std::vector<char> * pxdata,qint64 * pnculatency);
  40. };
  41. #endif // CUMSGBUFFER_H