Add WebConfig CLI and standalone WiFi controls

This commit is contained in:
mikecarper committed 2026-07-31 01:19:17 -07:00
1 parent 7bbde76380
commit 3f5e497ca6
24 files changed
+2698 -1224

No files matched your search

+65 -4
View File
@@ -7666,6 +7666,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;
}
void MyMesh::onConfigBatchEnd() {
_wc_batch_active = false;
#ifdef WITH_MQTT_BRIDGE
@@ -8001,8 +8046,24 @@ void MyMesh::handleCommand(uint32_t sender_timestamp, ClientInfo* sender, char *
}
mesh::cli::normalizeCommandVerb(command);
const mesh::cli::NoArgCommandMatch discover_neighbors_match =
mesh::cli::matchNoArgCommand(command, "discover.neighbors");
#if defined(PORTABLE_MQTT_OBSERVER)
// Neighbor refresh is a core repeater operation, not an MQTT feature. Keep
// it ahead of the portable observer's reduced CommonCLI handoff so every
// repeater build exposes the same command.
if (discover_neighbors_match != mesh::cli::NoArgCommandMatch::NoMatch) {
if (discover_neighbors_match ==
mesh::cli::NoArgCommandMatch::HasArguments) {
strcpy(reply, "Err - discover.neighbors has no options");
} else {
sendNodeDiscoverReq();
strcpy(reply, "OK - Discover sent");
}
return;
}
// The portable observer exposes its MQTT/WiFi/update controls through
// CommonCLI. Omit the repeater's large remote-administration command tree;
// its mesh behavior remains fixed by the selected build profile.
@@ -8392,10 +8453,10 @@ void MyMesh::handleCommand(uint32_t sender_timestamp, ClientInfo* sender, char *
savePrefs();
strcpy(reply, "OK");
}
} else if (memcmp(command, "discover.neighbors", 18) == 0) {
const char* sub = command + 18;
while (*sub == ' ') sub++;
if (*sub != 0) {
} else if (discover_neighbors_match !=
mesh::cli::NoArgCommandMatch::NoMatch) {
if (discover_neighbors_match ==
mesh::cli::NoArgCommandMatch::HasArguments) {
strcpy(reply, "Err - discover.neighbors has no options");
} else {
sendNodeDiscoverReq();
+10
View File
@@ -960,11 +960,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;
+45
View File
@@ -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");
+10
View File
@@ -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;