mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw.git
synced 2025-11-08 22:53:19 +00:00
Adding "completeInfo" on device get and list.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
#include "framework/MicroService.h"
|
||||
#include "framework/RESTAPI_errors.h"
|
||||
#include "framework/RESTAPI_protocol.h"
|
||||
#include "DeviceRegistry.h"
|
||||
#include "RESTAPI_device_helper.h"
|
||||
|
||||
namespace OpenWifi {
|
||||
void RESTAPI_device_handler::DoGet() {
|
||||
@@ -27,28 +27,9 @@ namespace OpenWifi {
|
||||
|
||||
GWObjects::Device Device;
|
||||
if (StorageService()->GetDevice(SerialNumber, Device)) {
|
||||
Poco::JSON::Object Answer;
|
||||
if(GetBoolParameter("completeInfo",false)) {
|
||||
GWObjects::ConnectionState CS;
|
||||
DeviceRegistry()->GetState(SerialNumber,CS);
|
||||
GWObjects::HealthCheck HC;
|
||||
DeviceRegistry()->GetHealthcheck(SerialNumber, HC);
|
||||
std::string Stats;
|
||||
DeviceRegistry()->GetStatistics(SerialNumber, Stats);
|
||||
|
||||
Poco::JSON::Object Answer;
|
||||
Poco::JSON::Object DeviceInfo;
|
||||
Device.to_json(DeviceInfo);
|
||||
Answer.set("deviceInfo", DeviceInfo);
|
||||
Poco::JSON::Object CSInfo;
|
||||
CS.to_json(CSInfo);
|
||||
Answer.set("connectionInfo",CSInfo);
|
||||
Poco::JSON::Object HCInfo;
|
||||
HC.to_json(HCInfo);
|
||||
Answer.set("healthCheckInfo",HCInfo);
|
||||
Poco::JSON::Parser P;
|
||||
auto StatsInfo = P.parse(Stats).extract<Poco::JSON::Object::Ptr>();
|
||||
Answer.set("statsInfo",StatsInfo);
|
||||
|
||||
CompleteDeviceInfo(Device, Answer);
|
||||
return ReturnObject(Answer);
|
||||
} else {
|
||||
Poco::JSON::Object Obj;
|
||||
|
||||
Reference in New Issue
Block a user