WifiConfig_GetStoredNetworks Function

Header: #include <applibs/wificonfig.h>

Retrieves all stored Wi-Fi networks on the device. This function is not thread safe.

Note

Before you call WifiConfig_GetStoredNetworks, you must call WifiConfig_GetStoredNetworkCount and use the result as the array size for the WifiConfig_StoredNetwork array that is passed in as the storedNetworkArray parameter.

  • If storedNetworkArray is too small to hold all the stored Wi-Fi networks, this function fills the array and returns the number of array elements.

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

ssize_t WifiConfig_GetStoredNetworks(WifiConfig_StoredNetwork * storedNetworkArray, size_t storedNetworkArrayCount);

Parameters

  • storedNetworkArray A pointer to an array that returns the stored Wi-Fi networks.

  • storedNetworkArrayCount The number of elements storedNetworkArray can hold. The array should have one element for each stored Wi-Fi network.

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 storedNetworkArray parameter is NULL.

  • ERANGE: the storedNetworkArrayCount parameter is 0.

  • EINVAL: the storedNetworkArray 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 elements in the WifiConfig_StoredNetwork array, 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.