Standardization of device flags: rrm, firmwareUpgrade, rcOnly.

This commit is contained in:
stephb9959
2022-05-12 23:05:27 -07:00
parent 1b6e8f37de
commit 409fc756cd
25 changed files with 414 additions and 195 deletions

34
src/sdks/SDK_fms.cpp Normal file
View File

@@ -0,0 +1,34 @@
//
// Created by stephane bourque on 2022-05-12.
//
#include "SDK_fms.h"
#include "framework/MicroService.h"
#include "RESTObjects/RESTAPI_FMSObjects.h"
namespace OpenWifi::SDK::FMS {
namespace Firmware {
bool GetLatest(const std::string &device_type, bool RCOnly, FMSObjects::Firmware & FirmWare) {
static const std::string EndPoint{"/api/v1/firmwares"};
OpenWifi::OpenAPIRequestGet API( uSERVICE_FIRMWARE,
EndPoint,
{ { "latestOnly" , "true"},
{ "deviceType", device_type},
{ "rcOnly" , RCOnly ? "true" : "false" }
},
50000);
auto CallResponse = Poco::makeShared<Poco::JSON::Object>();
auto StatusCode = API.Do(CallResponse);
if( StatusCode == Poco::Net::HTTPResponse::HTTP_OK) {
return FirmWare.from_json(CallResponse);
}
return false;
}
}
};