Add WebConfig CLI and standalone WiFi controls
This commit is contained in:
1 parent
7bbde76380
commit
3f5e497ca6
24 files changed
+2698
-1224
No files matched your search
@@ -1383,6 +1383,51 @@ bool MyMesh::getWiFiStatus(char* reply) const {
|
||||
return WebConfigServer::formatWiFiStatus(reply, 160);
|
||||
}
|
||||
|
||||
bool MyMesh::getWiFiPowerSave(char* reply) const {
|
||||
return WebConfigServer::formatWiFiPowerSave(reply, 160);
|
||||
}
|
||||
|
||||
bool MyMesh::getWiFiCLI(char* reply) const {
|
||||
return WebConfigServer::formatWiFiCliStatus(reply, 160);
|
||||
}
|
||||
|
||||
bool MyMesh::setWiFiSSID(const char* value, char* reply) {
|
||||
if (WebConfigServer::setStandaloneWiFiSSID(value, reply, 160)) {
|
||||
const bool was_running = _webconfig && _webconfig->isRunning();
|
||||
if (was_running) _webconfig->requestStop();
|
||||
if (_webconfig) _webconfig->reloadStandaloneWiFi();
|
||||
if (was_running) {
|
||||
strcpy(reply, "OK - WiFi SSID saved; WebConfig stopping, start again to apply");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MyMesh::setWiFiPassword(const char* value, char* reply) {
|
||||
if (WebConfigServer::setStandaloneWiFiPassword(value, reply, 160)) {
|
||||
const bool was_running = _webconfig && _webconfig->isRunning();
|
||||
if (was_running) _webconfig->requestStop();
|
||||
if (_webconfig) _webconfig->reloadStandaloneWiFi();
|
||||
if (was_running) {
|
||||
strcpy(reply, "OK - WiFi password saved; WebConfig stopping, start again to apply");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MyMesh::setWiFiPowerSave(const char* value, char* reply) {
|
||||
if (WebConfigServer::setStandaloneWiFiPowerSave(value, reply, 160)
|
||||
&& _webconfig) {
|
||||
_webconfig->reloadStandaloneWiFi();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MyMesh::setWiFiCLI(const char* value, char* reply) {
|
||||
WebConfigServer::setWiFiCliEnabled(value, reply, 160);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MyMesh::stopWebConfig(char* reply) {
|
||||
if (!_webconfig || !_webconfig->isRunning()) {
|
||||
strcpy(reply, "Err: webconfig not running");
|
||||
|
||||
@@ -483,11 +483,21 @@ public:
|
||||
bool getWebUIStatus(char* reply) const override;
|
||||
bool getWiFiSSID(char* reply) const override;
|
||||
bool getWiFiStatus(char* reply) const override;
|
||||
bool getWiFiPowerSave(char* reply) const override;
|
||||
bool getWiFiCLI(char* reply) const override;
|
||||
bool setWiFiSSID(const char* value, char* reply) override;
|
||||
bool setWiFiPassword(const char* value, char* reply) override;
|
||||
bool setWiFiPowerSave(const char* value, char* reply) override;
|
||||
bool setWiFiCLI(const char* value, char* reply) override;
|
||||
bool isWebConfigActive() const override {
|
||||
return _webconfig && (_webconfig->isRunning() || _webconfig->isStopping());
|
||||
}
|
||||
void getNodeSnapshot(WebConfigServer::NodeSnapshot& snapshot) override;
|
||||
void execCommand(char* cmd, char* reply) override { handleCommand(0, cmd, reply); }
|
||||
bool supportsCliTerminal() const override { return true; }
|
||||
void execAdminCommand(char* cmd, char* reply) override {
|
||||
handleCommand(1, cmd, reply);
|
||||
}
|
||||
void rebootNow() override { _cli.getBoard()->reboot(); }
|
||||
void onConfigBatchStart() override {
|
||||
_wc_batch_active = true;
|
||||
|
||||
Reference in new issue
Block a user