From 29c277439ce28af127bfa3b0697a18c6af42d129 Mon Sep 17 00:00:00 2001 From: pankore <86098180+pankore@users.noreply.github.com> Date: Thu, 26 Jan 2023 00:10:07 +0800 Subject: [PATCH] [wifi] use matter wrapper api (#24515) --- src/platform/Ameba/AmebaUtils.cpp | 14 +++++++------- src/platform/Ameba/ConnectivityManagerImpl.cpp | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/platform/Ameba/AmebaUtils.cpp b/src/platform/Ameba/AmebaUtils.cpp index b5f3b95f13454b..4ec66872133429 100644 --- a/src/platform/Ameba/AmebaUtils.cpp +++ b/src/platform/Ameba/AmebaUtils.cpp @@ -42,7 +42,7 @@ CHIP_ERROR AmebaUtils::StartWiFi(void) { CHIP_ERROR err = CHIP_NO_ERROR; // Ensure that the WiFi layer is started. - wifi_on(RTW_MODE_STA); + matter_wifi_on(RTW_MODE_STA); return err; } @@ -61,7 +61,7 @@ bool AmebaUtils::IsStationProvisioned(void) CHIP_ERROR AmebaUtils::IsStationConnected(bool & connected) { CHIP_ERROR err = CHIP_NO_ERROR; - connected = (wifi_is_connected_to_ap() == RTW_SUCCESS) ? 1 : 0; + connected = (matter_wifi_is_connected_to_ap() == RTW_SUCCESS) ? 1 : 0; return err; } @@ -69,7 +69,7 @@ CHIP_ERROR AmebaUtils::EnableStationMode(void) { CHIP_ERROR err = CHIP_NO_ERROR; // Ensure that station mode is enabled in the WiFi layer. - wifi_set_mode(RTW_MODE_STA); + matter_wifi_set_mode(RTW_MODE_STA); return err; } @@ -121,8 +121,8 @@ CHIP_ERROR AmebaUtils::ClearWiFiConfig() CHIP_ERROR AmebaUtils::WiFiDisconnect(void) { CHIP_ERROR err = CHIP_NO_ERROR; - ChipLogProgress(DeviceLayer, "wifi_disconnect"); - err = (wifi_disconnect() == RTW_SUCCESS) ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL; + ChipLogProgress(DeviceLayer, "matter_wifi_disconnect"); + err = (matter_wifi_disconnect() == RTW_SUCCESS) ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL; return err; } @@ -133,8 +133,8 @@ CHIP_ERROR AmebaUtils::WiFiConnect(void) memset(config, 0, sizeof(rtw_wifi_config_t)); GetWiFiConfig(config); ChipLogProgress(DeviceLayer, "Connecting to AP : [%s]", (char *) config->ssid); - int ameba_err = wifi_connect((char *) config->ssid, RTW_SECURITY_WPA_WPA2_MIXED, (char *) config->password, - strlen((const char *) config->ssid), strlen((const char *) config->password), 0, NULL); + int ameba_err = matter_wifi_connect((char *) config->ssid, RTW_SECURITY_WPA_WPA2_MIXED, (char *) config->password, + strlen((const char *) config->ssid), strlen((const char *) config->password), 0, NULL); vPortFree(config); err = (ameba_err == RTW_SUCCESS) ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL; diff --git a/src/platform/Ameba/ConnectivityManagerImpl.cpp b/src/platform/Ameba/ConnectivityManagerImpl.cpp index 040471e7745f2a..4d9d0bed40fec8 100644 --- a/src/platform/Ameba/ConnectivityManagerImpl.cpp +++ b/src/platform/Ameba/ConnectivityManagerImpl.cpp @@ -849,13 +849,13 @@ void ConnectivityManagerImpl::RtkWiFiScanCompletedHandler(void) void ConnectivityManagerImpl::DHCPProcessThread(void * param) { - LwIP_DHCP(0, DHCP_START); + matter_lwip_dhcp(0, DHCP_START); PlatformMgr().LockChipStack(); sInstance.OnStationIPv4AddressAvailable(); PlatformMgr().UnlockChipStack(); #if LWIP_VERSION_MAJOR > 2 || LWIP_VERSION_MINOR > 0 #if LWIP_IPV6 - LwIP_DHCP6(0, DHCP6_START); + matter_lwip_dhcp(0, DHCP6_START); PlatformMgr().LockChipStack(); sInstance.OnIPv6AddressAvailable(); PlatformMgr().UnlockChipStack();