Added get_ip_info()

This commit is contained in:
2021-06-29 11:06:59 +02:00
parent 0497b7a134
commit 04ed8200f5
2 changed files with 13 additions and 2 deletions

View File

@@ -2063,4 +2063,16 @@ tl::expected<void, std::string> set_base_mac_addr(wifi_stack::mac_t mac_addr)
}
}
tl::expected<tcpip_adapter_ip_info_t, std::string> get_ip_info(tcpip_adapter_if_t tcpip_if)
{
tcpip_adapter_ip_info_t ip;
if (const auto result = tcpip_adapter_get_ip_info(tcpip_if, &ip); result == ESP_OK)
return ip;
else
{
ESP_LOGE(TAG, "tcpip_adapter_get_ip_info() failed with %s", esp_err_to_name(result));
return tl::make_unexpected(std::string{"tcpip_adapter_get_ip_info() failed with "} + esp_err_to_name(result));
}
}
} // namespace wifi_stack

View File

@@ -55,9 +55,8 @@ const std::optional<scan_result> &get_scan_result();
void delete_scan_result();
tl::expected<wifi_ap_record_t, std::string> get_sta_ap_info();
tl::expected<wifi_stack::mac_t, std::string> get_default_mac_addr();
tl::expected<wifi_stack::mac_t, std::string> get_base_mac_addr();
tl::expected<void, std::string> set_base_mac_addr(wifi_stack::mac_t mac_addr);
tl::expected<tcpip_adapter_ip_info_t, std::string> get_ip_info(tcpip_adapter_if_t tcpip_if);
} // namespace wifi_stack