WifiConfig_ForgetNetworkById Function

Header: #include <applibs/wificonfig.h>

Removes a Wi-Fi network from the device. Disconnects the device from the network if it's currently connected.

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

int WifiConfig_ForgetNetworkById(int networkId);

Parameters

  • networkId The ID of the network to remove.

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.

  • EINVAL: the networkId parameter is invalid.

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

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

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

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.