@ -451,7 +451,7 @@ bool argusDBC::getAllCamRecords( uint32_t SiteID, vectorCamRecords &VR ){
} ;
it = cArr - > find ( " protocol_aux " ) ;
if ( it ! = cArr - > end ( ) ) {
strncpy ( tVal - > protocol_aux , it - > second . c_str ( ) , 64 ) ;
tVal - > protocol_aux = atoi ( it - > second . c_str ( ) ) ;
} ;
it = cArr - > find ( " lat " ) ;
if ( it ! = cArr - > end ( ) ) {
@ -1150,7 +1150,7 @@ uint8_t argusDBC::getLRFDataStatus( uint32_t ID ){
} ;
return RetVal ;
} ;
/*
DBC_PUSHED_CMD * argusDBC : : getLRFPushedCMD ( uint32_t ID ) {
DBC_PUSHED_CMD * RetVal = NULL ;
if ( m_bIsConnected ) {
@ -1186,6 +1186,7 @@ DBC_PUSHED_CMD *argusDBC::getLRFPushedCMD( uint32_t ID ){
} ;
return RetVal ;
} ;
*/
DBC_INT_LIST * argusDBC : : listModules ( uint32_t ServerID ) {
DBC_INT_LIST * tVal = NULL ;
@ -1578,7 +1579,7 @@ DBC_CAM_DATA *argusDBC::getCamData( uint32_t ID ){
} ;
it = cArr - > find ( " protocol_aux " ) ;
if ( it ! = cArr - > end ( ) ) {
strncpy ( tVal - > protocol_aux , it - > second . c_str ( ) , 64 ) ;
tVal - > protocol_aux = atoi ( it - > second . c_str ( ) ) ;
} ;
it = cArr - > find ( " uart_id " ) ;
if ( it ! = cArr - > end ( ) ) {
@ -1688,12 +1689,12 @@ DBC_CAM_DATA *argusDBC::getCamData( uint32_t ID ){
return tVal ;
} ;
DBC_PUSHED_CMD * argusDBC : : getCam PushedCMD ( uint32_t ID ) {
DBC_PUSHED_CMD * argusDBC : : getNode PushedCMD ( uint32_t Node ID ) {
DBC_PUSHED_CMD * RetVal = NULL ;
if ( m_bIsConnected ) {
char tQBuf [ CTEXT ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT `pushed_cmd`, `pushed_param` FROM `cameras` WHERE `id`=%d AND `pushed_cmd` > 0 " , ID ) ;
sprintf ( tQBuf , " SELECT * FROM `nodes_qcq` WHERE `node_id`=%d AND `status`=0 LIMIT 1 " , Node ID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
@ -1702,28 +1703,37 @@ DBC_PUSHED_CMD *argusDBC::getCamPushedCMD( uint32_t ID ){
if ( result - > size ( ) > 0 ) {
RetVal = ( DBC_PUSHED_CMD * ) malloc ( sizeof ( DBC_PUSHED_CMD ) ) ;
if ( RetVal ) {
Assoc * cArr ;
Assoc : : iterator it ;
Assoc * cArr ;
Assoc : : iterator it ;
memset ( RetVal , 0 , sizeof ( DBC_PUSHED_CMD ) ) ;
cArr = result - > at ( 0 ) ;
it = cArr - > find ( " pushed_cmd " ) ;
it = cArr - > find ( " id " ) ;
if ( it ! = cArr - > end ( ) ) {
RetVal - > id = atoi ( it - > second . c_str ( ) ) ;
} ;
it = cArr - > find ( " cmd " ) ;
if ( it ! = cArr - > end ( ) ) {
RetVal - > CMD = atoi ( it - > second . c_str ( ) ) ;
} ;
it = cArr - > find ( " pushed_param " ) ;
it = cArr - > find ( " parameter " ) ;
if ( it ! = cArr - > end ( ) ) {
RetVal - > PARAM = atoi ( it - > second . c_str ( ) ) ;
strncpy ( RetVal - > PARAM , it - > second . c_str ( ) , 256 ) ;
RetVal - > PARAM [ 255 ] = ( char ) 0 ;
} ;
//Only If Result is Fetched - Clear Current CMD
sprintf ( tQBuf , " DELETE FROM `nodes_qcq` WHERE `id`=%d " , RetVal - > id ) ;
m_pDatabase - > SilentQuery ( tQBuf ) ;
} ;
} ;
//Only If Result is Fetched - Clear Current CMD
sprintf ( tQBuf , " UPDATE `cameras` SET `pushed_cmd`=0, `pushed_param`=0 WHERE `id`=%d " , ID ) ;
m_pDatabase - > SilentQuery ( tQBuf ) ;
} ;
deleteResult ( result ) ;
} ;
return RetVal ;
} ;
DBC_MODULE_DATA * argusDBC : : getModuleData ( uint32_t ID ) {
DBC_MODULE_DATA * tVal = NULL ;
if ( m_bIsConnected ) {
@ -2817,118 +2827,6 @@ uint32_t argusDBC::addVideoRecord( uint32_t streamID, CSTR md5, uint32_t partID
return tID ;
} ;
DBC_KRNL_CMD * argusDBC : : getActiveSiteCommand ( uint32_t SiteID ) {
DBC_KRNL_CMD * tPtr = NULL ;
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM `cmd_queue` WHERE `status`=0 AND `site_id`=%d LIMIT 1 " , SiteID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
Assoc * cArr ;
tPtr = ( DBC_KRNL_CMD * ) malloc ( sizeof ( DBC_KRNL_CMD ) ) ;
if ( tPtr ! = NULL ) {
Assoc : : iterator it ;
memset ( tPtr , 0 , sizeof ( DBC_KRNL_CMD ) ) ;
cArr = result - > at ( 0 ) ;
it = cArr - > find ( " id " ) ;
if ( it ! = cArr - > end ( ) ) {
tPtr - > id = atoi ( it - > second . c_str ( ) ) ;
} ;
it = cArr - > find ( " cmd " ) ;
if ( it ! = cArr - > end ( ) ) {
tPtr - > cmd = atoi ( it - > second . c_str ( ) ) ;
} ;
it = cArr - > find ( " param " ) ;
if ( it ! = cArr - > end ( ) ) {
strncpy ( tPtr - > param , it - > second . c_str ( ) , 255 ) ;
} ;
it = cArr - > find ( " aux_param " ) ;
if ( it ! = cArr - > end ( ) ) {
strncpy ( tPtr - > aux_param , it - > second . c_str ( ) , 255 ) ;
} ;
} ;
} ;
} ;
deleteResult ( result ) ;
} ;
return tPtr ;
} ;
DBC_KRNL_CMD * argusDBC : : getActiveServerCommand ( uint32_t ServerID ) {
DBC_KRNL_CMD * tPtr = NULL ;
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
AAssoc * result ;
sprintf ( tQBuf , " SELECT * FROM `servers_queue` WHERE `status`=0 AND `server_id`=%d LIMIT 1 " , ServerID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
result = m_pDatabase - > Query ( tQBuf ) ;
if ( result ! = NULL ) {
if ( result - > size ( ) > 0 ) {
Assoc * cArr ;
tPtr = ( DBC_KRNL_CMD * ) malloc ( sizeof ( DBC_KRNL_CMD ) ) ;
if ( tPtr ! = NULL ) {
Assoc : : iterator it ;
memset ( tPtr , 0 , sizeof ( DBC_KRNL_CMD ) ) ;
cArr = result - > at ( 0 ) ;
it = cArr - > find ( " id " ) ;
if ( it ! = cArr - > end ( ) ) {
tPtr - > id = atoi ( it - > second . c_str ( ) ) ;
} ;
it = cArr - > find ( " cmd " ) ;
if ( it ! = cArr - > end ( ) ) {
tPtr - > cmd = atoi ( it - > second . c_str ( ) ) ;
} ;
it = cArr - > find ( " param " ) ;
if ( it ! = cArr - > end ( ) ) {
strncpy ( tPtr - > param , it - > second . c_str ( ) , 255 ) ;
} ;
it = cArr - > find ( " aux_param " ) ;
if ( it ! = cArr - > end ( ) ) {
strncpy ( tPtr - > aux_param , it - > second . c_str ( ) , 255 ) ;
} ;
} ;
} ;
} ;
deleteResult ( result ) ;
} ;
return tPtr ;
} ;
bool argusDBC : : updateSiteCommand ( 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 ;
} ;
return false ;
} ;
bool argusDBC : : updateServerCommand ( uint32_t CMD_ID , uint8_t STATUS ) {
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;
sprintf ( tQBuf , " UPDATE `servers_queue` SET `status`=%d WHERE id=%d " , STATUS , CMD_ID ) ;
# ifdef DEBUG_ALL
LOG ( tQBuf ) ;
# endif
m_pDatabase - > SilentQuery ( tQBuf ) ;
return true ;
} ;
return false ;
} ;
bool argusDBC : : updateLRFDetectionProfile ( uint32_t lrfID , uint8_t profileID , bool master , uint16_t nOrder , uint16_t nOffset , uint16_t nDelta , uint16_t nWidth , uint16_t nFlip , uint16_t nSun , uint8_t bSST , uint32_t GP , uint32_t spikes ) {
if ( m_bIsConnected ) {
char tQBuf [ MAX_PATH_LEN ] ;