WifiConfig_GetNetworkIdByConfigName Function

Header: #include <applibs/wificonfig.h>

Gets the network ID for the network configuration with the given name. Use WifiConfig_SetConfigName to assign the network name. The network ID may change as network configurations are added and removed, so apps should get the network ID again before changing a stored network configuration.

int WifiConfig_GetNetworkIdByConfigName(const char *configName);

Parameters

  • configName A pointer to the name of the network configuration. This name was set using WifiConfig_SetConfigName. The string must be NULL terminated and be less than or equal to WIFICONFIG_CONFIG_NAME_MAX_LENGTH bytes (excluding the termination).

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.

  • EFAULT: the configName parameter is NULL.

  • ERANGE: the configName parameter is greater than WIFICONFIG_SSID_MAX_LENGTH.

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

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

  • ENODEV: the specified network configuration cannot be found.

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 network ID of the specified network (non-negative value), or -1 for failure, in which case errno is set to the error value. The network ID is passed to the WifiConfig_Setxxx functions as the identifier for the network to be configured.

Application manifest requirements

The application manifest must include the WifiConfig capability.