How do I determine how many clients are associated to the softAP?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
1 Reply
Anonymous
Not applicable
We will add an API for this in the next SDK release.

Until then, you can add the API manually as follows:

Add the following API function prototype to <WICED-SDK-2.2.1>/Wiced/WWD/include/wwd_wifi.h

/** Gets information about associated clients.

*

* @note Only applicable if softAP interface is up

*

* @param[out] pointer to a buffer that will be populated with a variable length structure defined by @ref wiced_maclist_t

* @param[in]  length of the buffer

*

* @return @ref wiced_result_t

*/

extern wiced_result_t wiced_wifi_get_associated_client_list( void* client_list_buffer, uint16_t buffer_length );

Add the following API call to <WICED-SDK-2.2.1>/Wiced/WWD/internal/wwd_wifi.c

wiced_result_t wiced_wifi_get_associated_client_list( void* client_list_buffer, uint16_t buffer_length )

{

    wiced_buffer_t buffer;

    wiced_buffer_t response;

    uint32_t* data = (uint32_t*) wiced_get_ioctl_buffer( &buffer, buffer_length );

    CHECK_IOCTL_BUFFER( data );

    if ( wiced_send_ioctl( SDPCM_GET, WLC_GET_ASSOCLIST, buffer, &response, SDPCM_STA_INTERFACE ) == WICED_SUCCESS )

    {

        memcpy( client_list_buffer, (void*) host_buffer_get_current_piece_data_pointer( response ), (size_t)MIN(host_buffer_get_current_piece_size(response), buffer_length) );

        host_buffer_release( response, WICED_NETWORK_RX );

        return WICED_SUCCESS;

    }

    return WICED_ERROR;

}

FYI, the wiced_maclist_t structure looks like this ...

/**

* Structure describing a list of associated softAP clients

*/

typedef struct

{

uint32_t    count;         /**< Number of MAC addresses in the list    */

wiced_mac_t mac_list[1];   /**< Variable length array of MAC addresses */

} wiced_maclist_t;

0 Likes