WifiConfig_AddDuplicateNetwork Function
Header: #include <applibs/wificonfig.h>
Adds a new network that is a duplicate of the specified network with the specified ID. The new network is assigned the specified name and is disabled by default.
int WifiConfig_AddDuplicateNetwork(int networkId, const char *configName);
Parameters
networkId
The ID of the network to duplicate. WifiConfig_AddNetwork returns the network ID.configName
A pointer to a byte array that contains the configuration name. The array must be NULL terminated and at most WIFICONFIG_CONFIG_NAME_MAX_LENGTH bytes, excluding the termination character.
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.
EAGAIN: the Wi-Fi device isn't ready.
EEXIST: the
configName
is not unique.EFAULT: the
configName
is NULL.EINVAL: the
networkId
is invalid.ENETDOWN: the Wi-Fi network interface is unavailable.
ENODEV: the
networkId
does not match any of the stored networks.ENOMEM: there is not enough memory to add a new network.
ERANGE: the
configName
has less than one character or more than WIFICONFIG_CONFIG_NAME_MAX_LENGTH characters.
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 ID of the new network, or -1 for failure, in which case errno
is set to the error value. The network ID is zero or a positive value.
Remarks
The new network isn't configured and can be configured with the WifiConfig_Set* functions. Changes to the network configuration are effective immediately but are lost when the device reboots unless the WifiConfig_PersistConfig function is called to save the configuration to nonvolatile storage.
The number of networks you can store on a device is not fixed, but depends on the available resources and the amount of storage required for each network configuration.
Application manifest requirements
The application manifest must include the WifiConfig capability.