You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __OBJECTEVENTREPORT_H_INCL__
  2. #define __OBJECTEVENTREPORT_H_INCL__
  3. #include <time.h>
  4. #ifdef __linux__
  5. #include <dirent.h>
  6. #include <sys/types.h>
  7. #endif
  8. #include "../../data/storage/storageProvider.h"
  9. #include "../base/basicCamera.h"
  10. #include "../base/basicEventHandler.h"
  11. #include "../base/basicFunctionality.h"
  12. #include "../base/basicReportRecord.h"
  13. #include "../base/basicSettings.h"
  14. #include <vector>
  15. typedef struct S_REPORT_RECORD
  16. {
  17. uint32_t chunk_size; // 4
  18. uint32_t ms; // 4
  19. uint16_t ums; // 2
  20. uint8_t cls_id; // 1
  21. uint8_t type; // 1
  22. uint32_t src; // 4
  23. uint8_t media_type; // 1
  24. uint8_t media_count; // 1
  25. uint16_t data_size; // 2
  26. //----------------------------------- 20 bytes = Fixed Size Header
  27. void * data;
  28. uint8_t media_allocated;
  29. char ** media_names;
  30. uint32_t * media_markers;
  31. } REPORT_RECORD;
  32. typedef struct S_REPORT_LIST_RECORD
  33. {
  34. char text[CTEXT];
  35. char path[CTEXT];
  36. } REPORT_LIST_RECORD;
  37. #define REPORT_RECORD_HEADER_SIZE 20
  38. // typedef std::vector<REPORT_LIST_RECORD *> vectorPeportsList;
  39. typedef std::vector<char *> vectorPeportsList;
  40. typedef std::vector<REPORT_RECORD *> vectorReport;
  41. class mediaVideoSourceManager;
  42. /**
  43. * TODO: Add class description
  44. *
  45. * @author Gagua
  46. */
  47. class objectEventReport : public basicEventHandler
  48. {
  49. private:
  50. storageProvider * m_pStorageProvider;
  51. basicSettings * m_pSettingsEngine;
  52. mediaVideoSourceManager * m_pMediaManager;
  53. char m_pReportFileName[MAX_PATH];
  54. bool saveReportRecord(REPORT_RECORD * Record);
  55. bool getMedia(REPORT_RECORD * Record);
  56. bool prefill(basicEvent * Evt, REPORT_RECORD * Record);
  57. bool utilize(REPORT_RECORD * Record);
  58. REPORT_RECORD * loadReportRecord(FILE * FD);
  59. vectorPeportsList m_vLoaddedReports;
  60. vectorReport m_vReport;
  61. public:
  62. static objectEventReport * getInstance(void);
  63. virtual ~objectEventReport(void);
  64. virtual bool dispatchEvent(basicEvent * Evt);
  65. bool loadReportList(struct tm * LTM);
  66. bool loadReport(struct tm * LTM);
  67. vectorPeportsList * getLoaddedReports(void);
  68. vectorReport * getLoaddedReport(void);
  69. bool getReportBase(CSTR path, struct tm * LTM);
  70. private:
  71. static objectEventReport * _instance;
  72. protected:
  73. objectEventReport(void);
  74. };
  75. #endif // __OBJECTEVENTREPORT_H_INCL__