|
|
|
@ -800,6 +800,57 @@ DBC_MODULE_DATA *sqliteDBC::getModuleData( uint32_t ID ){ |
|
|
|
return tVal; |
|
|
|
}; |
|
|
|
|
|
|
|
DBC_NODE_DATA *sqliteDBC::getNodeData( uint32_t ID ){ |
|
|
|
DBC_NODE_DATA * tVal = NULL; |
|
|
|
if(m_bIsConnected){ |
|
|
|
char tQBuf[CTEXT]; |
|
|
|
AAssoc *result; |
|
|
|
sprintf(tQBuf, "SELECT * FROM `nodes` WHERE `id`=%d", ID ); |
|
|
|
#ifdef DEBUG_EXTRA
|
|
|
|
LOG(tQBuf); |
|
|
|
#endif
|
|
|
|
result = m_pDataStorage->Query( tQBuf ); |
|
|
|
if( result!= NULL ) { |
|
|
|
if( result->size() > 0 ) { |
|
|
|
Assoc *cArr; |
|
|
|
tVal = (DBC_NODE_DATA*) malloc(sizeof(DBC_NODE_DATA)); |
|
|
|
if( tVal != NULL ) { |
|
|
|
memset( tVal, 0, sizeof(DBC_NODE_DATA)); |
|
|
|
Assoc::iterator it; |
|
|
|
tVal->node_id = ID; |
|
|
|
cArr = result->at(0); |
|
|
|
it = cArr->find("type"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->type = /*(NODE_TYPE)*/ atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("aux_id"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->aux_id = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("aux_parameter"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->aux_parameter = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("online"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->online = (bool)atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("enable"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->enabled = (bool)atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("name"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
sprintf( tVal->name, it->second.c_str() ); |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
deleteResult( result ); |
|
|
|
}; |
|
|
|
return tVal; |
|
|
|
}; |
|
|
|
|
|
|
|
DBC_NET_IF_DATA *sqliteDBC::getNIF_Data( uint32_t nif_id ){ |
|
|
|
DBC_NET_IF_DATA * tVal = NULL; |
|
|
|
if(m_bIsConnected){ |
|
|
|
@ -1415,6 +1466,186 @@ bool sqliteDBC::updateSystemInfo( DBC_SYS_INFO *ptr ){ |
|
|
|
return false; |
|
|
|
}; |
|
|
|
|
|
|
|
DBC_CAM_DATA *sqliteDBC::getCamData( uint32_t ID ){ |
|
|
|
DBC_CAM_DATA *tVal = NULL; |
|
|
|
if(m_bIsConnected){ |
|
|
|
char tQBuf[CTEXT]; |
|
|
|
AAssoc *result; |
|
|
|
sprintf(tQBuf, "SELECT * FROM cameras WHERE `id`=%d", ID ); |
|
|
|
#ifdef DEBUG_ALL
|
|
|
|
LOG(tQBuf); |
|
|
|
#endif
|
|
|
|
result = m_pDataStorage->Query( tQBuf ); |
|
|
|
if( result!= NULL ) { |
|
|
|
if( result->size() > 0 ) { |
|
|
|
Assoc *cArr; |
|
|
|
tVal = (DBC_CAM_DATA*) malloc(sizeof(DBC_CAM_DATA)); |
|
|
|
if( tVal != NULL ) { |
|
|
|
memset( tVal, 0 , sizeof(DBC_CAM_DATA)); |
|
|
|
tVal->id = ID; |
|
|
|
Assoc::iterator it; |
|
|
|
cArr = result->at(0); |
|
|
|
it = cArr->find("site_id"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->site_id = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("node_id"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->node_id = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("online"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->online = (bool) atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("type"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->type = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("name"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
strncpy( tVal->name, it->second.c_str(), 64 ); |
|
|
|
}; |
|
|
|
it = cArr->find("hardware"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
strncpy( tVal->hardware, it->second.c_str(), 32 ); |
|
|
|
}; |
|
|
|
it = cArr->find("status"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->status = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("session"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
strncpy( tVal->session, it->second.c_str(), 32 ); |
|
|
|
}; |
|
|
|
it = cArr->find("protocol"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->protocol = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("protocol_aux"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->protocol_aux = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("uart_id"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->uart_id = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("x"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->x = atof( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("y"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->y = atof( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("z"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->z = atof( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("x_rot"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->x_rot = atof( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("y_rot"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->y_rot = atof( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("z_rot"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->z_rot = atof( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("imager_type"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->imager_type = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("lens_f"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->lens_f = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("ptz_speed_step"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->ptz_speed_step = atof( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("pan_model"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->pan_model = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("pan_angles"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->pan_angles = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("tilt_model"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->tilt_model = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("tilt_angles"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->tilt_angles = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("zoom_model"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->zoom_model = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("zoom"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->zoom = atof( it->second.c_str() ); |
|
|
|
}; |
|
|
|
|
|
|
|
//it = cArr->find("max_range");
|
|
|
|
//if( it != cArr->end() ){
|
|
|
|
// tVal->max_range = atof( it->second.c_str() );
|
|
|
|
//};
|
|
|
|
it = cArr->find("access_login"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
strncpy( tVal->username, it->second.c_str(), 16 ); |
|
|
|
}; |
|
|
|
it = cArr->find("access_pass"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
strncpy( tVal->password, it->second.c_str(), 16 ); |
|
|
|
}; |
|
|
|
it = cArr->find("uuid"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
strncpy( tVal->uuid, it->second.c_str(), 64 ); |
|
|
|
}; |
|
|
|
it = cArr->find("mac"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
strncpy( tVal->mac, it->second.c_str(), 16 ); |
|
|
|
}; |
|
|
|
it = cArr->find("ip"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
strncpy( tVal->ip, it->second.c_str(), 16 ); |
|
|
|
}; |
|
|
|
it = cArr->find("port"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->port = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("onvif_access"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
strncpy( tVal->onvif_access, it->second.c_str(), 5); |
|
|
|
}; |
|
|
|
it = cArr->find("onvif_ctrl"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
strncpy( tVal->onvif_ctrl, it->second.c_str(), 250); |
|
|
|
}; |
|
|
|
it = cArr->find("ptz_token"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
strncpy( tVal->ptz_token, it->second.c_str(), 64); |
|
|
|
}; |
|
|
|
it = cArr->find("trigger_mode"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->triggering_mode = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
it = cArr->find("auth_mode"); |
|
|
|
if( it != cArr->end() ){ |
|
|
|
tVal->auth_mode = atoi( it->second.c_str() ); |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
deleteResult( result ); |
|
|
|
}; |
|
|
|
return tVal; |
|
|
|
}; |
|
|
|
|
|
|
|
uint32_t sqliteDBC::getCamId( CSTR UUID ){ |
|
|
|
uint32_t RetVal = 0; |
|
|
|
if(m_bIsConnected){ |
|
|
|
|