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.

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