Skip to content

Commit

Permalink
Adds an accessor to fetch the number of connected stations.
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsracz committed Oct 17, 2020
1 parent 594910d commit b517d7d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/freertos_drivers/net_cc32xx/CC32xxWiFi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,22 @@ void CC32xxWiFi::wlan_get_ap_config(string *ssid, SecurityType *security_type)
}
}

int CC32xxWiFi::wlan_get_ap_station_count()
{
if (wlanRole != WlanRole::AP)
{
return 0;
}
uint8_t num_connected = 0;
uint16_t len = sizeof(num_connected);
auto status = sl_NetCfgGet(
SL_NETCFG_AP_STATIONS_NUM_CONNECTED, NULL, &len, &num_connected);
if (status)
{
return -1;
}
return num_connected;
}

void CC32xxWiFi::connecting_update_blinker()
{
Expand Down
6 changes: 6 additions & 0 deletions src/freertos_drivers/net_cc32xx/CC32xxWiFi.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ public:
*/
void wlan_get_ap_config(string *ssid, SecurityType *security_type);

/** Retrieves how many stations are connected to the wifi in AP mode.
* @return number of connected stations (0 to 4). If not in AP mode,
* returns 0.
*/
int wlan_get_ap_station_count();

/** @return true if the wlan interface is ready to establish outgoing
* connections. */
bool wlan_ready()
Expand Down

0 comments on commit b517d7d

Please sign in to comment.