diff --git a/Projects/la_mojo/la_mojo.vpj b/Projects/la_mojo/la_mojo.vpj index adcd7395..09caabfd 100644 --- a/Projects/la_mojo/la_mojo.vpj +++ b/Projects/la_mojo/la_mojo.vpj @@ -27,7 +27,7 @@ RunFromDir="%rw"> + OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags`"/> 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){ diff --git a/lib/App/common/SQLite_dataBinder.h b/lib/App/common/SQLite_dataBinder.h index bd585f06..95d37a7c 100644 --- a/lib/App/common/SQLite_dataBinder.h +++ b/lib/App/common/SQLite_dataBinder.h @@ -50,6 +50,7 @@ class sqliteDBC: public dataBinder { virtual uint32_t addLocalWiFi( uint32_t NIF_ID, WIFI_MODE mode, CSTR SSID, CSTR password, WIFI_ENCRIPTION encryption, uint32_t router_id=0 ); virtual uint32_t addResource( uint8_t type, CSTR devName, uint32_t auxID = 0 ); virtual bool cleanNodePushedCMD( void ); + virtual DBC_CAM_DATA * getCamData( uint32_t CamID ); virtual uint32_t getCamId( CSTR UUID ); virtual DBC_MODULE_DATA * getModuleData( uint32_t ID ); virtual DBC_MEDIA_STREAM_DATA * getMediaStreamData(uint32_t ID); @@ -59,6 +60,7 @@ class sqliteDBC: public dataBinder { virtual uint32_t getNIF_IDbyDevice( CSTR device ); virtual uint32_t getWiFi_ID( uint32_t nif_id ); virtual uint32_t getNetworkInfrastructureID( uint32_t nif_id ); + virtual DBC_NODE_DATA * getNodeData( uint32_t ID ); virtual DBC_PUSHED_CMD * getNodePushedCMD( uint32_t NodeID ); virtual DBC_RESOURCE_DATA * getResourceData( uint32_t ResourceID ); virtual uint32_t getResourceID( uint32_t NodeID, uint8_t type, uint32_t auxID ); diff --git a/lib/App/common/dataBinder_structures.h b/lib/App/common/dataBinder_structures.h index 291fcea4..715c5f17 100644 --- a/lib/App/common/dataBinder_structures.h +++ b/lib/App/common/dataBinder_structures.h @@ -257,6 +257,7 @@ typedef struct S_DBC_NODE_DATA{ uint32_t aux_parameter; uint8_t type; bool online; + bool enabled; uint32_t tss; uint32_t tsm; char name[128]; diff --git a/lib/rgoose/rgooseTypes.h b/lib/rgoose/rgooseTypes.h index 91fc2b2a..9eae03c4 100644 --- a/lib/rgoose/rgooseTypes.h +++ b/lib/rgoose/rgooseTypes.h @@ -285,6 +285,7 @@ typedef struct S_DBC_NODE_DATA{ uint32_t aux_parameter; ARGUS_NODE_TYPE type; bool online; + bool enabled; uint32_t tss; uint32_t tsm; char name[128];