@@ -372,7 +372,10 @@ sl_status_t SetWifiConfigurations()
372
372
VerifyOrReturnError (status == SL_STATUS_OK, status,
373
373
ChipLogError (DeviceLayer, " sl_wifi_set_listen_interval failed: 0x%lx" , status));
374
374
375
- sl_wifi_advanced_client_configuration_t client_config = { .max_retry_attempts = 5 };
375
+ // This is be triggered on the disconnect use case, providing the amount of TA tries
376
+ // Setting the TA retry to 1 and giving the control to the M4 for improved power efficiency
377
+ // When max_retry_attempts is set to 0, TA will retry indefinitely.
378
+ sl_wifi_advanced_client_configuration_t client_config = { .max_retry_attempts = 1 };
376
379
status = sl_wifi_set_advanced_client_configuration (SL_WIFI_CLIENT_INTERFACE, &client_config);
377
380
VerifyOrReturnError (status == SL_STATUS_OK, status,
378
381
ChipLogError (DeviceLayer, " sl_wifi_set_advanced_client_configuration failed: 0x%lx" , status));
@@ -490,10 +493,6 @@ CHIP_ERROR WifiInterfaceImpl::InitWiFiStack(void)
490
493
sWifiEventQueue = osMessageQueueNew (kWfxQueueSize , sizeof (WiseconnectWifiInterface::WifiPlatformEvent), nullptr );
491
494
VerifyOrReturnError (sWifiEventQueue != nullptr , CHIP_ERROR_NO_MEMORY);
492
495
493
- status = CreateDHCPTimer ();
494
- VerifyOrReturnError (status == SL_STATUS_OK, CHIP_ERROR_NO_MEMORY,
495
- ChipLogError (DeviceLayer, " CreateDHCPTimer failed: %lx" , status));
496
-
497
496
return CHIP_NO_ERROR;
498
497
}
499
498
@@ -504,7 +503,7 @@ void WifiInterfaceImpl::ProcessEvent(WiseconnectWifiInterface::WifiPlatformEvent
504
503
case WiseconnectWifiInterface::WifiPlatformEvent::kStationConnect :
505
504
ChipLogDetail (DeviceLayer, " WifiPlatformEvent::kStationConnect" );
506
505
wfx_rsi.dev_state .Set (WifiInterface::WifiState::kStationConnected );
507
- ResetDHCPNotificationFlags ();
506
+ ResetConnectivityNotificationFlags ();
508
507
break ;
509
508
510
509
case WiseconnectWifiInterface::WifiPlatformEvent::kStationDisconnect : {
@@ -513,11 +512,10 @@ void WifiInterfaceImpl::ProcessEvent(WiseconnectWifiInterface::WifiPlatformEvent
513
512
514
513
wfx_rsi.dev_state .Clear (WifiInterface::WifiState::kStationReady )
515
514
.Clear (WifiInterface::WifiState::kStationConnecting )
516
- .Clear (WifiInterface::WifiState::kStationConnected )
517
- .Clear (WifiInterface::WifiState::kStationDhcpDone );
515
+ .Clear (WifiInterface::WifiState::kStationConnected );
518
516
519
517
// TODO: Implement disconnect notify
520
- ResetDHCPNotificationFlags ();
518
+ ResetConnectivityNotificationFlags ();
521
519
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
522
520
NotifyIPv4Change (false );
523
521
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
@@ -595,61 +593,29 @@ void WifiInterfaceImpl::ProcessEvent(WiseconnectWifiInterface::WifiPlatformEvent
595
593
JoinWifiNetwork ();
596
594
break ;
597
595
598
- case WiseconnectWifiInterface::WifiPlatformEvent::kStationDoDhcp :
599
- ChipLogDetail (DeviceLayer, " WifiPlatformEvent::kStationDoDhcp" );
600
- StartDHCPTimer (kDhcpPollIntervalMs );
601
- break ;
602
-
603
- case WiseconnectWifiInterface::WifiPlatformEvent::kStationDhcpDone :
604
- ChipLogDetail (DeviceLayer, " WifiPlatformEvent::kStationDhcpDone" );
605
- CancelDHCPTimer ();
606
- break ;
607
-
608
- case WiseconnectWifiInterface::WifiPlatformEvent::kStationDhcpPoll :
609
- ChipLogDetail (DeviceLayer, " WifiPlatformEvent::kStationDhcpPoll" );
610
- HandleDHCPPolling ();
611
- break ;
596
+ case WiseconnectWifiInterface::WifiPlatformEvent::kConnectionComplete :
597
+ ChipLogDetail (DeviceLayer, " WifiPlatformEvent::kConnectionComplete" );
598
+ NotifySuccessfulConnection ();
612
599
613
600
default :
614
601
break ;
615
602
}
616
603
}
617
604
618
- void WifiInterfaceImpl::HandleDHCPPolling (void )
605
+ void WifiInterfaceImpl::NotifySuccessfulConnection (void )
619
606
{
620
- WiseconnectWifiInterface::WifiPlatformEvent event;
621
-
622
- // TODO: Notify the application that the interface is not set up or Chipdie here because we are in an unkonwn state
623
607
struct netif * sta_netif = &wifi_client_context.netif ;
624
- VerifyOrReturn (sta_netif != nullptr , ChipLogError (DeviceLayer, " HandleDHCPPolling : failed to get STA netif" ));
608
+ VerifyOrReturn (sta_netif != nullptr , ChipLogError (DeviceLayer, " NotifySuccessfulConnection : failed to get STA netif" ));
625
609
626
610
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
627
- uint8_t dhcp_state = dhcpclient_poll (sta_netif);
628
- if (dhcp_state == DHCP_ADDRESS_ASSIGNED && !mHasNotifiedIPv4 )
629
- {
630
- GotIPv4Address ((uint32_t ) sta_netif->ip_addr .u_addr .ip4 .addr );
631
- event = WiseconnectWifiInterface::WifiPlatformEvent::kStationDhcpDone ;
632
- WiseconnectWifiInterface::PostWifiPlatformEvent (event);
633
- NotifyConnectivity ();
634
- }
635
- else if (dhcp_state == DHCP_OFF)
636
- {
637
- NotifyIPv4Change (false );
638
- }
611
+ GotIPv4Address ((uint32_t ) sta_netif->ip_addr .u_addr .ip4 .addr );
639
612
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
640
- /* Checks if the assigned IPv6 address is preferred by evaluating
641
- * the first block of IPv6 address ( block 0)
642
- */
643
- if ((ip6_addr_ispreferred (netif_ip6_addr_state (sta_netif, 0 ))) && !mHasNotifiedIPv6 )
644
- {
645
- char addrStr[chip::Inet::IPAddress::kMaxStringLength ] = { 0 };
646
- VerifyOrReturn (ip6addr_ntoa_r (netif_ip6_addr (sta_netif, 0 ), addrStr, sizeof (addrStr)) != nullptr );
647
- ChipLogProgress (DeviceLayer, " SLAAC OK: linklocal addr: %s" , addrStr);
648
- NotifyIPv6Change (true );
649
- event = WiseconnectWifiInterface::WifiPlatformEvent::kStationDhcpDone ;
650
- PostWifiPlatformEvent (event);
651
- NotifyConnectivity ();
652
- }
613
+
614
+ char addrStr[chip::Inet::IPAddress::kMaxStringLength ] = { 0 };
615
+ VerifyOrReturn (ip6addr_ntoa_r (netif_ip6_addr (sta_netif, 0 ), addrStr, sizeof (addrStr)) != nullptr );
616
+ ChipLogProgress (DeviceLayer, " SLAAC OK: linklocal addr: %s" , addrStr);
617
+ NotifyIPv6Change (true );
618
+ NotifyConnectivity ();
653
619
}
654
620
655
621
sl_status_t WifiInterfaceImpl::JoinWifiNetwork (void )
0 commit comments