Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ameba] update LwIP and wifi API #31435

Merged
merged 2 commits into from
Jan 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions src/platform/Ameba/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

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

Expand Down
Loading