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.

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