API Reference Manual  r8267
Access point functions

Functions

int wlp_set_mode (uint8_t mode)
 Set the Wi-Fi mode to AP or STA.
int wlp_get_mode (uint8_t *mode)
 Check if the device is currently in AP or STA mode.
int wlp_set_channel (uint8_t channel, void(*channel_cb)(void *ctx, int status), void *ctx)
 Set the channel. Only supported when mode is WLP_MODE_AP.
int wlp_conf_ap (int hidden, int beacon_intvl, int inact_tmo, const char *country)
 Configure parameters for access point mode.

Detailed Description

These functions manage the access point mode.


Function Documentation

int wlp_conf_ap ( int  hidden,
int  beacon_intvl,
int  inact_tmo,
const char *  country 
)

Configure parameters for access point mode.

Configure the parameters that will be used when the device is in access point mode, WLP_MODE_AP.

Parameters:
hiddencan be set to non-zero in order to configure the device with hidden SSID. This means that the device will not broadcast its SSID, but it will still respond to clients that already knows the SSID.
beacon_intvlspecifies interval in which beacons are transmitted by the device. This parameter does not have any effect if hidden is 0
inact_tmospecifies the idle time in minutes before the device will disconnect an inactive client.
countryspecifies the region that should be advertised by the device. Will not be changed if NULL.
Returns:
  • 0 on success
  • A negative error code on failure
int wlp_get_mode ( uint8_t *  mode)

Check if the device is currently in AP or STA mode.

wlp_get_mode() will be return the current operation mode of the Wi-Fi device. Since the operation mode is persistent between power-cycles, it is generally a good idea to call this function at startup to ensure the desired operation mode.

Parameters:
modewill hold the current mode upon successful return. This will be either WLP_MODE_STA or WLP_MODE_AP.
Returns:
  • 0 on success
int wlp_set_channel ( uint8_t  channel,
void(*)(void *ctx, int status)  channel_cb,
void *  ctx 
)

Set the channel. Only supported when mode is WLP_MODE_AP.

This function is only supported when wlp_get_mode() returns WLP_MODE_AP. wlp_set_channel() must be called before wlp_linkup() to have effect.

Parameters:
channelis the new channel (1-13).
channel_cbCallback that will be invoked when the channel has be changed successfully. Status will be 0 on success.
ctxis an opaque context pointer that will be passed back to channel_cb.
Returns:
  • 0 on success
  • WLP_ERR_PARAM if invalid channel
  • WLP_ERR_STATE the operation can not be carried out (e.g. ap already started).
  • WLP_ERR_NOTSUPP if operation is not supported
int wlp_set_mode ( uint8_t  mode)

Set the Wi-Fi mode to AP or STA.

wlp_set_mode() will configure the Wi-Fi device to operate either as a station or as an access point. The current mode can be obtained through wlp_get_mode().

Parameters:
modeis the mode to configure. This must be either WLP_MODE_STA, WLP_MODE_ADHOC or WLP_MODE_AP.
Returns:
  • 0 on success