@ -1224,7 +1224,7 @@ DBC_INT_LIST *argusDBC::listFilters( uint32_t ServerID ){
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `id` FROM `target_filters` WHERE `server_id`=%d AND `enabled`=1 " , ServerID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
@ -1259,8 +1259,8 @@ DBC_INT_LIST *argusDBC::listMediaServerStreams( uint32_t SiteId, uint32_t MediaS
case LIST_INVALID_RECORDS : sprintf ( tQBuf , " SELECT id FROM media_server_streams WHERE `valid`=0 AND `site_id`=%d AND `media_server_id`=%d " , SiteId , MediaServerID ) ; break ;
default : sprintf ( tQBuf , " SELECT id FROM media_server_streams WHERE `site_id`=%d AND `media_server_id`=%d " , SiteId , MediaServerID ) ;
} ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -1299,8 +1299,8 @@ DBC_INT_LIST *argusDBC::listMediaStreams( uint32_t SiteId, uint8_t listMode ){
default :
sprintf ( tQBuf , " SELECT id FROM media_streams WHERE `site_id`=%d " , SiteId ) ;
} ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -1330,7 +1330,7 @@ DBC_INT_LIST *argusDBC::listDetectionProfileIDs( uint32_t nodeID ){
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `profile_id` FROM `lrf_detection_profiles` WHERE `aux_id`=%d " , nodeID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
@ -1361,7 +1361,7 @@ DBC_INT_LIST *argusDBC::listDetectionProfiles( uint32_t nodeID ){
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `id` FROM `lrf_detection_profiles` WHERE `aux_id`=%d " , nodeID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
@ -1429,7 +1429,7 @@ DBC_INT_LIST *argusDBC::listResources( uint32_t NodeID ){
} else {
sprintf ( tQBuf , " SELECT `id` FROM `resources` WHERE `site_id`=%d AND `active`=1 " , m_nSiteID ) ;
} ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
@ -1471,8 +1471,8 @@ DBC_INT_LIST *argusDBC::listNewModules( uint32_t ServerID, DBC_INT_LIST * old_id
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `id` FROM `server_modules` WHERE `server_id`=%d AND `enabled`=1 AND `id` NOT IN (%s) " , ServerID , tParam ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -1501,7 +1501,7 @@ uint32_t argusDBC::getCamId( CSTR UUID ){
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT id FROM cameras WHERE `uuid`='%s' " , UUID ) ;
# ifdef DEBUG_EXTR A
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
@ -1527,8 +1527,8 @@ DBC_CAM_DATA *argusDBC::getCamData( uint32_t ID ){
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM cameras WHERE `id`=%d " , ID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -1694,8 +1694,8 @@ DBC_PUSHED_CMD *argusDBC::getCamPushedCMD( uint32_t ID ){
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `pushed_cmd`, `pushed_param` FROM `cameras` WHERE `id`=%d AND `pushed_cmd` > 0 " , ID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -1730,7 +1730,7 @@ DBC_MODULE_DATA *argusDBC::getModuleData( uint32_t ID ){
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM server_modules WHERE `id`=%d " , ID ) ;
# ifdef DEBUG_EXTR A
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
@ -1813,8 +1813,8 @@ DBC_MEDIA_STREAM_DATA *argusDBC::getMediaStreamData( uint32_t ID ){
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM media_streams WHERE `id`=%d " , ID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -1879,7 +1879,7 @@ DBC_MEDIA_SERVER_DATA *argusDBC::getMediaServerData( uint32_t ID ){
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM media_servers WHERE `id`=%d " , ID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
@ -1934,8 +1934,8 @@ DBC_MEDIA_SERVER_STREAM_DATA *argusDBC::getMediaServerStreamDataBySource( uint32
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `id`, `media_stream_id`, `online`, `key`, `mrl` FROM media_server_streams WHERE `media_stream_id`=%d " , ID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -1976,8 +1976,8 @@ DBC_MEDIA_SERVER_STREAM_DATA *argusDBC::getMediaServerStreamData( uint32_t ID ){
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `id`, `media_stream_id`, `online`, `key`, `mrl` FROM media_server_streams WHERE `id`=%d " , ID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -2012,47 +2012,47 @@ DBC_MEDIA_SERVER_STREAM_DATA *argusDBC::getMediaServerStreamData( uint32_t ID ){
return tVal ;
} ;
void argusDBC : : registerServer ( uint32_t SiteID , CSTR identity ) {
void argusDBC : : registerServer ( uint32_t SiteID , CSTR identity , int PID ) {
if ( m_bIsConnected ) {
m_nSiteID = SiteID ;
char tQBuf [ CTEXT ] ;
sprintf ( tQBuf , " INSERT INTO servers SET `site_id`=%d, `identity`='%s', `online`=1, `ts`=UNIX_TIMESTAMP(now()) ON DUPLICATE KEY UPDATE `ts`=UNIX_TIMESTAMP(now()), `online`=1 " , SiteID , identity ) ;
# ifdef DEBUG
//LOG(tQBuf);
sprintf ( tQBuf , " INSERT INTO servers SET `site_id`=%d, `identity`='%s', `online`=1, `ts`=UNIX_TIMESTAMP(now()), pid=%d ON DUPLICATE KEY UPDATE `ts`=UNIX_TIMESTAMP(now()), `online`=1, pid=%d " , SiteID , identity , PID , PID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
// Clenup Nodes and services ...
sprintf ( tQBuf , " UPDATE nodes SET `online`=0 WHERE `site_id`=%d " , SiteID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
sprintf ( tQBuf , " UPDATE cameras SET `online`=0 WHERE `site_id`=%d " , SiteID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
sprintf ( tQBuf , " UPDATE media_streams SET `valid`=0 WHERE `site_id`=%d " , SiteID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
sprintf ( tQBuf , " UPDATE media_server_streams SET `valid`=0, `online`=0 WHERE `site_id`=%d " , SiteID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
uint32_t sid = getServerID ( identity ) ;
if ( sid ) {
sprintf ( tQBuf , " INSERT INTO nodes SET `site_id`=%d, `aux_id`='%d', `type`= 0, `online`=1, `name`='Server Node' ON DUPLICATE KEY UPDATE `online`=1 " , m_nSiteID , sid ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
cleanResources ( m_nSiteID , sid ) ;
@ -2064,7 +2064,7 @@ void argusDBC::unregisterServer(uint32_t ServerID, uint32_t NodeID ){
if ( setNodeOffline ( NodeID ) ) {
char tQBuf [ CTEXT ] ;
sprintf ( tQBuf , " UPDATE servers SET `online`=0, `ts`=UNIX_TIMESTAMP(now()) WHERE `id`=%d " , ServerID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2076,12 +2076,12 @@ bool argusDBC::setNodeOnline( uint32_t NodeID, uint8_t status ){
char tQBuf [ CTEXT ] ;
if ( NodeID ) {
sprintf ( tQBuf , " UPDATE nodes SET `online`=%d WHERE `id`=%d " , status , NodeID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
sprintf ( tQBuf , " UPDATE `resources` SET `active`=1 WHERE `node_id`=%d " , NodeID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2096,12 +2096,12 @@ bool argusDBC::setNodeOffline( uint32_t NodeID ){
char tQBuf [ CTEXT ] ;
if ( NodeID ) {
sprintf ( tQBuf , " UPDATE nodes SET `online`=0 WHERE `id` = %d " , NodeID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
sprintf ( tQBuf , " UPDATE `resources` SET `active`=0 WHERE `node_id` = %d " , NodeID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2116,8 +2116,8 @@ DBC_RESOURCE_DATA *argusDBC::getResourceData( uint32_t ResourceID ){
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `node_id`, `type`, `aux_id`, `device` FROM resources WHERE `id`=%d " , ResourceID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -2158,6 +2158,9 @@ uint32_t argusDBC::getResourceID( uint32_t SiteID, uint32_t NodeID, uint8_t type
if ( m_bIsConnected ) {
char tQBuf [ CTEXT ] ;
sprintf ( tQBuf , " SELECT `id` FROM `resources` WHERE `site_id`=%d AND `node_id`=%d AND `type`=%d AND `aux_id`=%d " , SiteID , NodeID , type , auxID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
AAssoc * result ;
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -2181,7 +2184,7 @@ uint32_t argusDBC::getServerID( CSTR identity ){
if ( m_bIsConnected ) {
char tQBuf [ CTEXT ] ;
sprintf ( tQBuf , " SELECT id FROM servers WHERE `identity`='%s' " , identity ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
AAssoc * result ;
@ -2207,7 +2210,7 @@ uint32_t argusDBC::getServerNode( uint32_t SID ){
if ( m_bIsConnected ) {
char tQBuf [ CTEXT ] ;
sprintf ( tQBuf , " SELECT id FROM nodes WHERE `type`=0 AND `aux_id`=%d " , SID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
AAssoc * result ;
@ -2240,8 +2243,8 @@ uint32_t argusDBC::addLocalMediaSource( uint32_t SiteID, CSTR path, uint32_t wid
free ( tMD5 ) ;
sprintf ( tQBuf , " INSERT INTO media_streams SET `site_id`=%d, `source_id`=0, source_type='A', `valid`=1, `name`='Local Frame Grabber', `token`='%s', `img_width`=%d, `img_height`=%d, `mrl_proto`='v4l2', `mrl_port`='', `picture_proto`='', mrl='%s' ON DUPLICATE KEY UPDATE id=id, `valid`=1, img_width=%d, img_height=%d " ,
SiteID , tM5 , width , height , path , width , height ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
RetVal = ( uint32_t ) m_pDatabase - > QueryID ( tQBuf ) ;
} ;
@ -2280,7 +2283,7 @@ bool argusDBC::addNotification( uint32_t MSG_ID, uint8_t DIS_LVL, uint32_t OBJ_I
if ( m_bIsConnected ) {
char tQBuf [ 2048 ] ;
sprintf ( tQBuf , " INSERT INTO `notifications` SET `site_id`=%d, `ts`=NOW(), `lvl`=%d, `type`=%d, `obj_id`=%d ON DUPLICATE KEY UPDATE `status`='A', `ts`=NOW() " , m_nSiteID , DIS_LVL , MSG_ID , OBJ_ID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2297,8 +2300,8 @@ uint32_t argusDBC::addResource( uint32_t SiteID, uint32_t NodeID, uint8_t type,
if ( tMD5 ) {
sprintf ( tQBuf , " INSERT INTO `resources` SET `site_id`=%d, `node_id`=%d, `type`=%d, `md5`='%s', `aux_id`=%d, `device`='%s', `active`=1 ON DUPLICATE KEY UPDATE `active`=1, `aux_id`=%d, `device`='%s' " , SiteID , NodeID , type , tMD5 , auxID , devName , auxID , devName ) ;
free ( tMD5 ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
RetVal = ( uint32_t ) m_pDatabase - > QueryID ( tQBuf ) ;
if ( RetVal = = 0 ) {
@ -2353,7 +2356,7 @@ CSTR argusDBC::getResourceDevice( uint32_t NodeID, uint32_t Type ){
if ( m_bIsConnected ) {
char tQBuf [ CTEXT ] ;
sprintf ( tQBuf , " SELECT `device` FROM `resources` WHERE `node_id`=%d AND `type`=%d LIMIT 1 " , NodeID , Type ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
AAssoc * result ;
@ -2408,7 +2411,7 @@ KAFKA_SETTINGS *argusDBC::getSettingsKAFKA( uint32_t ModuleID ){
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT brocker_address, brocker_port FROM modules_kafka WHERE module_id = %d " , ModuleID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
@ -2441,7 +2444,7 @@ KAFKA_TEMPLATE *argusDBC::getKafkaTemplateForEvent( uint32_t ModuleID, uint32_t
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT topic, template FROM module_kafka_settings WHERE module_id=%d AND class_id=%d AND event_id=%d " , ModuleID , ClassID , EventID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
@ -2479,8 +2482,8 @@ DBC_UART_DATA *argusDBC::getUartData( uint32_t UartID ){
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM uart_settings WHERE id = %d " , UartID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -2523,6 +2526,9 @@ uint32_t argusDBC::getUartID( uint32_t RessourceID ){
if ( m_bIsConnected ) {
char tQBuf [ CTEXT ] ;
sprintf ( tQBuf , " SELECT `id` FROM `uart_settings` WHERE `resource_id`=%d " , RessourceID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
AAssoc * result ;
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -2544,9 +2550,6 @@ uint32_t argusDBC::getUartID( uint32_t RessourceID ){
bool argusDBC : : updateMediaServerStream ( uint32_t id , CSTR mrl , CSTR key ) {
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
# ifdef DEBUG
LOG ( " Stream Update " ) ;
# endif
if ( key = = NULL ) {
if ( mrl = = NULL ) {
sprintf ( tQBuf , " UPDATE media_server_streams SET `online`=0, `key`='', mrl='', `valid`=0 WHERE `id`=%d " , id ) ;
@ -2560,7 +2563,7 @@ bool argusDBC::updateMediaServerStream( uint32_t id, CSTR mrl, CSTR key ){
id
) ;
} ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2599,7 +2602,7 @@ bool argusDBC::updateServerUtilisation( uint32_t ServerID, uint32_t nCores, floa
mcsize ,
ServerID
) ;
# ifdef DEBUG_EXTR A
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2620,8 +2623,8 @@ uint32_t argusDBC::addLocalDCB( uint32_t SiteID, CSTR PATH, CSTR SERIAL, uint8_t
status ,
CNT
) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
uint64_t cid = m_pDatabase - > QueryID ( tQBuf ) ;
if ( cid = = 0 ) {
@ -2630,8 +2633,8 @@ uint32_t argusDBC::addLocalDCB( uint32_t SiteID, CSTR PATH, CSTR SERIAL, uint8_t
SiteID ,
SERIAL
) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
@ -2660,8 +2663,8 @@ uint32_t argusDBC::addLocalDCB( uint32_t SiteID, CSTR PATH, CSTR SERIAL, uint8_t
idx
) ;
}
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
} ;
@ -2685,8 +2688,8 @@ uint32_t argusDBC::addLocalUART( uint32_t ResID, uint8_t utype, uint32_t speed,
port ,
PATH
) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
RetVal = m_pDatabase - > QueryID ( tQBuf ) ;
if ( RetVal = = 0 ) {
@ -2711,8 +2714,8 @@ uint32_t argusDBC::addLocalNetInterface( CSTR address, CSTR mask, CSTR gateway,
mask ,
broadcast
) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
RetVal = m_pDatabase - > QueryID ( tQBuf ) ;
if ( RetVal = = 0 ) {
@ -2734,8 +2737,8 @@ bool argusDBC::addDraw( uint32_t DBID, uint16_t SIZE, CSTR ID ){
ID ,
SIZE
) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
return true ;
@ -2780,8 +2783,8 @@ uint32_t argusDBC::addEvent( uint32_t SRC, CSTR UUID, uint32_t tss, uint32_t tsm
RefUUID
) ;
} ;
# ifdef DEBUG
// LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
RetVal = ( uint32_t ) m_pDatabase - > QueryID ( tQBuf ) ;
} ;
@ -2792,6 +2795,9 @@ bool argusDBC::addVideoEvent( uint32_t evtID, uint32_t videoID ){
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
sprintf ( tQBuf , " INSERT INTO `events_video_records` SET `evt_id`=%d, `video_id`=%d " , evtID , videoID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
return true ;
} ;
@ -2803,6 +2809,9 @@ uint32_t argusDBC::addVideoRecord( uint32_t streamID, CSTR md5, uint32_t partID
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
sprintf ( tQBuf , " INSERT INTO `video_records` SET `media_stream_id`=%d, `ts`=NOW(), `md5`='%s', `part_id`=%d " , streamID , md5 , partID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
tID = ( uint32_t ) m_pDatabase - > QueryID ( tQBuf ) ;
}
return tID ;
@ -2814,6 +2823,9 @@ DBC_KRNL_CMD *argusDBC::getActiveCommand( uint32_t SiteID ){
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM `cmd_queue` WHERE `status`=0 AND `site_id`=%d " , SiteID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
@ -2851,6 +2863,9 @@ bool argusDBC::updateCommand( uint32_t CMD_ID, uint8_t STATUS ){
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
sprintf ( tQBuf , " UPDATE `cmd_queue` SET `status`=%d WHERE id=%d " , STATUS , CMD_ID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
return true ;
} ;
@ -2888,7 +2903,7 @@ bool argusDBC::updateLRFDetectionProfile( uint32_t lrfID, uint8_t profileID, boo
lrfID ,
profileID ) ;
} ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2904,7 +2919,7 @@ bool argusDBC::updateLRFSerial( uint32_t lrfID, CSTR Serial ){
if ( tES ) {
sprintf ( tQBuf , " UPDATE `lrf_sensors` SET `serial`='%s' WHERE `id`=%d " , tES , lrfID ) ;
free ( tES ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2920,7 +2935,7 @@ bool argusDBC::updateLRFVerison( uint32_t lrfID, CSTR version ){
if ( tES ) {
sprintf ( tQBuf , " UPDATE `lrf_sensors` SET `version`='%s' WHERE `id`=%d " , tES , lrfID ) ;
free ( tES ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2934,7 +2949,7 @@ bool argusDBC::setLRFDataStatus( uint32_t lrfID, uint8_t ST ){
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
sprintf ( tQBuf , " UPDATE `lrf_sensors` SET `data_status`=%d WHERE `id`=%d " , ST , lrfID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2947,7 +2962,7 @@ bool argusDBC::setLRFDetectionProfile( uint32_t lrfID, uint8_t profileID ){
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
sprintf ( tQBuf , " UPDATE `lrf_sensors` SET `detection_profile_id`=%d WHERE `id`=%d " , profileID , lrfID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2959,7 +2974,7 @@ bool argusDBC::setLRFAltSerial( uint32_t lrfID, CSTR Serial ){
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
sprintf ( tQBuf , " UPDATE `lrf_sensors` SET `alt_serial`='%s' WHERE `id`=%d " , Serial , lrfID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2971,7 +2986,19 @@ bool argusDBC::setLRFAltVerison( uint32_t lrfID, CSTR version ){
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
sprintf ( tQBuf , " UPDATE `lrf_sensors` SET `alt_version`='%s' WHERE `id`=%d " , version , lrfID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
return true ;
} ;
return false ;
} ;
bool argusDBC : : setStreamValid ( uint32_t streamID ) {
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
sprintf ( tQBuf , " UPDATE `media_streams` SET `valid`=1 WHERE `id`=%d " , streamID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
@ -2979,7 +3006,6 @@ bool argusDBC::setLRFAltVerison( uint32_t lrfID, CSTR version ){
} ;
return false ;
} ;
bool argusDBC : : updateAFPBox ( uint32_t filterID , CSTR Tag , float x , float y , float z ) {
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
@ -2989,8 +3015,8 @@ bool argusDBC::updateAFPBox( uint32_t filterID, CSTR Tag, float x, float y, floa
x , y , z ,
x , y , z
) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
return true ;
@ -3004,20 +3030,15 @@ DBC_MODULE_EMBED_VIDEO_DATA *argusDBC::getEmbedVideoData( uint32_t ID ){
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM `module_embed_video_settings` WHERE `id`=%d " , ID ) ;
# ifdef DEBUG
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
LOG ( " Q is issued " ) ;
if ( result ! = NULL ) {
LOG ( " Result NN " ) ;
if ( result - > size ( ) > 0 ) {
LOG ( " Result CNT " ) ;
Assoc * cArr ;
tPtr = ( DBC_MODULE_EMBED_VIDEO_DATA * ) malloc ( sizeof ( DBC_MODULE_EMBED_VIDEO_DATA ) ) ;
LOG ( " Result ALLOC " ) ;
if ( tPtr ! = NULL ) {
LOG ( " Result ALLOC OK " ) ;
Assoc : : iterator it ;
memset ( tPtr , 0 , sizeof ( DBC_MODULE_EMBED_VIDEO_DATA ) ) ;
cArr = result - > at ( 0 ) ;
@ -3129,7 +3150,6 @@ DBC_MODULE_EMBED_VIDEO_DATA *argusDBC::getEmbedVideoData( uint32_t ID ){
} ;
} ;
} ;
LOG ( " Del Result " ) ;
deleteResult ( result ) ;
} ;
return tPtr ;
@ -3141,8 +3161,8 @@ DBC_EVT_DATA *argusDBC::getEventByUUID( CSTR UUID ){
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM events_cloud WHERE uuid = '%s' " , UUID ) ;
# ifdef DEBUG
//LOG(tQBuf);
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {