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.

132 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
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. bool m_bApplicationFirstRun;
  56. DBC_SYS_LOAD_INFO m_sSysInfo;
  57. DBC_SITE_DATA m_sSiteData;
  58. char m_sIdentity[128];
  59. uint32_t m_nInstanceID;
  60. uint32_t m_nServerID;
  61. uint32_t m_nServerNodeID;
  62. systemAnchor * m_pSystemAnchor;
  63. mojoRemoteClient * m_pRPC;
  64. basicMutex m_mSysInfoProtector;
  65. bool m_bDebugMode;
  66. bool m_bKeepLocalReport;
  67. bool m_bWorkWithRemoteServer;
  68. bool m_bSessionStarted;
  69. bool m_bSessionMustPreserve;
  70. bool m_bFirstSession;
  71. uint8_t m_bMediaMode;
  72. uint32_t m_nNoAlarmCounter;
  73. #ifdef EMBED_AUTORESET
  74. bool m_bEnableAutoReset;
  75. uint32_t m_nAutoResetTime;
  76. uint32_t m_nSessionCounter;
  77. #endif
  78. #ifdef LA_METRO
  79. #endif
  80. void loadFilters();
  81. void unloadFilters();
  82. void validateFilters();
  83. void validateSession();
  84. basicMutex m_mSessionProtector;
  85. void stopSession( bool forced = true );
  86. void preserveSession(){ m_bSessionMustPreserve = true; };
  87. static mojoKernel * _instance;
  88. void handleVideo( VIDEO_SEGMENT_INFO *ptr );
  89. bool validateReports( void );
  90. bool createCronJob( uint8_t job, CSTR param_str = NULL, int param_int = 0 );
  91. void cleanUpReportDir( uint32_t days );
  92. void backupReports( uint32_t days );
  93. void getSystemUtilization( DBC_SYS_LOAD_INFO *ptr );
  94. protected:
  95. virtual void m_fThreadProc( void );
  96. // Constructor
  97. explicit mojoKernel( config_setting_t *ptr );
  98. public:
  99. static mojoKernel * getInstance( config_setting_t *ptr = NULL );
  100. // Destructor
  101. virtual ~mojoKernel();
  102. virtual bool create();
  103. virtual bool dispatchEvent( EVENT_CONTAINER *Evt );
  104. virtual void startSession();
  105. inline bool getDebugMode(){ return m_bDebugMode; };
  106. bool getTrainPresence();
  107. inline uint8_t getMediaMode(){ return m_bMediaMode; };
  108. #ifdef __MOJO_REMOTE_CLIENT_HEADER__
  109. bool fillMojoInfo( ARGUS_DATA_MOJO_INFO* ptr );
  110. #endif
  111. friend class mojoRemoteClient;
  112. };
  113. #endif // __MOJJO_KERNEL_H_INCL__