mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-29 17:52:28 +00:00
Adding venue device retrieval.
This commit is contained in:
@@ -41,16 +41,14 @@ namespace OpenWifi{
|
||||
}
|
||||
|
||||
if(GetBoolParameter("getDevices")) {
|
||||
ProvObjects::VenueDeviceList VDL;
|
||||
VDL.id = Existing.info.id;
|
||||
VDL.name = Existing.info.name;
|
||||
VDL.description = Existing.info.description;
|
||||
auto GetChildren = GetBoolParameter("getChildren");
|
||||
Types::UUIDvec_t Devices = GetDevices(Existing,GetChildren);
|
||||
VDL.devices = GetDevices(Existing,GetChildren);
|
||||
Poco::JSON::Object Answer;
|
||||
Answer.set("id", Existing.info.id);
|
||||
Answer.set("name",Existing.info.name);
|
||||
Answer.set("description", Existing.info.description);
|
||||
Poco::JSON::Array SerialNumbers;
|
||||
for(const auto &i:Devices)
|
||||
SerialNumbers.add(i);
|
||||
Answer.set("devices", Devices);
|
||||
VDL.to_json(Answer);
|
||||
return ReturnObject(Answer);
|
||||
}
|
||||
|
||||
|
||||
@@ -770,6 +770,25 @@ namespace OpenWifi::ProvObjects {
|
||||
return false;
|
||||
}
|
||||
|
||||
void VenueDeviceList::to_json(Poco::JSON::Object &Obj) const {
|
||||
RESTAPI_utils::field_to_json(Obj,"id",id);
|
||||
RESTAPI_utils::field_to_json(Obj,"name",name);
|
||||
RESTAPI_utils::field_to_json(Obj,"description",description);
|
||||
RESTAPI_utils::field_to_json(Obj,"devices",devices);
|
||||
}
|
||||
|
||||
bool VenueDeviceList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||
try {
|
||||
RESTAPI_utils::field_from_json(Obj,"id",id);
|
||||
RESTAPI_utils::field_from_json(Obj,"name",name);
|
||||
RESTAPI_utils::field_from_json(Obj,"description",description);
|
||||
RESTAPI_utils::field_from_json(Obj,"devices",devices);
|
||||
return true;
|
||||
} catch(...) {
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I) {
|
||||
uint64_t Now = std::time(nullptr);
|
||||
|
||||
@@ -480,6 +480,17 @@ namespace OpenWifi::ProvObjects {
|
||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||
};
|
||||
|
||||
struct VenueDeviceList {
|
||||
std::string id;
|
||||
std::string name;
|
||||
std::string description;
|
||||
Types::UUIDvec_t devices;
|
||||
|
||||
void to_json(Poco::JSON::Object &Obj) const;
|
||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||
};
|
||||
|
||||
|
||||
bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
||||
bool CreateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
||||
bool CreateObjectInfo(const SecurityObjects::UserInfo &U, ObjectInfo &I);
|
||||
|
||||
Reference in New Issue
Block a user