/*********************************************************************** * evaluate an args array (calls and constructors) **********************************************************************/ static std::vector<Pothos::Proxy> evalArgsArray( const Pothos::Proxy &evaluator, const Poco::JSON::Array::Ptr &argsArray, const size_t offset = 0) { std::vector<Pothos::Proxy> args; if (argsArray) for (size_t i = offset; i < argsArray->size(); i++) { auto arg = argsArray->get(i).toString(); if (argsArray->get(i).isString()) arg = "\""+arg+"\""; const auto obj = evaluator.call<Pothos::Object>("eval", arg); args.push_back(evaluator.getEnvironment()->convertObjectToProxy(obj)); } return args; }
void updateTasksList() { printf("updateTasksList()\n"); tasksNum = task_manager->getTasksNumber(); if(tasksNum > 0) { Poco::JSON::Object::Ptr pObj = new Poco::JSON::Object; task_manager->getTasks(pObj); Poco::DynamicStruct ds = *pObj; printf("ds:%s\n", ds.toString().c_str()); if(pObj->has("tasks")) printf("pObj has tasks\n"); if(pObj->isArray("tasks")) printf("pObj is array tasks\n"); Poco::JSON::Array::Ptr pArray = pObj->getArray("tasks"); printf("tasksNum:%d, array size:%d\n", tasksNum, pArray->size()); for(int i = 0; i < tasksNum; i++) { memset(pTask[i], 0, sizeof(TaskInfo)); Poco::Dynamic::Var var = pArray->get(i); Poco::DynamicStruct dss = var.extract<Poco::DynamicStruct>(); pTask[i]->id = (Poco::Int64)dss["id"].extract<Poco::Int64>(); pTask[i]->option = dss["option"].extract<int>(); pTask[i]->hour = dss["hour"].extract<int>(); pTask[i]->minute = dss["minute"].extract<int>(); pTask[i]->weekday = dss["weekday"].extract<int>(); } } }
void MeetingConnImpl::OnGetRoomUserList(Object::Ptr object) { Var varStatus = object->get("status"); if(varStatus == 0) { Var resultObj = object->get("result"); Poco::JSON::Array::Ptr array =resultObj.extract<Poco::JSON::Array::Ptr>(); for(Poco::Int32 i = 0; i<array->size();i++) { Parser parser; Var result; Var item = array->get(i); string strItem = item; try { result = parser.parse(strItem); } catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; return; } Object::Ptr tempObj = result.extract<Object::Ptr>(); Var varSessionID = tempObj->get("sessionID"); Var varUserName = tempObj->get("userName"); Var varUserRole = tempObj->get("userRole"); Var varClientType = tempObj->get("clientType"); string strUserName = varUserName; uint32_t userRole = varUserRole; uint32_t clientType = varClientType; uint64_t sessionID= varSessionID; MeetingFrameImpl::GetInstance()->On_MeetingEvent_Member_Online(sessionID,(char*)strUserName.data(),"",clientType,userRole); } } }
//得到房间列表 void MeetingConnImpl::OnGetRoomList(Object::Ptr object) { FastMutex::ScopedLock autoLock(m_lock); Var varStatus = object->get("status"); if(varStatus == 0) { try { Var resultObj = object->get("result"); Poco::JSON::Array::Ptr array =resultObj.extract<Poco::JSON::Array::Ptr>(); for(Poco::Int32 i = 0; i<array->size();i++) { Parser parser; Var result; Var item = array->get(i); string strItem = item; result = parser.parse(strItem); Object::Ptr tempObj = result.extract<Object::Ptr>(); Var varRoomID = tempObj->get("roomID"); Var varRoomName = tempObj->get("roomName"); Var varRoomPassword = tempObj->get("roomPassword"); Var varAdminPassword = tempObj->get("adminPassword"); Var varMixAudio = tempObj->get("mixAudio"); Var varAudioSamplerate = tempObj->get("audioSamplerate"); Var varDefaultVideoSize = tempObj->get("defaultVideoSize"); Var varIsPublic = tempObj->get("isPublic"); Var varMaxUser = tempObj->get("maxUser"); Var varOnlineUser = tempObj->get("onlineUser"); Var varStartTime = tempObj->get("startTime"); Var varEndTime = tempObj->get("endTime"); Var varAudioType = tempObj->get("audioType"); //类型 会议,直播 PROOM_INFO pRoomInfo = new ROOM_INFO(); FastMutex::ScopedLock autoLock(m_lock); pRoomInfo->ulRoomID = varRoomID; strcpy(pRoomInfo->strRoomName,varRoomName.toString().data()); strcpy(pRoomInfo->strPassword,varRoomPassword.toString().data()); strcpy(pRoomInfo->strAdminPwd,varAdminPassword.toString().data()); pRoomInfo->bMixAudio = varMixAudio; pRoomInfo->speakMode = varAudioType; pRoomInfo->sampleRate = varAudioSamplerate; pRoomInfo->defaultVideoSize = varDefaultVideoSize; pRoomInfo->maxUser = varMaxUser; pRoomInfo->startTime = varStartTime; pRoomInfo->endTime = varEndTime; if(varOnlineUser.isEmpty()) { pRoomInfo->onlineUser = 0; } else { pRoomInfo->onlineUser = varOnlineUser; } //m_mapRoom.insert(UINT_VOID_MAP::ValueType(pRoomInfo->ulRoomID,pRoomInfo)); m_pRoomList.push_back(vector<PROOM_INFO>::value_type(pRoomInfo)); } if(array->size()>0) m_pIMeetingEvent->On_MeetingEvent_GetRoomList(array->size()); } catch(Poco::Exception& exc) { std::cout <<"get room list error:"<< exc.message() << std::endl; return; } } else { Var varMsg = object->get("msg"); string errMsg = varMsg; m_pIMeetingEvent->On_MeetingEvent_GetRoomList(0); } }