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.
 
 
 
 
 
 

829 lines
28 KiB

/*******************************************************************
*
* DESCRIPTION: ARGUS Kernel source
*
* AUTHOR: gagua
*
* HISTORY:
*
* DATE:5/29/2019
*
*******************************************************************/
#include "rgooseKernel.h"
#include "rgooseFilterAPF.h"
#include <sys/types.h>
#include <sys/sysinfo.h>
#include <sys/statvfs.h>
#define LOG( X ) m_pLog->Log( "KRNL", this, X )
#ifdef DEBUG
#define LOG_ERROR( X ) {\
char _tBfrErrMSG2w34[256];\
sprintf( _tBfrErrMSG2w34, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\
m_pLog->Log( "KRNL", this, _LOG_ERROR, _tBfrErrMSG2w34 );\
}
#else
#define LOG_ERROR( X ) m_pLog->Log( "KRNL", this, _LOG_ERROR, X );
#endif
argusKernel *argusKernel::_instance = NULL;
/**
* Returns the single instance of the object.
*/
argusKernel* argusKernel::getInstance( bool cold_start, config_setting_t *Settings ) {
// check if the instance has been created yet
if( 0 == _instance ){
// if not, then create it
_instance = new argusKernel( cold_start, Settings );
};
// return the single instance
return _instance;
};
argusKernel::argusKernel( bool cold_start, config_setting_t *Settings ):basicThread(), basicEventHandler(){
m_bExitCause = 0;
m_nServerID = 0;
m_nSiteID = 0;
m_pDBC = NULL;
m_bSkipResignComponents = cold_start;
m_tTimeTSeconds = time( NULL );
m_pLog = basicLogCollection::getInstance();
m_pSettings = basicSettingsProvider::getInstance()->getSubNode( Settings, "KERNEL" );
//m_pServiceAnnouncer = NULL;
m_pEventHeap = NULL;
//m_pOnvifMediaObserver = NULL;
m_pNodeFactory = NULL;
m_pModuleFactory = NULL;
#ifdef SIMULATE_KERNEL_TARGETS
sprintf( m_cCurrentMission,"" );
m_bLandingTO = 0;
m_bJamingTO = 0;
#endif
};
argusKernel::~argusKernel(){
WaitFinish( true );
#ifdef DEBUG
LOG(" Deleting Node Factory...");
#endif
if( m_pNodeFactory != NULL ) delete( m_pNodeFactory );
#ifdef DEBUG
LOG(" Deleting Module Factory...");
#endif
if( m_pModuleFactory != NULL ) delete( m_pModuleFactory );
#ifdef DEBUG
LOG(" Deleting Target Filters...");
#endif
unloadFilters();
if( m_bExitCause == 0 ) {
#ifdef DEBUG
LOG("Unregister Server");
#endif
m_pDBC->unregisterServer( m_nSiteID, m_nServerNodeID );
#ifdef DEBUG
LOG("Close DataBase Connection...");
#endif
if( m_pDBC != NULL ) delete( m_pDBC );
m_pDBC = NULL;
} else {
if( m_bExitCause == 4 ) {
#ifdef DEBUG
LOG("HW PNP Detection Requested...");
#endif
m_pHardwareManager->enumerateHardware();
};
#ifdef DEBUG
LOG("Close DataBase Connection...");
#endif
if( m_pDBC != NULL ) delete( m_pDBC );
m_pDBC = NULL;
};
_instance = NULL;
};
bool argusKernel::create( void ){
char tBuffer[256];
if( m_pSettings != NULL ) {
config_setting_t * pSetting;
int tVal;
const char * tBuf;
LOG("Getting Settings ...");
if( !config_setting_lookup_string( m_pSettings, ARGUS_KERNEL_TAG_SERVER_IDENTITY, &tBuf ) ){
char * tVar;
char * tTS;
tTS = getTStr(NULL);
tVar = MD5String(tTS);
free(tTS);
sprintf( m_sIdentity, tVar );
pSetting = config_setting_add( m_pSettings, ARGUS_KERNEL_TAG_SERVER_IDENTITY, CONFIG_TYPE_STRING );
config_setting_set_string( pSetting, tVar );
free( tVar );
basicSettingsProvider::getInstance()->compromise();
LOG("Server Identity not defined - generating new!");
} else {
sprintf( m_sIdentity, tBuf );
sprintf( tBuffer, "Server Identity Read From Settings: %s", tBuf );
LOG( tBuffer );
};
if( !config_setting_lookup_int( m_pSettings, ARGUS_KERNEL_TAG_SITE_ID, &tVal ) ){
tVal = m_nSiteID = 1;
pSetting = config_setting_add( m_pSettings, ARGUS_KERNEL_TAG_SITE_ID, CONFIG_TYPE_INT );
config_setting_set_int( pSetting, tVal );
basicSettingsProvider::getInstance()->compromise();
LOG("Site ID not defined - using [1] as number!");
} else {
m_nSiteID = tVal;
sprintf( tBuffer, "Site ID Read From Settings: %d", m_nSiteID );
LOG( tBuffer );
};
} else {
LOG_ERROR("Failed Read Config Settings!");
return false;
};
if( m_pDBC == NULL ) {
LOG("Explicitly Create DBC Object");
m_pDBC = argusDBC::getInstance( m_pSettings );
};
if( m_pDBC == NULL ){
LOG_ERROR("DBC Object Creation Failure!");
return false;
} else LOG("DBC Object is OK");
if(!m_pDBC->connect()){
LOG_ERROR("DBC Connection Failure!");
SLEEP(5000);
//ToDO: Set Restart Kernel!
return false;
};
#ifdef DEBUG
LOG( "Settings Read Done" );
#endif
m_pDBC->registerServer( m_nSiteID, m_sIdentity, getpid() );
m_nServerID = m_pDBC->getServerID( m_sIdentity );
m_nServerNodeID = m_pDBC->getServerNode( m_nServerID );
DBC_SITE_DATA *tSiteData = m_pDBC->getSiteData( m_nSiteID );
if( tSiteData ) {
C3D_WGS84_LOC t;
t.lat = tSiteData->lat;
t.lon = tSiteData->lon;
t.alt = tSiteData->alt;
m_pSystemAnchor = systemAnchor::getInstance( tSiteData->SH, &t );
free( tSiteData );
} else {
LOG_ERROR("Error Loading Site DATA!");
};
//Init Subcomponents
m_pHardwareManager = argusHardwareManager::getInstance( m_bSkipResignComponents );
if( m_pHardwareManager!= NULL ) {
m_pHardwareManager->validate();
} else {
LOG_ERROR("Failure to get HardwareManager Instance!");
return false;
};
//m_pServiceAnnouncer = new ssdpAnnouncer( m_pSettings );
basicSettingsProvider::getInstance()->validate();
m_pEventHeap = basicEventHeap::getInstance();
m_pModuleFactory = argusModuleFactory::getInstance( m_nServerID );
if( !m_pModuleFactory ) {
LOG_ERROR("Failure to get Module Factory Instance!");
return false;
} else {
#ifdef DEBUG
LOG( "Module Factory Created" );
#endif
while( !m_pModuleFactory->isValidationDone() ) SLEEP( 10 );
#ifdef DEBUG
LOG( "Module Factory Validated" );
#endif
};
#ifdef DEBUG
LOG( "Load Filters" );
#endif
loadFilters();
#ifdef DEBUG
LOG( "Filters Loaded" );
#endif
m_pNodeFactory = argusNodeFactory::getInstance( m_nSiteID );
if( !m_pNodeFactory ) {
LOG_ERROR("Failure to get Node Factory Instance!");
return false;
}
#ifdef DEBUG
else {
LOG( "Node Factory Created" );
}
#endif
;
#ifdef DEBUG
LOG( "Kernel Trhead is about to be Created" );
#endif
if( init() == false ){
LOG_ERROR("Error in starting Kernel Thread!");
return false;
};
#ifdef DEBUG
LOG( "Kernel Thread Created" );
sprintf( tBuffer, "Server is registered as id[%d]", m_nServerID );
LOG( tBuffer );
#endif
return true;
};
void argusKernel::loadFilters(){
if( m_pDBC == NULL ) return;
DBC_INT_LIST *tList = m_pDBC->listFilters( m_nServerID );
if( tList != NULL ) {
if( tList->size() > 0 ) {
for( DBC_INT_LIST::iterator idx = tList->begin(); idx < tList->end(); idx++ ) {
DBC_TARGET_FLITER_DATA *tData = NULL;
tData = m_pDBC->getTargetFilterData( (*idx) );
if( tData != NULL ) {
switch( tData->type ) {
case TF_AUTHORISED_PEOPLE_FILTER: {
ARGUS_APF *tFilter = new ARGUS_APF( tData->aux_id );
if( tFilter != NULL ) {
if( tFilter->initFilter() ){
m_vTargetFilters.push_back( (ARGUS_TARGET_FILTER*) tFilter );
} else {
delete( tFilter );
};
};
break;
};
};
free( tData );
};
};
tList->clear();
};
delete( tList );
} else {
#ifdef DEBUG
LOG("No Target Filters Assigned!");
#endif
};
};
void argusKernel::unloadFilters(){
if( m_vTargetFilters.size() > 0 ) {
#ifdef DEBUG
LOG("Have Filters to Unload");
#endif
for( V_TARGET_FILTERS::iterator idx = m_vTargetFilters.begin(); idx < m_vTargetFilters.end(); idx++ ){
switch( (*idx)->getType() ) {
case TF_AUTHORISED_PEOPLE_FILTER:{
delete( (ARGUS_APF*)(*idx) );
break;
};
default:{
char tBuffer[64];
sprintf( tBuffer, "Unknown Filter: %d", (*idx)->getType() );
LOG( tBuffer );
};
};
};
m_vTargetFilters.clear();
LOG("Unload Filters Done!");
}
#ifdef DEBUG
else {
LOG("No Filters to Unload!");
}
#endif
;
};
ARGUS_TARGET_FILTER *argusKernel::getFilter( uint32_t id ){
ARGUS_TARGET_FILTER *RetVal = NULL;
if( m_vTargetFilters.size() > 0 ) {
for( V_TARGET_FILTERS::iterator idx = m_vTargetFilters.begin(); idx < m_vTargetFilters.end(); idx++ ){
if( (*idx)->getID() == id ) {
RetVal = (*idx);
break;
};
};
};
return RetVal;
};
void argusKernel::WaitFinish( bool Force ){
if( Force ){
#ifdef DEBUG
LOG( "Forced Exit" );
#endif
} else {
#ifdef DEBUG
LOG( "Start Waiting for Thread to End (usually at MAIN)." );
#endif
};
waitThreadEnd( Force );
};
/* Main Kernel Thread Procedure */
void argusKernel::m_fThreadProc( void ){
char Buffer[CTEXT];
time_t tTimeTSeconds;
int lastTSS = 0;
int lastTMS = 0;
DBC_EVT_DATA * tEvtPtr;
char pidBuf[16];
sprintf(pidBuf,"pid: %d tid: %d", getpid(), gettid() );
LOG( pidBuf );
#ifdef SIMULATE_KERNEL_TARGETS
LOG("SIMULATION ENABLED");
#endif
m_bThreadStatus = TH_WORKING;
while( m_bThreadStatus < TH_ENDED ){
m_tTimeTSeconds = time( NULL );
// Process Once per Second
if( m_tTimeTSeconds != tTimeTSeconds ){
tTimeTSeconds = m_tTimeTSeconds;
struct sysinfo SI;
struct statvfs DI;
float cpu1 = 0.0f;
float cpu5 = 0.0f;
float cpu15 = 0.0f;
float mem = 0.0f;
float disk = 0.0f;
uint64_t tMEM = 0;
uint64_t tDISK = 0;
uint64_t cMEM = 0;
uint64_t cDISK = 0;
uint32_t cCORES = get_nprocs();
if( sysinfo( &SI ) == 0 ){
float f_load = 100.f / (float)( cCORES * ( 1 << SI_LOAD_SHIFT ) );
cpu1 = SI.loads[0] * f_load;
cpu5 = SI.loads[1] * f_load;
cpu15 = SI.loads[2] * f_load;
tMEM = SI.totalram;
cMEM = SI.totalram - SI.freeram;
mem = (float)cMEM / (float)tMEM;
} else {
LOG_ERROR("Error while getting System Info!");
};
const uint32_t MB = 1 << 10;//(1024 * 1024);// * 1024;
if( statvfs("/", &DI) == 0 ){
tDISK = ( DI.f_blocks * DI.f_frsize ) / MB;
cDISK = ( DI.f_bavail * DI.f_frsize ) / MB;
disk = (float)cDISK / (float)tDISK;
} else {
LOG_ERROR("Error while getting Disk Info!");
};
if( !m_pDBC->updateServerUtilisation( m_nServerID, cCORES, cpu1, cpu5, cpu15, mem, disk, tMEM, cMEM, tDISK, cDISK ) ) LOG_ERROR("Cannot update System Utilisation Stats!");
//Get Queued Commands
DBC_KRNL_CMD *tCMD = NULL;
tCMD = m_pDBC->getActiveServerCommand( m_nServerID );
//tCMD = m_pDBC->getActiveSiteCommand( m_nSiteID );
if( tCMD != NULL ){
switch( tCMD->cmd ) {
case ARGUS_CMD_KRNL_RELOAD:{
LOG("Reload ARGUS SERVER!");
m_bThreadStatus = TH_ENDED;
m_bExitCause = 1;
break;
};
case ARGUS_CMD_KRNL_RESTART:{
LOG("Restart ARGUS SERVER!");
m_bThreadStatus = TH_ENDED;
m_bExitCause = 0;
break;
};
case ARGUS_CMD_NODES_RELOAD:{
if( m_pNodeFactory != NULL ) {
m_pNodeFactory->reloadNodes( m_nSiteID );
};
break;
};
case ARGUS_CMD_NODE_RELOAD:{
uint32_t tNodeID = atoi( tCMD->param );
if( m_pNodeFactory != NULL ) {
m_pNodeFactory->reloadNode( tNodeID );
};
break;
};
case ARGUS_CMD_KRNL_PNP:{
if( m_pHardwareManager!= NULL ) {
LOG_ERROR( "Restart and Detect HardWare!" );
// Must be shutdowned all service that uses hardware prior to detection!
// m_pHardwareManager->enumerateHardware();
m_bThreadStatus = TH_ENDED;
m_bExitCause = 4; // Go -> Detect Hardware in BACKEND
};
break;
};
};
m_pDBC->updateServerCommand( tCMD->id, ARGUS_CMD_STATUS_FINISHED );
//m_pDBC->updateSiteCommand( tCMD->id, ARGUS_CMD_STATUS_FINISHED );
free( tCMD );
};
// Validate Hardware
if( m_pHardwareManager!= NULL ) {
if( !m_pHardwareManager->validate() ){
LOG_ERROR( "Restart Because of HW!" );
m_bThreadStatus = TH_ENDED;
m_bExitCause = 0; // 0 to real exit from app
};
};
// Validate Modules
if( m_pModuleFactory != NULL ) {
m_pModuleFactory->validate();
};
// Validate Nodes
if( m_pNodeFactory != NULL ) {
m_pNodeFactory->validate();
};
};// ops loop
SLEEP( SLEEP_KERNEL_INTERVAL );
};
};
/*
int argusKernel::isCameraListed( CSTR uid ){
if( m_vCamRecords.size() ){
for( int index = 0; index < m_vCamRecords.size(); index++ ){
if(strstr(m_vCamRecords.at(index)->uuid,uid)!=NULL){
m_vCamRecords.at(index)->online = true;
return index;
};
};
} else {
LOG("No Registered Cameras!");
};
return -1;
};
void argusKernel::validateCameras( void ){
vectorWoWoResults *DiscoverResults = m_pOnvifMediaObserver->getResults();
if( DiscoverResults->size() > 0 ) {
for (int index = 0; index < DiscoverResults->size(); index++) {
char tBuffer[256];
sprintf( tBuffer,"Found Camwera [%s] %s", DiscoverResults->at(index)->XAddrs, DiscoverResults->at(index)->RefID );
LOG( tBuffer );
uint32_t cid = m_pDBC->getCamId( DiscoverResults->at(index)->RefID ); //isCameraListed( DiscoverResults->at(index)->RefID );
if( cid ) {
sprintf( tBuffer, "Camera is Listed as %d", cid );
LOG( tBuffer );
//if( strstr(DiscoverResults->at(index)->XAddrs,m_vCamRecords.at(cid)->ip)==NULL ) {
// LOG( DiscoverResults->at(index)->XAddrs );
m_pDBC->updateIPCam( m_nSiteID, cid, DiscoverResults->at(index)->XAddrs );// DiscoverResults->at(index));
//};
} else {
// Uncknown camera - no checking
LOG("Camera is Not Listed");
m_pDBC->addIPCam( m_nSiteID, DiscoverResults->at(index) );
};
};
} else {
LOG("No Online IP Cameras in Network");
};
};
void argusKernel::validateEvents( int &lastTSS, int &lastTMS ){
DBC_EVT_DATA *tPtr = NULL;
EVENT_CONTAINER *tEvt = NULL;
if(m_vEvtRecords.size()) {
lastTSS = m_vEvtRecords.at(m_vEvtRecords.size()-1)->ts_s;
lastTMS = m_vEvtRecords.at(m_vEvtRecords.size()-1)->ts_ms;
#ifndef ONE_EVENT_PER_LOOP
while( m_vEvtRecords.size() ){
#endif
tPtr = *m_vEvtRecords.begin();
if( tPtr != NULL ) {
if( tEvt != NULL ) {
m_pEventHeap->broadcast( tEvt );
};
free( tPtr );
};
m_vEvtRecords.erase( m_vEvtRecords.begin() );
#ifndef ONE_EVENT_PER_LOOP
};
#endif
};
};
*/
bool argusKernel::signalEvent( void ){
//if( m_pDBC->getLastEvents( m_vEvtRecords, 0,0 ) ){
//};
return true;
};
int argusKernel::getNetNodes( ARGUS_NODE_TYPE type, argusNetNode **&RA ){
RA = NULL;
int cnt = 0;
if( m_pNodeFactory != NULL ){
cnt = m_pNodeFactory->getNodesCount( type );
if( cnt ) {
RA = (argusNetNode **) calloc( cnt, sizeof( argusNetNode * ) );
m_pNodeFactory->fetchNodes(type, RA );
};
};
return cnt;
};
argusNetNode *argusKernel::getNetNode( int id ){
if( m_pNodeFactory != NULL ){
return m_pNodeFactory->getNode( id );
};
return NULL;
};
/*
int argusKernel::getModules( ARGUS_MODULE_TYPE type, argusKernelModule **&RA ){
RA = NULL;
int cnt = 0;
if( m_pModuleFactory != NULL ){
cnt = m_pModuleFactory->getModulesCount( type );
if( cnt ) {
RA = (argusKernelModule **) calloc( cnt, sizeof( argusKernelModule * ) );
m_pModuleFactory->fetchModules( type, RA );
};
};
return cnt;
};
argusKernelModule *argusKernel::getModule( int id ){
if( m_pModuleFactory != NULL ){
return m_pModuleFactory->getModule( id );
};
return NULL;
};
*/
void argusKernel::dispatchEvent( EVENT_CONTAINER *Evt ){
// Register all events in Database;
//LOG( "New EVENT!!" );
if( m_pDBC == NULL ) return;
if( Evt == NULL ) return;
switch( Evt->m_eClass ) {
case EVT_CLASS_EXTERNAL_CMD:
switch( Evt->m_eType ){
case EVT_FH_JAMER_ON:{
uint32_t TS_A, TS_B;
TS_A = Evt->m_UMSTS / 1000;
TS_B = Evt->m_UMSTS % 1000;
#ifdef SIMULATE_KERNEL_TARGETS
m_bJamingTO = SIMULATE_JAMER_TO;
#endif
FH_CTRL_DATA * tData = (FH_CTRL_DATA *) Evt->m_pEvtData;
if( tData ) {
if( m_pDBC->addEvent(
0,
Evt->m_UUID,
TS_A,
TS_B,
EVT_FH_JAMER_ON,
0,
0,
0,
0,
0,
0,
0,
0,
0,
tData->evtUUID
) ){
//Simulate FH Module Event;
EVENT_CONTAINER *ttt;
FH_MISSION_DATA * nnn = (FH_MISSION_DATA *) malloc( sizeof(FH_MISSION_DATA));
if( nnn ){
nnn->location.lat = 0;
nnn->location.lon = 0;
nnn->location.alt = 0;
sprintf( nnn->missionID, tData->evtUUID );
ttt = createBasicEvent( 0, EVT_CLASS_FLY_HUNTER, EVT_FH_JAMER_ON, NULL, NULL, nnn );
if( ttt ) {
m_pEventHeap->broadcast( ttt );
} else {
free( nnn );
};
};
};
free(tData);
};
break;
};
case EVT_FH_MISSION_END:{
FH_CTRL_DATA * tData = (FH_CTRL_DATA *) Evt->m_pEvtData;
if( tData ) {
//DBC_EVT_DATA * tEVT = m_pDBC->getEventByUUID( tData->targetUUID );
if( 1 /*tEVT*/ ) {
uint32_t TS_A, TS_B;
TS_A = Evt->m_UMSTS / 1000;
TS_B = Evt->m_UMSTS % 1000;
if( m_pDBC->addEvent(
0,
Evt->m_UUID,
TS_A,
TS_B,
EVT_FH_LANDED ) ){
//Simulate FH Module Event;
EVENT_CONTAINER *ttt;
FH_MISSION_DATA * nnn = (FH_MISSION_DATA *) malloc( sizeof(FH_MISSION_DATA));
if( nnn ){
nnn->location.lat = 0;
nnn->location.lon = 0;
nnn->location.alt = 0;
sprintf( nnn->missionID, tData->evtUUID );
ttt = createBasicEvent( 0, EVT_CLASS_FLY_HUNTER, EVT_FH_LANDED, NULL, NULL, nnn );
if( ttt ) {
m_pEventHeap->broadcast( ttt );
} else {
free( nnn );
};
};
};
//free( tEVT );
} else {
LOG_ERROR("Linked Event Was Not Found!");
};
};
break;
}
case EVT_FH_MISSION_BEGIN:{
FH_CTRL_DATA * tData = (FH_CTRL_DATA *) Evt->m_pEvtData;
#ifdef SIMULATE_KERNEL_TARGETS
m_bLandingTO = SIMULATE_LANDING_TO;
#endif
if( tData ) {
#ifdef SIMULATE_KERNEL_TARGETS
sprintf( m_cCurrentMission, tData->evtUUID );
#endif
DBC_EVT_DATA * tEVT = m_pDBC->getEventByUUID( tData->targetUUID );
if( tEVT ) {
uint32_t TS_A, TS_B;
TS_A = Evt->m_UMSTS / 1000;
TS_B = Evt->m_UMSTS % 1000;
if( Evt->m_db_id = m_pDBC->addEvent(
0,
Evt->m_UUID,
TS_A,
TS_B,
EVT_FH_FLY_TO,
0,
0,
0,
0,
0,
tEVT->lat,
tEVT->lon,
tEVT->alt,
tEVT->id,
tEVT->uuid
) ){
//Simulate FH Module Event;
EVENT_CONTAINER *ttt;
FH_MISSION_DATA * nnn = (FH_MISSION_DATA *) malloc( sizeof(FH_MISSION_DATA));
if( nnn ){
nnn->location.lat = tEVT->lat;
nnn->location.lon = tEVT->lon;
nnn->location.alt = tEVT->alt;
sprintf( nnn->missionID, tData->evtUUID );
ttt = createBasicEvent( 0, EVT_CLASS_FLY_HUNTER, EVT_FH_MISSION_BEGIN, NULL, NULL, nnn );
if( ttt ) {
m_pEventHeap->broadcast( ttt );
} else {
free( nnn );
};
};
};
free( tEVT );
} else {
LOG_ERROR("Linked Event Was Not Found!");
};
};
break;
};
};
break;
case EVT_CLASS_SENSOR_CLD:
case EVT_CLASS_SENSOR_LGS:
case EVT_CLASS_SENSOR_LFS:
case EVT_CLASS_SENSOR_MND:
case EVT_CLASS_SENSOR_PLS_210:
case EVT_CLASS_SENSOR_PLS_360:
case EVT_CLASS_SENSOR_ALS:
case EVT_CLASS_SENSOR_3D:
case EVT_CLASS_SENSOR_ACC:
switch( Evt->m_eType ) {
case EVT_TARGET_1D:{
TARGET_DATA *tDATA =(TARGET_DATA *) Evt->m_pEvtData;
if( tDATA != NULL ) {
uint32_t TS_A, TS_B;
TS_A = Evt->m_UMSTS / 1000;
TS_B = Evt->m_UMSTS % 1000;
Evt->m_db_id = m_pDBC->addEvent(
Evt->m_nSourceUID,
Evt->m_UUID,
TS_A,
TS_B,
Evt->m_eType,
tDATA->digital,
0,
0,
tDATA->local_target.r,
tDATA->area,
tDATA->global_target.lat,
tDATA->global_target.lon,
tDATA->global_target.alt
);
};
break;
};
case EVT_TARGET_2D_BLACK:
case EVT_TARGET_2D_WHITE:{
TARGET_DATA *tDATA = (TARGET_DATA *)Evt->m_pEvtData;
if( tDATA != NULL ) {
uint32_t TS_A, TS_B;
TS_A = Evt->m_UMSTS / 1000;
TS_B = Evt->m_UMSTS % 1000;
Evt->m_db_id = m_pDBC->addEvent(
Evt->m_nSourceUID,
Evt->m_UUID,
TS_A,
TS_B,
Evt->m_eType,
tDATA->digital,
tDATA->local_target.tetta,
tDATA->local_target.fi,
tDATA->local_target.r,
tDATA->area,
tDATA->global_target.lat,
tDATA->global_target.lon,
tDATA->global_target.alt
);
};
break;
};
case EVT_TARGET_3D_BLACK:
case EVT_TARGET_3D_WHITE:{
TARGET_DATA *tDATA = (TARGET_DATA *) Evt->m_pEvtData;
if( tDATA != NULL ) {
uint32_t TS_A, TS_B;
TS_A = Evt->m_UMSTS / 1000;
TS_B = Evt->m_UMSTS % 1000;
Evt->m_db_id = m_pDBC->addEvent(
Evt->m_nSourceUID,
Evt->m_UUID,
TS_A,
TS_B,
Evt->m_eType,
tDATA->digital,
tDATA->local_target.tetta,
tDATA->local_target.fi,
tDATA->local_target.r,
tDATA->area,
tDATA->global_target.lat,
tDATA->global_target.lon,
tDATA->global_target.alt
);
};
break;
};
case EVT_FLIP:{
uint32_t TS_A, TS_B;
TS_A = Evt->m_UMSTS / 1000;
TS_B = Evt->m_UMSTS % 1000;
Evt->m_db_id = m_pDBC->addEvent( Evt->m_nSourceUID, Evt->m_UUID, TS_A, TS_B, Evt->m_eType);
break;
};
};
break;
case EVT_CLASS_VIDEO:{
switch( Evt->m_eType ) {
case EVT_CAPTURE_START:{
break;
};
};
break;
};
};
};
#undef LOG
#undef LOG_ERROR