Skip to content

Commit

Permalink
[wifi] use matter wrapper api (#24515)
Browse files Browse the repository at this point in the history
  • Loading branch information
pankore authored and pull[bot] committed Jan 6, 2024
1 parent 94b8efd commit 3794850
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/platform/Ameba/AmebaUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -61,15 +61,15 @@ 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;
}

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;
}

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/platform/Ameba/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3794850

Please sign in to comment.