#include "StructureAppI.h" Ice::Int StructureAppI::addCamera(Ice::Int index, const std::string &json, const Ice::Current ¤t) { if(controllers.find(index)==controllers.end()){ if(currentCount>=maxCount){ ERR("addCamera faild, camera's num is full!") return -1; } Json::CharReaderBuilder builder; auto reader = builder.newCharReader(); Json::Value value; reader->parse(json.data(), json.data() + json.size(), &value, nullptr); controllers[index] = new AppPipeController(index,std::move(value)); controllers[index]->start(); currentCount++; return 0; }else{ removeCamera(index,current); DBG("removeCamera "<stop(); controller->wait(); delete controller; controllers.erase(index); currentCount--; return 0; } Ice::Int StructureAppI::removeAll(const Ice::Current &) { for(auto controller: controllers){ controller.second->stop(); } for(auto controller: controllers){ controller.second->wait(); delete controller.second; } controllers.clear(); currentCount = 0; return 0; } Ice::Int StructureAppI::getMaxCamCount(const Ice::Current &) { return maxCount; } Ice::Int StructureAppI::getCurrentCamCount(const Ice::Current &) { return currentCount; } int StructureAppI::addVedio(int index, string path,string state) { if(controllers.find(index)==controllers.end()){ if(currentCount>=maxCount){ ERR("addCamera faild, camera's num is full!") return -1; } Json::Value json; json["rtsp"] = path; json["state"] = state; controllers[index] = new AppPipeController(index,json); controllers[index]->start(); currentCount++; return 0; }/*else { removeCamera(index,current); DBG("removeCamera "<getRtmp(); }