@@ -377,16 +377,22 @@ sl_status_t SetWifiConfigurations()
377377 // Setting the listen interval to 0 which will set it to DTIM interval
378378 sl_wifi_listen_interval_t sleep_interval = { .listen_interval = 0 };
379379 status = sl_wifi_set_listen_interval (SL_WIFI_CLIENT_INTERFACE, sleep_interval);
380- VerifyOrReturnError (status == SL_STATUS_OK, status);
380+ VerifyOrReturnError (status == SL_STATUS_OK, status,
381+ ChipLogError (DeviceLayer, " sl_wifi_set_listen_interval failed: 0x%lx" , status));
381382
382383 sl_wifi_advanced_client_configuration_t client_config = { .max_retry_attempts = 5 };
383384 status = sl_wifi_set_advanced_client_configuration (SL_WIFI_CLIENT_INTERFACE, &client_config);
384- VerifyOrReturnError (status == SL_STATUS_OK, status);
385+ VerifyOrReturnError (status == SL_STATUS_OK, status,
386+ ChipLogError (DeviceLayer, " sl_wifi_set_advanced_client_configuration failed: 0x%lx" , status));
385387#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
386388
387- status = sl_net_set_credential (SL_NET_DEFAULT_WIFI_CLIENT_CREDENTIAL_ID, SL_NET_WIFI_PSK, &wfx_rsi.sec .passkey [0 ],
388- wfx_rsi.sec .passkey_length );
389- VerifyOrReturnError (status == SL_STATUS_OK, status);
389+ if (wfx_rsi.sec .passkey_length != 0 )
390+ {
391+ status = sl_net_set_credential (SL_NET_DEFAULT_WIFI_CLIENT_CREDENTIAL_ID, SL_NET_WIFI_PSK, &wfx_rsi.sec .passkey [0 ],
392+ wfx_rsi.sec .passkey_length );
393+ VerifyOrReturnError (status == SL_STATUS_OK, status,
394+ ChipLogError (DeviceLayer, " sl_net_set_credential failed: 0x%lx" , status));
395+ }
390396
391397 sl_net_wifi_client_profile_t profile = {
392398 .config = {
@@ -402,7 +408,7 @@ sl_status_t SetWifiConfigurations()
402408 .bssid = {{0 }},
403409 .bss_type = SL_WIFI_BSS_TYPE_INFRASTRUCTURE,
404410 .security = security,
405- .encryption = SL_WIFI_NO_ENCRYPTION ,
411+ .encryption = SL_WIFI_DEFAULT_ENCRYPTION ,
406412 .client_options = SL_WIFI_JOIN_WITH_SCAN,
407413 .credential_id = SL_NET_DEFAULT_WIFI_CLIENT_CREDENTIAL_ID,
408414 },
@@ -417,7 +423,7 @@ sl_status_t SetWifiConfigurations()
417423 memcpy ((char *) &profile.config .ssid .value , wfx_rsi.sec .ssid , wfx_rsi.sec .ssid_length );
418424
419425 status = sl_net_set_profile ((sl_net_interface_t ) SL_NET_WIFI_CLIENT_INTERFACE, SL_NET_DEFAULT_WIFI_CLIENT_PROFILE_ID, &profile);
420- VerifyOrReturnError (status == SL_STATUS_OK, status, ChipLogError (DeviceLayer, " sl_net_set_profile Failed " ));
426+ VerifyOrReturnError (status == SL_STATUS_OK, status, ChipLogError (DeviceLayer, " sl_net_set_profile failed: 0x%lx " , status ));
421427
422428 return status;
423429}
0 commit comments