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.

129 lines
5.0 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
4 years ago
4 years ago
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
2 years ago
4 years ago
4 years ago
​
3 years ago
4 years ago
​
​
​
​
4 years ago
​
​
​
​
4 years ago
​
​
​
​
4 years ago
4 years ago
4 years ago
4 years ago
​
​
​
​
2 years ago
4 years ago
​
​
​
​
​
​
​
​
​
4 years ago
3 years ago
​
​
4 years ago
​
​
  1. //----------------------------------------------------------------------------
  2. // Dr.Frucht Systems Ltd.
  3. // Copyright � 2000-2022. All Rights Reserved.
  4. // Version 1.0 11/19/2022
  5. // Last modification: 11/19/2022
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: mojoKernel.h
  9. // AUTHOR: gagua
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of mojoKernel.cpp
  13. //----------------------------------------------------------------------------
  14. //
  15. #ifndef __MOJO_KERNEL_H_INCL__
  16. #define __MOJO_KERNEL_H_INCL__
  17. #define LA_METRO 1
  18. #define MER_INC 2
  19. #define NOTARGET_SESSION_CLOSE 120 //sec
  20. //#define EMBED_AUTORESET 300 //sec
  21. #include "../../components/base/basicThread.h"
  22. #include "../../components/base/basicSettingsProvider.h"
  23. #include "../../components/base/basicEventHeap.h"
  24. #include "../../components/object/objectSystemAnchor.h"
  25. #include "../../alg/lgs/detectorStructures.h"
  26. #include "../../alg/lgs/detector.h"
  27. #include "../../alg/lgs/mask.h"
  28. #include "../../alg/generic/md5.h"
  29. #include "../common/kernelPrototype.h"
  30. #include "mojoRemoteClient.h"
  31. #define MAX_CYCLE_COUNTER_VALUE 0xFFFFFFFF;
  32. #define SLEEP_KERNEL_INTERVAL 10 // 10 millisecond
  33. #define TIME_SYNC_INTERVAL 900000 // 15 minute(s) in 1 millisecond units
  34. #define STATUS_OK_INTERVAL 2000 // 2 Sec in 1 millisecond units
  35. #define KNL_SETTINGS_DETECTOR_WIDTH "DETECTOR_WIDTH"
  36. #define KNL_SETTINGS_FILTER_KERNELS "ENABLED_LRF"
  37. #define KNL_SETTINGS_DETECTOR_SST "DETECTOR_SST"
  38. //#define KNL_SETTINGS_V_MOTOR_SETPOINT "VERTICAL_ENC_FREQ"
  39. #define MOJO_KERNEL_TAG_SITE_ID "SITE_ID"
  40. #define MOJO_KERNEL_TAG_SERVER_IDENTITY "IDENTITY"
  41. #define CRON_JOB_CREATE_BACKUP 20
  42. /**
  43. * LRF_Kernel class - manages communication between client
  44. * handlers and PRU cores bseide of Event management.
  45. *
  46. *
  47. * @author gagua
  48. */
  49. class mojoKernel: public kernelPrototype{
  50. private:
  51. basicEventHeap * m_pEventHeap;
  52. ShadowMask * m_pShadow;
  53. time_t m_tTimeTSeconds;
  54. DBC_SYS_LOAD_INFO m_sSysInfo;
  55. DBC_SITE_DATA m_sSiteData;
  56. char m_sIdentity[128];
  57. uint32_t m_nInstanceID;
  58. uint32_t m_nServerID;
  59. uint32_t m_nServerNodeID;
  60. systemAnchor * m_pSystemAnchor;
  61. mojoRemoteClient * m_pRPC;
  62. basicMutex m_mSysInfoProtector;
  63. bool m_bDebugMode;
  64. bool m_bKeepLocalReport;
  65. bool m_bWorkWithRemoteServer;
  66. bool m_bSessionStarted;
  67. bool m_bSessionMustPreserve;
  68. bool m_bFirstSession;
  69. uint8_t m_bMediaMode;
  70. uint32_t m_nNoAlarmCounter;
  71. #ifdef EMBED_AUTORESET
  72. bool m_bEnableAutoReset;
  73. uint32_t m_nAutoResetTime;
  74. uint32_t m_nSessionCounter;
  75. #endif
  76. #ifdef LA_METRO
  77. #endif
  78. void loadFilters();
  79. void unloadFilters();
  80. void validateFilters();
  81. void validateSession();
  82. basicMutex m_mSessionProtector;
  83. void stopSession( bool forced = true );
  84. void preserveSession(){ m_bSessionMustPreserve = true; };
  85. static mojoKernel * _instance;
  86. void handleVideo( VIDEO_SEGMENT_INFO *ptr );
  87. bool validateReports( void );
  88. bool createCronJob( uint8_t job, CSTR param_str = NULL, int param_int = 0 );
  89. void cleanUpReportDir( uint32_t days );
  90. void backupReports( uint32_t days );
  91. void getSystemUtilization( DBC_SYS_LOAD_INFO *ptr );
  92. protected:
  93. virtual void m_fThreadProc( void );
  94. // Constructor
  95. explicit mojoKernel( config_setting_t *ptr );
  96. public:
  97. static mojoKernel * getInstance( config_setting_t *ptr = NULL );
  98. // Destructor
  99. virtual ~mojoKernel();
  100. virtual bool create();
  101. virtual bool dispatchEvent( EVENT_CONTAINER *Evt );
  102. virtual void startSession();
  103. inline bool getDebugMode(){ return m_bDebugMode; };
  104. inline uint8_t getMediaMode(){ return m_bMediaMode; };
  105. #ifdef __MOJO_REMOTE_CLIENT_HEADER__
  106. bool fillMojoInfo( ARGUS_DATA_MOJO_INFO* ptr );
  107. #endif
  108. friend class mojoRemoteClient;
  109. };
  110. #endif // __MOJJO_KERNEL_H_INCL__