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.
 
 
 
 
 
 

177 lines
6.5 KiB

/*******************************************************************
*
* DESCRIPTION: ARGUS Kernel Header File
*
* AUTHOR: gagua
*
* HISTORY:
*
* DATE:5/29/2019
*
*******************************************************************/
#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/object/objectSystemAnchor.h"
#include "../components/base/basicEventHeap.h"
#include "rgooseDBConnector.h"
#include "rgooseIPCamera.h"
#include "rgooseNodeFactory.h"
#include "rgooseModuleFactory.h"
#include "rgooseHardwareManager.h"
#include "../data/net/netServer.h"
#include "rgooseTargetFilter.h"
#define SIMULATE_KERNEL_TARGETS
#ifdef SIMULATE_KERNEL_TARGETS
#define SIMULATE_3D_TARGETS 1
#define SIMULATE_LANDING_TO 21
#define SIMULATE_JAMER_TO 6
#define SIMULATE_KERNEL_3D_INTERVAL 2000
//#define SIMULATE_KERNEL_PLS_INTERVAL 1
#define SIMULATE_KERNEL_PLS_INTERVAL 15
#define SIMULATE_KERNEL_MND_INTERVAL 320
//#define SIMULATE_KERNEL_MND_INTERVAL 30
#define SIMULATE_KERNEL_3D_ID 233
#define SIMULATE_KERNEL_PLS_ID 733
#define SIMULATE_KERNEL_MND_ID 707
#endif
#define SLEEP_KERNEL_INTERVAL 10
#define ONVIF_DISCOVERY_INTERVAL 300 // 5 min
#define ONVIF_DISCOVERY_RESULT_TIME 5
#define ARGUS_KERNEL_LAZY_SECONDS 20
#define ARGUS_KERNEL_TAG_SITE_ID "SITE_ID"
#define ARGUS_KERNEL_TAG_SERVER_IDENTITY "IDENTITY"
class argusKernel: public basicThread, public basicEventHandler {
private:
#ifdef SIMULATE_KERNEL_TARGETS
uint32_t m_nEachSec;
uint32_t m_nLastSimRun;
uint8_t m_bLandingTO;
uint8_t m_bJamingTO;
char m_cCurrentMission[40];
#endif
uint32_t m_nSiteID;
uint32_t m_nServerID;
uint32_t m_nServerNodeID;
bool m_bSkipResignComponents;
char m_sIdentity[33];
time_t m_tTimeTSeconds;
basicLogCollection * m_pLog;
basicEventHeap * m_pEventHeap;
systemAnchor * m_pSystemAnchor;
config_setting_t * m_pSettings;
//ssdpAnnouncer * m_pServiceAnnouncer;
uint8_t m_bExitCause;
argusDBC * 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;
argusHardwareManager * m_pHardwareManager;
V_TARGET_FILTERS m_vTargetFilters;
//ARGUS_APF * m_pTEST;
//servletWS * m_pServletWS;
//int isCameraListed( CSTR uid );
//void validateCameras( void );
//void validateEvents( int &lastTSS, int &lastTMS );
void loadFilters();
void unloadFilters();
//void enumerateHardware( void );
void destroyCamCapPicture( uint32_t PicID );
void destroyNode( uint32_t NodeID );
void destroyResource( uint32_t ResID );
protected:
void m_fThreadProc( void );
public:
static argusKernel * getInstance( bool cold_start = true, config_setting_t *Settings = NULL );
// Destructor
virtual ~argusKernel();
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 );
argusModuleFactory * getModuleFactory( void ){ return m_pModuleFactory; };
argusHardwareManager * getHardwareManager( void ){ return m_pHardwareManager; };
uint32_t getSiteId( void ){ return m_nSiteID; };
uint32_t getServerId( void ){ return m_nServerID; };
CSTR getServerIp( void );
CSTR getServerName( void );
uint32_t getServerNodeId( void ){ return m_nServerNodeID; };
CSTR getServerIdentity( void ){ return (CSTR)m_sIdentity; }; // NOTE: DON't FREE THIS MEMORY!!!
ARGUS_TARGET_FILTER * getFilter( uint32_t id );
virtual bool dispatchEvent( EVENT_CONTAINER *Evt );
private:
static argusKernel * _instance;
// Constructor
explicit argusKernel( bool cold_start, config_setting_t *Settings );
};
#endif