feat(F-043,F-044): redesign network.info and network.status command split
network.info now returns all addressing/identity fields needed by the console network panel: ip, subnet, gateway, dns, mac, hostname, ssid, connection_type. Previously only returned ip, gateway, dns. network.status slimmed to pure runtime/health data: connected, ap_mode, rssi, uptime_ms, state. Removed ip, mac, hostname, ssid, type — static facts now belong in network.info. Feature catalog updated with F-043 and F-044 detail sections. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,21 +22,24 @@ CommandResult NetworkHandler::execute(const CommandEnvelope& envelope) {
|
||||
|
||||
CommandResult NetworkHandler::handleInfo(const CommandEnvelope& e) {
|
||||
JsonDocument doc;
|
||||
doc["ip"] = WiFi.localIP().toString();
|
||||
doc["gateway"] = WiFi.gatewayIP().toString();
|
||||
doc["dns"] = WiFi.dnsIP().toString();
|
||||
doc["ip"] = WiFi.localIP().toString();
|
||||
doc["subnet"] = WiFi.subnetMask().toString();
|
||||
doc["gateway"] = WiFi.gatewayIP().toString();
|
||||
doc["dns"] = WiFi.dnsIP().toString();
|
||||
doc["mac"] = WiFi.macAddress();
|
||||
doc["hostname"] = _configManager.getNetworkConfig().hostname;
|
||||
doc["ssid"] = WiFi.SSID();
|
||||
doc["connection_type"] = _networking.isInAPMode() ? "AP" :
|
||||
(_networking.getActiveConnection() == ConnectionType::ETHERNET ? "ETHERNET" : "WIFI");
|
||||
return CommandResult::ok("network.info", doc);
|
||||
}
|
||||
|
||||
CommandResult NetworkHandler::handleStatus(const CommandEnvelope& e) {
|
||||
JsonDocument doc;
|
||||
doc["connected"] = _networking.isConnected();
|
||||
doc["ip"] = _networking.getLocalIP();
|
||||
doc["ap_mode"] = _networking.isInAPMode();
|
||||
doc["rssi"] = WiFi.RSSI();
|
||||
doc["ssid"] = WiFi.SSID();
|
||||
doc["mac"] = WiFi.macAddress();
|
||||
doc["hostname"] = _configManager.getNetworkConfig().hostname;
|
||||
doc["uptime_ms"] = millis();
|
||||
|
||||
const char* stateStr = "UNKNOWN";
|
||||
switch (_networking.getState()) {
|
||||
@@ -50,15 +53,6 @@ CommandResult NetworkHandler::handleStatus(const CommandEnvelope& e) {
|
||||
}
|
||||
doc["state"] = stateStr;
|
||||
|
||||
const char* typeStr = "NONE";
|
||||
switch (_networking.getActiveConnection()) {
|
||||
case ConnectionType::WIFI: typeStr = "WIFI"; break;
|
||||
case ConnectionType::ETHERNET: typeStr = "ETHERNET"; break;
|
||||
case ConnectionType::AP: typeStr = "AP"; break;
|
||||
default: break;
|
||||
}
|
||||
doc["type"] = typeStr;
|
||||
|
||||
return CommandResult::ok("network.status", doc);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user