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

Restricting Number Of Soft AP Clients

Restricting Number Of Soft AP Clients

SeyhanA_31
Employee
Employee
100 likes received 50 likes received 25 likes received

Restricting Number Of Soft AP Clients

WICED WiFi modules can be setup to restrict the number of clients that can join the WICED Soft AP mode device.

If the number of clients to join the WICED Soft AP device is set to 1, one client is allowed to join at a time. Once the joined device is disconnected from the AP the next device is allowed to join.


Copy the following code anywhere in …/WICED/WWD/internal/wwd_wifi.c

wwd_result_t wwd_wifi_set_max_associations( uint32_t max_assoc ) {

    wiced_buffer_t buffer;

    uint32_t* data = (uint32_t*) wwd_sdpcm_get_iovar_buffer( &buffer, (uint16_t) 4,IOVAR_STR_MAX_ASSOC );

    CHECK_IOCTL_BUFFER( data );

    *data = max_assoc;

    RETURN_WITH_ASSERT( wwd_sdpcm_send_iovar( SDPCM_SET, buffer, NULL, WWD_STA_INTERFACE ));

}

Copy the following code anywhere in …/WICED/WWD/include/wwd_wifi.h

/** Set the maximum number of associations in STA mode.

*  Defined only on STA interface

*

* @param noise : number of allowed accociations

*

* @return  WWD_SUCCESS : if success

*          Error code   : if Link quality was not enabled or not successful

*/

extern wwd_result_t wwd_wifi_set_max_associations( uint32_t max_assoc );


Add wwd_wifi_set_max_associations(…) after setting the WICED network.


For example …/apps/snip/apsta application could be updated by adding wwd_wifi_set_max_associations(…) after wiced_network_up(…).


/* Bring up the STA (client) interface ------------------------------------------------------- */

wiced_network_up(WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL);

/* Restrict number of Soft AP clients */

wwd_wifi_set_max_associations(1);




704 Views
Contributors