WifiConfig_SetTargetedScanEnabled Function

Header: #include <applibs/wificonfig.h>

Enables or disables targeted scanning for a network. Targeted scanning is disabled by default.

Targeted scanning is used to connect to access points that aren't broadcasting their SSID, or are in a noisy environment.

The setting is effective immediately but won't persist across device reboots unless the WifiConfig_PersistConfig function is called after this function.

Important

Targeted scanning causes the device to transmit probe requests that may reveal the SSID of the network to other devices. This should only be used in controlled environments, or on networks where this an acceptable risk.

static int WifiConfig_SetTargetedScanEnabled(int networkId, bool enabled);

Parameters

  • networkId The ID of the network you want to configure. Use WifiConfig_AddNetwork to return the network ID of a newly created network. The network ID is passed to WifiConfig_Set* functions for configuration. Use WifiConfig_SetSSID to specify the SSID to target for the scan.

  • enabled true to enable targeted scanning on the network; otherwise, false.

Errors

Returns -1 if an error is encountered and sets errno to the error value.

  • EACCES: the application manifest doesn't include the WifiConfig capability.

  • EAGAIN: the Wi-Fi device isn't ready.

  • ENETDOWN: the Wi-Fi network interface is unavailable.

  • EINVAL: the networkId parameter is invalid.

  • ENODEV: the networkId parameter doesn't match any of the stored networks.

Any other errno may also be specified; such errors aren't deterministic and the same behavior might not be retained through system updates.

Return value

Returns 0 for success, or -1 for failure, in which case errno is set to the error value.

Application manifest requirements

The application manifest must include the WifiConfig capability.