Added Network Info Command
This commit is contained in:
@@ -263,6 +263,8 @@ void CommandHandler::handleSystemInfoCommand(JsonVariant contents, const Message
|
||||
handleRollbackFirmwareCommand(context);
|
||||
} else if (action == "get_firmware_status") {
|
||||
handleGetFirmwareStatusCommand(context);
|
||||
} else if (action == "network_info") {
|
||||
handleNetworkInfoCommand(context);
|
||||
} else if (action == "get_full_settings") {
|
||||
handleGetFullSettingsCommand(context);
|
||||
} else {
|
||||
@@ -789,6 +791,21 @@ void CommandHandler::handleGetFirmwareStatusCommand(const MessageContext& contex
|
||||
LOG_DEBUG("Firmware status requested: %s", stateStr.c_str());
|
||||
}
|
||||
|
||||
void CommandHandler::handleNetworkInfoCommand(const MessageContext& context) {
|
||||
StaticJsonDocument<256> response;
|
||||
response["status"] = "SUCCESS";
|
||||
response["type"] = "network_info";
|
||||
|
||||
JsonObject payload = response.createNestedObject("payload");
|
||||
payload["ip"] = WiFi.localIP().toString();
|
||||
payload["gateway"] = WiFi.gatewayIP().toString();
|
||||
payload["dns"] = WiFi.dnsIP().toString();
|
||||
|
||||
String responseStr;
|
||||
serializeJson(response, responseStr);
|
||||
sendResponse(responseStr, context);
|
||||
}
|
||||
|
||||
void CommandHandler::handleGetFullSettingsCommand(const MessageContext& context) {
|
||||
LOG_DEBUG("Full settings requested");
|
||||
|
||||
|
||||
@@ -131,6 +131,7 @@ private:
|
||||
void handleCommitFirmwareCommand(const MessageContext& context);
|
||||
void handleRollbackFirmwareCommand(const MessageContext& context);
|
||||
void handleGetFirmwareStatusCommand(const MessageContext& context);
|
||||
void handleNetworkInfoCommand(const MessageContext& context);
|
||||
void handleGetFullSettingsCommand(const MessageContext& context);
|
||||
|
||||
// Network configuration
|
||||
|
||||
Reference in New Issue
Block a user