Adding firmware upgrade management.

This commit is contained in:
stephb9959
2021-10-04 14:52:42 -07:00
parent d1df8a5fc4
commit 13cae4de6e
4 changed files with 12 additions and 1 deletions

2
build
View File

@@ -1 +1 @@
255 257

View File

@@ -211,6 +211,8 @@ namespace OpenWifi{
AssignIfPresent(ParsedObj,"description", Existing.info.description); AssignIfPresent(ParsedObj,"description", Existing.info.description);
AssignIfPresent(ParsedObj, "rrm", Existing.rrm); AssignIfPresent(ParsedObj, "rrm", Existing.rrm);
NewConfig.info.modified = std::time(nullptr); NewConfig.info.modified = std::time(nullptr);
AssignIfPresent(ParsedObj,"firmwareUpgrade",Existing.firmwareUpgrade);
AssignIfPresent(ParsedObj,"firmwareRCOnly", Existing.firmwareRCOnly);
if(!NewConfig.variables.empty()) if(!NewConfig.variables.empty())
Existing.variables = NewConfig.variables; Existing.variables = NewConfig.variables;

View File

@@ -185,6 +185,14 @@ namespace OpenWifi {
return false; return false;
} }
bool RESTAPIHandler::AssignIfPresent(const Poco::JSON::Object::Ptr &O, const std::string &Field, bool &Value) {
if(O->has(Field)) {
Value = O->get(Field).toString()=="true";
return true;
}
return false;
}
void RESTAPIHandler::AddCORS() { void RESTAPIHandler::AddCORS() {
auto Origin = Request->find("Origin"); auto Origin = Request->find("Origin");
if (Origin != Request->end()) { if (Origin != Request->end()) {

View File

@@ -142,6 +142,7 @@ namespace OpenWifi {
static bool AssignIfPresent(const Poco::JSON::Object::Ptr &O, const std::string &Field, std::string &Value); static bool AssignIfPresent(const Poco::JSON::Object::Ptr &O, const std::string &Field, std::string &Value);
static bool AssignIfPresent(const Poco::JSON::Object::Ptr &O, const std::string &Field, uint64_t &Value); static bool AssignIfPresent(const Poco::JSON::Object::Ptr &O, const std::string &Field, uint64_t &Value);
static bool AssignIfPresent(const Poco::JSON::Object::Ptr &O, const std::string &Field, bool &Value);
template<typename T> void ReturnObject(const char *Name, const std::vector<T> & Objects) { template<typename T> void ReturnObject(const char *Name, const std::vector<T> & Objects) {
Poco::JSON::Object Answer; Poco::JSON::Object Answer;