From 1076630d175dceafa9eb7ebd247863f75ee04f9b Mon Sep 17 00:00:00 2001 From: pankore <86098180+pankore@users.noreply.github.com> Date: Sat, 20 Jan 2024 08:32:12 +0800 Subject: [PATCH] [Ameba] update LwIP and wifi API (#31435) * [Ameba] updated LwIP and wifi API * [Ameba] update wifi_reg_event_handler --- .../Ameba/ConnectivityManagerImpl.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/platform/Ameba/ConnectivityManagerImpl.cpp b/src/platform/Ameba/ConnectivityManagerImpl.cpp index 28618f99079614..4fb5ebfb018e82 100644 --- a/src/platform/Ameba/ConnectivityManagerImpl.cpp +++ b/src/platform/Ameba/ConnectivityManagerImpl.cpp @@ -83,10 +83,11 @@ CHIP_ERROR ConnectivityManagerImpl::_Init() chip_connmgr_set_callback_func((chip_connmgr_callback) (conn_callback_dispatcher), this); // Register WiFi event handlers - wifi_reg_event_handler(WIFI_EVENT_CONNECT, ConnectivityManagerImpl::RtkWiFiStationConnectedHandler, NULL); - wifi_reg_event_handler(WIFI_EVENT_FOURWAY_HANDSHAKE_DONE, ConnectivityManagerImpl::RtkWiFiStationConnectedHandler, NULL); - wifi_reg_event_handler(WIFI_EVENT_DISCONNECT, ConnectivityManagerImpl::RtkWiFiStationDisconnectedHandler, NULL); - wifi_reg_event_handler(WIFI_EVENT_DHCP6_DONE, ConnectivityManagerImpl::RtkWiFiDHCPCompletedHandler, NULL); + matter_wifi_reg_event_handler(MATTER_WIFI_EVENT_CONNECT, ConnectivityManagerImpl::RtkWiFiStationConnectedHandler, NULL); + matter_wifi_reg_event_handler(MATTER_WIFI_EVENT_FOURWAY_HANDSHAKE_DONE, ConnectivityManagerImpl::RtkWiFiStationConnectedHandler, + NULL); + matter_wifi_reg_event_handler(MATTER_WIFI_EVENT_DISCONNECT, ConnectivityManagerImpl::RtkWiFiStationDisconnectedHandler, NULL); + matter_wifi_reg_event_handler(MATTER_WIFI_EVENT_DHCP6_DONE, ConnectivityManagerImpl::RtkWiFiDHCPCompletedHandler, NULL); err = Internal::AmebaUtils::StartWiFi(); SuccessOrExit(err); @@ -702,7 +703,7 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void) { haveIPv4Conn = true; char addrStr[INET_ADDRSTRLEN]; - ip4addr_ntoa_r((const ip4_addr_t *) LwIP_GetIP(&xnetif[0]), addrStr, sizeof(addrStr)); + ip4addr_ntoa_r((const ip4_addr_t *) matter_LwIP_GetIP(0), addrStr, sizeof(addrStr)); IPAddress::FromString(addrStr, addr); } @@ -749,13 +750,13 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void) void ConnectivityManagerImpl::OnStationIPv4v6AddressAvailable(void) { - uint8_t * ip = LwIP_GetIP(&xnetif[0]); - uint8_t * gw = LwIP_GetGW(&xnetif[0]); - uint8_t * msk = LwIP_GetMASK(&xnetif[0]); + uint8_t * ip = matter_LwIP_GetIP(0); + uint8_t * gw = matter_LwIP_GetGW(0); + uint8_t * msk = matter_LwIP_GetMASK(0); #if LWIP_VERSION_MAJOR > 2 || LWIP_VERSION_MINOR > 0 #if LWIP_IPV6 - uint8_t * ipv6_0 = LwIP_GetIPv6_linklocal(&xnetif[0]); - uint8_t * ipv6_1 = LwIP_GetIPv6_global(&xnetif[0]); + uint8_t * ipv6_0 = matter_LwIP_GetIPv6_linklocal(0); + uint8_t * ipv6_1 = matter_LwIP_GetIPv6_global(0); #endif #endif // LWIP_VERSION_MAJOR > 2 || LWIP_VERSION_MINOR > 0