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.

64 lines
1.7 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __KERNEL_HELPER_MEDIA_MTX_HEADER__
  2. #define __KERNEL_HELPER_MEDIA_MTX_HEADER__
  3. #ifndef LRF_PROXY_ONLY
  4. #include "dataBinder.h"
  5. #include "../../components/base/basicThread.h"
  6. #include <sys/types.h>
  7. #include <sys/stat.h>
  8. #include <unistd.h>
  9. #include <vector>
  10. typedef struct S_StreamDescRecord{
  11. uint32_t cam_id;
  12. uint32_t node_id;
  13. uint32_t stream_id;
  14. uint8_t status;
  15. bool valid;
  16. char source_uri[512];
  17. }StreamDescRecord;
  18. typedef std::vector<StreamDescRecord *> V_StreamDescRecords;
  19. #define KH_STATUS_MTX_NA 0
  20. #define KH_STATUS_MTX_INIT 1
  21. #define KH_STATUS_MTX_AOK 2
  22. #define KH_STATUS_MTX_ERR 255
  23. #define KH_MTX_STREAM_LOADDED 0
  24. #define KH_MTX_STREAM_REGISTERED 1
  25. #define KH_MTX_STREAM_ONLINE 2
  26. #define KH_MTX_STREAM_OFFLINE 3
  27. #define KH_MTX_STREAM_ERROR 255
  28. class kernelHelperMediaMTX: public basicThread {
  29. private:
  30. basicLogCollection * m_pLog;
  31. dataBinder * m_pDBC;
  32. V_StreamDescRecords m_vStreamRecords;
  33. uint8_t m_bStatus;
  34. char m_sWorkDir[512];
  35. char m_sAppLogFile[512];
  36. char m_sAppConfigFile[512];
  37. off_t m_nLastLogSize;
  38. bool loadConfig();
  39. bool loadStreams();
  40. protected:
  41. virtual void m_fThreadProc(void);
  42. public:
  43. kernelHelperMediaMTX();
  44. virtual ~kernelHelperMediaMTX();
  45. bool create();
  46. bool validateConfig();
  47. bool assignStream( uint32_t stream_id );
  48. bool updateConfig();
  49. bool restart();
  50. bool validateService();
  51. uint8_t getStatus(){ return m_bStatus; };
  52. };
  53. #endif // ! LRF_PROXY_ONLY
  54. #endif