Skip to content

Commit

Permalink
Updates the setup AP API to be able to update just the security type.
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsracz committed Aug 19, 2024
1 parent 80220e3 commit 2a46897
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
21 changes: 11 additions & 10 deletions src/freertos_drivers/net_cc32xx/CC32xxWiFi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -805,18 +805,18 @@ void CC32xxWiFi::wlan_wps_pbc_initiate()
void CC32xxWiFi::wlan_setup_ap(const char *ssid, const char *security_key,
SecurityType security_type)
{
HASSERT(strlen(ssid) <= 32);
HASSERT(strlen(security_key) <= 64);

uint8_t sec_type = security_type_to_simplelink(security_type);

sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_SSID, strlen(ssid),
(uint8_t*)ssid);
if (wlanRole == WlanRole::AP)
if (ssid)
{
str_populate(this->ssid, ssid);
HASSERT(strlen(ssid) <= 32);
sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_SSID, strlen(ssid),
(uint8_t *)ssid);
if (wlanRole == WlanRole::AP)
{
str_populate(this->ssid, ssid);
}
}


uint8_t sec_type = security_type_to_simplelink(security_type);
sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_SECURITY_TYPE, 1,
(uint8_t*)&sec_type);

Expand All @@ -826,6 +826,7 @@ void CC32xxWiFi::wlan_setup_ap(const char *ssid, const char *security_key,
return;
}

HASSERT(strlen(security_key) <= 64);
sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_PASSWORD,
strlen(security_key), (uint8_t*)security_key);
}
Expand Down
10 changes: 6 additions & 4 deletions src/freertos_drivers/net_cc32xx/CC32xxWiFi.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ protected:
{
}

/** Setup access point role credentials.
* @param ssid access point ssid
* @param security_key access point security key
* @param security_type specifies security type
/** Setup access point role credentials. It is OK to leave ssid as nullptr
* or password as nullptr, in which case those properties will not be
* changed.
* @param ssid access point ssid (name)
* @param security_key access point security key (password)
* @param security_type specifies security type. Required.
*/
virtual void wlan_setup_ap(const char *ssid, const char *security_key,
SecurityType security_type) = 0;
Expand Down

0 comments on commit 2a46897

Please sign in to comment.