diff --git a/docs/features/feature-catalog.md b/docs/features/feature-catalog.md index 3045924..41e50ed 100644 --- a/docs/features/feature-catalog.md +++ b/docs/features/feature-catalog.md @@ -52,6 +52,8 @@ Every feature — user-facing or significant internal mechanism — is listed he | F-040 | Combined relay config command (`relay.set_config`) | v2.1.1 | Stable | | F-041 | Output numbering convention enforced — 1-based everywhere except raw chip pin | v2.1.1 | Stable | | F-042 | Combined clock config commands (`clock.set_config` / `clock.set_alerts_config`) | v2.1.1 | Stable | +| F-043 | `network.info` expanded — subnet, MAC, hostname, SSID, connection type | v2.1.1 | Stable | +| F-044 | `network.status` slimmed — pure runtime state (connected, state, RSSI, uptime, AP mode) | v2.1.1 | Stable | --- @@ -566,3 +568,42 @@ Two batch commands that each collapse multiple individual clock commands into on All fields optional — at least one required. Single `saveClockConfig()` call per command regardless of how many fields are set. Subsystem: `src/Communication/Handlers/ClockHandler/ClockHandler.cpp` + +--- + +### F-043 — `network.info` expanded + +`network.info` now returns the full set of fields needed by the console network panel: + +| Field | Source | +|---|---| +| `ip` | `WiFi.localIP()` | +| `subnet` | `WiFi.subnetMask()` | +| `gateway` | `WiFi.gatewayIP()` | +| `dns` | `WiFi.dnsIP()` | +| `mac` | `WiFi.macAddress()` | +| `hostname` | `NetworkConfig.hostname` | +| `ssid` | `WiFi.SSID()` | +| `connection_type` | `"WIFI"` / `"ETHERNET"` / `"AP"` | + +Previously only returned `ip`, `gateway`, `dns`. Fields `mac`, `hostname`, `ssid` were spread across `network.status`. + +Subsystem: `src/Communication/Handlers/NetworkHandler/NetworkHandler.cpp` + +--- + +### F-044 — `network.status` slimmed to pure runtime state + +`network.status` now returns only live/volatile data useful for health monitoring and polling: + +| Field | Notes | +|---|---| +| `connected` | bool | +| `ap_mode` | bool | +| `rssi` | dBm, live WiFi signal strength | +| `uptime_ms` | `millis()` — time since last boot | +| `state` | Connection state machine: `DISCONNECTED` / `CONNECTING` / `CONNECTED_WIFI` / `CONNECTED_ETHERNET` / `RECONNECTING` / `AP_MODE` | + +Removed from `network.status`: `ip`, `mac`, `hostname`, `ssid`, `type` — these are static addressing facts, now served by `network.info`. + +Subsystem: `src/Communication/Handlers/NetworkHandler/NetworkHandler.cpp` diff --git a/src/Communication/Handlers/NetworkHandler/NetworkHandler.cpp b/src/Communication/Handlers/NetworkHandler/NetworkHandler.cpp index 31142c2..873bbb1 100644 --- a/src/Communication/Handlers/NetworkHandler/NetworkHandler.cpp +++ b/src/Communication/Handlers/NetworkHandler/NetworkHandler.cpp @@ -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); }