cumsgbuffer.h 1013 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. };
  23. }
  24. class cumsgbuffer
  25. {
  26. public:
  27. cumsgbuffer();
  28. private:
  29. std::vector<iv::cumsg> mvectormsg;
  30. QMutex mMutex;
  31. public:
  32. void addmsg(int id,qint64 ntime,std::string strVIN,std::string strqueryMD5,
  33. std::string strctrlMD5,std::vector<char> * pxdata,bool bImportant,int nkeeptime);
  34. //if no new msg return 0
  35. // -1 no this vin
  36. // -2 queryMD5 error
  37. int getmsg(std::string strVIN,std::string strqueryMD5,qint64 nlasttime, int & id,qint64 & ntime,
  38. std::vector<char> * pxdata);
  39. };
  40. #endif // CUMSGBUFFER_H