cumsgbuffer.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #include <picbuf.h>
  10. #include "clientime.h"
  11. #ifndef CAM_NUM
  12. #define CAM_NUM 4
  13. #endif
  14. namespace iv {
  15. struct cumsg
  16. {
  17. public:
  18. int id;
  19. qint64 ntime;
  20. std::string strVIN;
  21. std::string strqueryMD5;
  22. std::string strctrlMD5;
  23. std::vector<char> xdata;
  24. qint64 mlastuptime; //更新时间
  25. bool mbImportant = false;
  26. int mkeeptime;
  27. bool mbhavequery = false;
  28. PicBuf mpicbuf[CAM_NUM];
  29. };
  30. }
  31. class cumsgbuffer
  32. {
  33. public:
  34. cumsgbuffer();
  35. private:
  36. std::vector<iv::cumsg> mvectormsg;
  37. clientime mclienttime;
  38. QMutex mMutex;
  39. public:
  40. void addmsg(int id,qint64 ntime,std::string strVIN,std::string strqueryMD5,
  41. std::string strctrlMD5,std::vector<char> * pxdata,bool bImportant,int nkeeptime);
  42. //if no new msg return 0
  43. // -1 no this vin
  44. // -2 queryMD5 error
  45. int getmsg(std::string strVIN,std::string strqueryMD5,qint64 nlasttime, int & id,qint64 & ntime,
  46. std::vector<char> * pxdata);
  47. void addPicData(std::string strVIN,const char * strdata,const unsigned int ndatasize,qint64 npictime,int nCamPos,qint64 nLatency);
  48. int getPicData(std::string strVIN,std::string strqueryMD5,std::shared_ptr<char> & pdata_ptr,unsigned int & ndatasize,
  49. std::string strclientid,int nCamPos,qint64 & nPicTime,qint64 & nPicLatency,int & nFrameRate);
  50. };
  51. #endif // CUMSGBUFFER_H