Networking_SetInterfaceState Function

Header: #include <applibs/networking.h>

Enables or disables a network interface.

int Networking_SetInterfaceState(const char *networkInterfaceName, bool isEnabled);

Parameters

  • networkInterfaceName The name of the network interface to update.

  • isEnabled true to enable the interface, false to disable it.

Errors

Returns -1 if an error is encountered and sets errno to the error value.

  • EACCES: the application manifest does not include the NetworkConfig capability.

  • ENOENT: the network interface does not exist.

  • EPERM: this function is not allowed on the interface.

  • EAGAIN: the networking stack isn't ready yet.

  • EIO: the interface is inaccessible.

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 NetworkConfig capability.

Concepts and samples

Note

If Wi-Fi is disabled through Networking_SetInterfaceState the Wi-Fi subsystem will be in "light sleep" mode. This should also shut down RF emissions. However, if you are required to limit emissions due to compliance or certifications, please ensure you test and perform your own measurements.

In designs where Wi-Fi is not required, the RF front-end components can be excluded from the hardware design. For more information, see Disable Wi-Fi RF front end on MT3620.