Adding new system command for info.

This commit is contained in:
stephb9959
2021-10-13 10:03:11 -07:00
parent 96a8b8cc45
commit 7f589fa36f
5 changed files with 14 additions and 17 deletions

2
build
View File

@@ -1 +1 @@
65
67

View File

@@ -104,7 +104,7 @@ namespace OpenWifi {
Storage()->SetDeviceRevision(Serial, Revision, DeviceType, EndPoint);
DeviceCache()->AddToCache(Serial, DeviceType, EndPoint, Revision);
if(!LatestFirmwareCache()->IsLatest(DeviceType, Revision)) {
std::cout << "Device(ping): " << SerialNumber << " to be upgraded ... " << std::endl;
// std::cout << "Device(ping): " << SerialNumber << " to be upgraded ... " << std::endl;
AutoUpdater()->ToBeUpgraded(SerialNumber, DeviceType);
}
}

View File

@@ -127,9 +127,12 @@ namespace OpenWifi::RESTAPI::Protocol {
static const char * ACCESSPOLICY = "accessPolicy";
static const char * PASSWORDPOLICY = "passwordPolicy";
static const char * FORGOTPASSWORD = "forgotPassword";
static const char * RESENDMFACODE = "resendMFACode";
static const char * COMPLETEMFACHALLENGE = "completeMFAChallenge";
static const char * ME = "me";
static const char * TELEMETRY = "telemetry";
static const char * INTERVAL = "interval";
static const char * UI = "UI";
}

View File

@@ -41,8 +41,7 @@ namespace OpenWifi {
Poco::format("Setting log level for %s at %s", Name, Value));
}
}
OK();
return;
return OK();
}
} else if (Command == RESTAPI::Protocol::GETLOGLEVELS) {
auto CurrentLogLevels = Daemon()->GetLogLevels();
@@ -55,8 +54,7 @@ namespace OpenWifi {
Array.add(Pair);
}
Result.set(RESTAPI::Protocol::TAGLIST, Array);
ReturnObject(Result);
return;
return ReturnObject(Result);
} else if (Command == RESTAPI::Protocol::GETLOGLEVELNAMES) {
Poco::JSON::Object Result;
Poco::JSON::Array LevelNamesArray;
@@ -64,8 +62,7 @@ namespace OpenWifi {
for (const auto &i : LevelNames)
LevelNamesArray.add(i);
Result.set(RESTAPI::Protocol::LIST, LevelNamesArray);
ReturnObject(Result);
return;
return ReturnObject(Result);
} else if (Command == RESTAPI::Protocol::GETSUBSYSTEMNAMES) {
Poco::JSON::Object Result;
Poco::JSON::Array LevelNamesArray;
@@ -73,8 +70,7 @@ namespace OpenWifi {
for (const auto &i : SubSystemNames)
LevelNamesArray.add(i);
Result.set(RESTAPI::Protocol::LIST, LevelNamesArray);
ReturnObject(Result);
return;
return ReturnObject(Result);
} else if (Command == RESTAPI::Protocol::STATS) {
} else if (Command == RESTAPI::Protocol::RELOAD) {
@@ -95,12 +91,10 @@ namespace OpenWifi {
});
ReloadThread.detach();
}
OK();
return;
return OK();
}
} else {
BadRequest(RESTAPI::Errors::InvalidCommand);
return;
return BadRequest(RESTAPI::Errors::InvalidCommand);
}
BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
@@ -115,6 +109,7 @@ namespace OpenWifi {
Answer.set(RESTAPI::Protocol::OS, Poco::Environment::osName());
Answer.set(RESTAPI::Protocol::PROCESSORS, Poco::Environment::processorCount());
Answer.set(RESTAPI::Protocol::HOSTNAME, Poco::Environment::nodeName());
Answer.set(RESTAPI::Protocol::UI, Daemon()->GetUIURI());
Poco::JSON::Array Certificates;
auto SubSystems = Daemon()->GetFullSubSystems();
@@ -138,8 +133,7 @@ namespace OpenWifi {
}
}
Answer.set("certificates", Certificates);
ReturnObject(Answer);
return;
return ReturnObject(Answer);
}
BadRequest(RESTAPI::Errors::InvalidCommand);
}

File diff suppressed because one or more lines are too long