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

/*******************************************************************
*
* DESCRIPTION: ARGUS Kernel Header File
*
* AUTHOR: gagua
*
* HISTORY:
*
* DATE:2/25/2024
*
*******************************************************************/
#ifndef __ARGUS_KERNEL_HEADER__
#define __ARGUS_KERNEL_HEADER__
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <getopt.h> /* getopt_long() */
#include <fcntl.h> /* low-level i/o */
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include <linux/types.h>
struct serial_struct {
int type;
int line;
unsigned int port;
int irq;
int flags;
int xmit_fifo_size;
int custom_divisor;
int baud_base;
unsigned short close_delay;
char io_type;
char reserved_char[1];
int hub6;
unsigned short closing_wait; /* time to wait before closing */
unsigned short closing_wait2; /* no longer used... */
unsigned char *iomem_base;
unsigned short iomem_reg_shift;
unsigned int port_high;
unsigned long iomap_base; /* cookie passed into ioremap */
};
#include "../../alg/generic/md5.h"
#include "../../components/base/basicThread.h"
#include "../../components/base/basicEngine.h"
#include "../../components/base/basicSettingsProvider.h"
#include "../../components/base/basicEventHeap.h"
#include "../../data/net/netServer.h"
#define SLEEP_KERNEL_INTERVAL 10
#define ONVIF_DISCOVERY_INTERVAL 300 // 5 min
#define ONVIF_DISCOVERY_RESULT_TIME 5
#define ARGUS_KERNEL_TAG_SITE_ID "SITE_ID"
#define ARGUS_KERNEL_TAG_SERVER_IDENTITY "IDENTITY"
#define ARGUS_NODE_SOCK_TYPE_SERIAL_PORT 1
#define ARGUS_NODE_SOCK_TYPE_NETWORK 2
#define ARGUS_NODE_SOCK_TYPE_DC 3
#define ARGUS_NODE_SOCK_TYPE_VIDEO_GRABBER 4
#define ARGUS_NODE_SOCK_TYPE_AUDIO_GRABBER 5
#define ARGUS_NODE_SOCK_TYPE_VIDEO_DIGITAL 6
class ARGUS_Kernel: public basicThread {
private:
uint32_t m_nSiteID;
uint32_t m_nServerID;
uint32_t m_nServerNodeID;
char m_sIdentity[33];
time_t m_tTimeTSeconds;
basicLogCollection * m_pLog;
basicEventHeap * m_pEventHeap;
config_setting_t * m_pSettings;
ssdpAnnouncer * m_pServiceAnnouncer;
uint8_t m_bExitCause;
ARGUS_DBC * m_pDBC;
networkServer * m_pNetClientsServer;
onvifMediaObserver * m_pOnvifMediaObserver;
bool m_bDiscoveryStarted;
vectorARGUS_Cameras m_vCameras;
vectorCamRecords m_vCamRecords;
vectorEventRecords m_vEvtRecords;
argusNodeFactory * m_pNodeFactory;
argusModuleFactory * m_pModuleFactory;
mediaNginxManager * m_pStreamManager;
//servletWS * m_pServletWS;
//int isCameraListed( CSTR uid );
//void validateCameras( void );
//void validateEvents( int &lastTSS, int &lastTMS );
void enumerateHardware( void );
protected:
void m_fThreadProc( void );
public:
// Constructor
explicit ARGUS_Kernel( config_setting_t *Settings = NULL );
// Destructor
virtual ~ARGUS_Kernel();
bool create( void );
bool signalEvent( void );
void WaitFinish( bool Force = false );
uint8_t getExitCause( void ){ return m_bExitCause;};
int getNetNodes( ARGUS_NODE_TYPE type, argusNetNode **&RA );
argusNetNode * getNetNode( int id );
int getModules( ARGUS_MODULE_TYPE type, argusKernelModule **&RA );
argusKernelModule * getModule( int id );
};
#endif