mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-03 12:08:08 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -32,6 +32,43 @@ namespace OpenWifi::SDK::FMS {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GetDeviceTypeFirmwares(const std::string &device_type, std::vector<FMSObjects::Firmware> & FirmWares) {
|
||||
static const std::string EndPoint{"/api/v1/firmwares"};
|
||||
|
||||
OpenWifi::OpenAPIRequestGet API( uSERVICE_FIRMWARE,
|
||||
EndPoint,
|
||||
{
|
||||
{ "deviceType", device_type}
|
||||
},
|
||||
50000);
|
||||
|
||||
auto CallResponse = Poco::makeShared<Poco::JSON::Object>();
|
||||
auto StatusCode = API.Do(CallResponse);
|
||||
if( StatusCode == Poco::Net::HTTPResponse::HTTP_OK) {
|
||||
Poco::JSON::Array::Ptr FirmwareArr = CallResponse->getArray("firmwares");
|
||||
for(uint64_t i=0;i<FirmwareArr->size();i++) {
|
||||
FMSObjects::Firmware F;
|
||||
F.from_json(FirmwareArr->getObject(i));
|
||||
FirmWares.emplace_back(F);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GetFirmware(const std::string &device_type, const std::string & revision, FMSObjects::Firmware & Firmware) {
|
||||
std::vector<FMSObjects::Firmware> Firmwares;
|
||||
if(GetDeviceTypeFirmwares(device_type,Firmwares)) {
|
||||
for(const auto &firmware:Firmwares) {
|
||||
if(firmware.revision==revision) {
|
||||
Firmware = firmware;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user