Del via


WifiConfig_GetScannedNetworks Function

Header: #include <applibs/wificonfig.h>

Gets the Wi-Fi networks found by the last scan operation. This function is not thread safe.

  • If scannedNetworkArray is too small to hold all the networks, this function fills all the elements and returns the number of array elements.

  • If the WiFiConfig capability is not present, the function returns an empty array.

ssize_t WifiConfig_GetScannedNetworks(WifiConfig_ScannedNetwork * scannedNetworkArray, size_t scannedNetworkArrayCount);

Parameters

  • scannedNetworkArray A pointer to an array that returns the retrieved Wi-Fi networks.

  • scannedNetworkArrayCount The number of elements scannedNetworkArray can hold. The array should have one element for each Wi-Fi network found by the last scan operation.

Errors

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

  • EACCES: the application manifest does not include the WifiConfig capability.

  • EFAULT: the scannedNetworkArray parameter is NULL.

  • ERANGE: the scannedNetworkArrayCount parameter is 0.

  • EINVAL: the scannedNetworkArray parameter or its struct version is invalid.

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

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 the number of WifiConfig_ScannedNetwork elements returned by scannedNetworkArray, 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.