Kopīgot, izmantojot


WifiConfig_SetSSID Function

Header: #include <applibs/wificonfig.h>

Sets the SSID for a Wi-Fi network.

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

static int WifiConfig_SetSSID(int networkId, const uint8_t *ssid, size_t ssidLength);

Parameters

  • networkId The ID of the network to configure. WifiConfig_AddNetwork returns the network ID.

  • ssid A pointer to a byte array that contains the new SSID. The character encoding is not specified.

  • ssidLength The number of bytes in the ssid parameter. Must be less than or equal to WIFICONFIG_SSID_MAX_LENGTH.

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

  • ERANGE: the ssidLength parameter is greater than WIFICONFIG_SSID_MAX_LENGTH.

  • 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 IDs 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.