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.

125 lines
4.0 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*******************************************************************
  2. *
  3. * DESCRIPTION: ARGUS Kernel Header File
  4. *
  5. * AUTHOR: gagua
  6. *
  7. * HISTORY:
  8. *
  9. * DATE:2/25/2024
  10. *
  11. *******************************************************************/
  12. #ifndef __ARGUS_KERNEL_HEADER__
  13. #define __ARGUS_KERNEL_HEADER__
  14. #include <sys/types.h>
  15. #include <dirent.h>
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19. #include <assert.h>
  20. #include <getopt.h> /* getopt_long() */
  21. #include <fcntl.h> /* low-level i/o */
  22. #include <unistd.h>
  23. #include <errno.h>
  24. #include <sys/stat.h>
  25. #include <sys/types.h>
  26. #include <sys/time.h>
  27. #include <sys/mman.h>
  28. #include <sys/ioctl.h>
  29. #include <linux/videodev2.h>
  30. #include <linux/types.h>
  31. struct serial_struct {
  32. int type;
  33. int line;
  34. unsigned int port;
  35. int irq;
  36. int flags;
  37. int xmit_fifo_size;
  38. int custom_divisor;
  39. int baud_base;
  40. unsigned short close_delay;
  41. char io_type;
  42. char reserved_char[1];
  43. int hub6;
  44. unsigned short closing_wait; /* time to wait before closing */
  45. unsigned short closing_wait2; /* no longer used... */
  46. unsigned char *iomem_base;
  47. unsigned short iomem_reg_shift;
  48. unsigned int port_high;
  49. unsigned long iomap_base; /* cookie passed into ioremap */
  50. };
  51. #include "../../alg/generic/md5.h"
  52. #include "../../components/base/basicThread.h"
  53. #include "../../components/base/basicEngine.h"
  54. #include "../../components/base/basicSettingsProvider.h"
  55. #include "../../components/base/basicEventHeap.h"
  56. #include "../../data/net/netServer.h"
  57. #define SLEEP_KERNEL_INTERVAL 10
  58. #define ONVIF_DISCOVERY_INTERVAL 300 // 5 min
  59. #define ONVIF_DISCOVERY_RESULT_TIME 5
  60. #define ARGUS_KERNEL_TAG_SITE_ID "SITE_ID"
  61. #define ARGUS_KERNEL_TAG_SERVER_IDENTITY "IDENTITY"
  62. #define ARGUS_NODE_SOCK_TYPE_SERIAL_PORT 1
  63. #define ARGUS_NODE_SOCK_TYPE_NETWORK 2
  64. #define ARGUS_NODE_SOCK_TYPE_DC 3
  65. #define ARGUS_NODE_SOCK_TYPE_VIDEO_GRABBER 4
  66. #define ARGUS_NODE_SOCK_TYPE_AUDIO_GRABBER 5
  67. #define ARGUS_NODE_SOCK_TYPE_VIDEO_DIGITAL 6
  68. class ARGUS_Kernel: public basicThread {
  69. private:
  70. uint32_t m_nSiteID;
  71. uint32_t m_nServerID;
  72. uint32_t m_nServerNodeID;
  73. char m_sIdentity[33];
  74. time_t m_tTimeTSeconds;
  75. basicLogCollection * m_pLog;
  76. basicEventHeap * m_pEventHeap;
  77. config_setting_t * m_pSettings;
  78. ssdpAnnouncer * m_pServiceAnnouncer;
  79. uint8_t m_bExitCause;
  80. ARGUS_DBC * m_pDBC;
  81. networkServer * m_pNetClientsServer;
  82. onvifMediaObserver * m_pOnvifMediaObserver;
  83. bool m_bDiscoveryStarted;
  84. vectorARGUS_Cameras m_vCameras;
  85. vectorCamRecords m_vCamRecords;
  86. vectorEventRecords m_vEvtRecords;
  87. argusNodeFactory * m_pNodeFactory;
  88. argusModuleFactory * m_pModuleFactory;
  89. mediaNginxManager * m_pStreamManager;
  90. //servletWS * m_pServletWS;
  91. //int isCameraListed( CSTR uid );
  92. //void validateCameras( void );
  93. //void validateEvents( int &lastTSS, int &lastTMS );
  94. void enumerateHardware( void );
  95. protected:
  96. void m_fThreadProc( void );
  97. public:
  98. // Constructor
  99. explicit ARGUS_Kernel( config_setting_t *Settings = NULL );
  100. // Destructor
  101. virtual ~ARGUS_Kernel();
  102. bool create( void );
  103. bool signalEvent( void );
  104. void WaitFinish( bool Force = false );
  105. uint8_t getExitCause( void ){ return m_bExitCause;};
  106. int getNetNodes( ARGUS_NODE_TYPE type, argusNetNode **&RA );
  107. argusNetNode * getNetNode( int id );
  108. int getModules( ARGUS_MODULE_TYPE type, argusKernelModule **&RA );
  109. argusKernelModule * getModule( int id );
  110. };
  111. #endif