diff --git a/src/espwifistack.cpp b/src/espwifistack.cpp index f7c36f1..2166c95 100644 --- a/src/espwifistack.cpp +++ b/src/espwifistack.cpp @@ -2063,4 +2063,16 @@ tl::expected set_base_mac_addr(wifi_stack::mac_t mac_addr) } } +tl::expected 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 diff --git a/src/espwifistack.h b/src/espwifistack.h index 5fbbc11..c1db7a8 100644 --- a/src/espwifistack.h +++ b/src/espwifistack.h @@ -55,9 +55,8 @@ const std::optional &get_scan_result(); void delete_scan_result(); tl::expected get_sta_ap_info(); - tl::expected get_default_mac_addr(); tl::expected get_base_mac_addr(); tl::expected set_base_mac_addr(wifi_stack::mac_t mac_addr); - +tl::expected get_ip_info(tcpip_adapter_if_t tcpip_if); } // namespace wifi_stack