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.

126 lines
4.8 KiB

4 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
​
​
​
​
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 300 //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. uint8_t m_bMediaMode;
  68. uint32_t m_nNoAlarmCounter;
  69. #ifdef EMBED_AUTORESET
  70. bool m_bEnableAutoReset;
  71. uint32_t m_nAutoResetTime;
  72. uint32_t m_nSessionCounter;
  73. #endif
  74. #ifdef LA_METRO
  75. #endif
  76. void loadFilters();
  77. void unloadFilters();
  78. void validateFilters();
  79. void validateSession();
  80. basicMutex m_mSessionProtector;
  81. void stopSession( bool forced = true );
  82. static mojoKernel * _instance;
  83. void handleVideo( VIDEO_SEGMENT_INFO *ptr );
  84. bool validateReports( void );
  85. bool createCronJob( uint8_t job, CSTR param_str = NULL, int param_int = 0 );
  86. void cleanUpReportDir( uint32_t days );
  87. void backupReports( uint32_t days );
  88. void getSystemUtilization( DBC_SYS_LOAD_INFO *ptr );
  89. protected:
  90. virtual void m_fThreadProc( void );
  91. // Constructor
  92. explicit mojoKernel( config_setting_t *ptr );
  93. public:
  94. static mojoKernel * getInstance( config_setting_t *ptr = NULL );
  95. // Destructor
  96. virtual ~mojoKernel();
  97. virtual bool create();
  98. virtual bool dispatchEvent( EVENT_CONTAINER *Evt );
  99. virtual void startSession();
  100. inline bool getDebugMode(){ return m_bDebugMode; };
  101. inline uint8_t getMediaMode(){ return m_bMediaMode; };
  102. #ifdef __MOJO_REMOTE_CLIENT_HEADER__
  103. bool fillMojoInfo( ARGUS_DATA_MOJO_INFO* ptr );
  104. #endif
  105. friend class mojoRemoteClient;
  106. };
  107. #endif // __MOJJO_KERNEL_H_INCL__