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.
155 lines
5.4 KiB
155 lines
5.4 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 "../data/ponvif/ponvif.h"
|
|
#include "../data/protocol/onvifMediaObserver.h"
|
|
#include "../data/ssdp/ssdpAnnouncer.h"
|
|
#include "../data/NginxMediaServer/mediaNginxStreamingProxyManager.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 "../data/servletWS/servletWS.h"
|
|
|
|
|
|
//#define SIMULATE_KERNEL_TARGETS
|
|
|
|
#ifdef SIMULATE_KERNEL_TARGETS
|
|
#define SIMULATE_LANDING_TO 21
|
|
#define SIMULATE_JAMER_TO 6
|
|
#define SIMULATE_KERNEL_INTERVAL 240
|
|
#define SIMULATE_KERNEL_NODE_ID 233
|
|
#endif
|
|
|
|
#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"
|
|
|
|
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;
|
|
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;
|
|
//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:
|
|
static argusKernel * getInstance( 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 );
|
|
uint32_t getSiteId( void ){ return m_nSiteID; };
|
|
uint32_t getServerId( void ){ return m_nServerID; };
|
|
uint32_t getServerNodeId( void ){ return m_nServerNodeID; };
|
|
CSTR getServerIdentity( void ){ return (CSTR)m_sIdentity; }; // NOTE: DON't FREE THIS MEMORY!!!
|
|
virtual void dispatchEvent( EVENT_CONTAINER *Evt );
|
|
private:
|
|
static argusKernel * _instance;
|
|
// Constructor
|
|
explicit argusKernel( config_setting_t *Settings = NULL );
|
|
};
|
|
|
|
|
|
#endif
|