I am using these libraries at the moment to list available networks:
#include <glib.h>
#include <NetworkManager.h>
(which works fine by the way)
Now my question is, how do I connect to a specific network from my C program? I can't seem to find any good documentation or examples for it.
What I did find was this: https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/C/glib/add-connection-libnm.c
But it does not suggest a way to actually connect to the added network. And also, if it matters; this code will be running on a Linux machine without a display so I'm not looking for anything that requires a graphical application.
Any ideas?
Thanks
You can use the following API
void
nm_client_activate_connection (NMClient *client,
NMConnection *connection,
NMDevice *device,
const char *specific_object,
NMClientActivateFn callback,
gpointer user_data);
details of each input parameters are described here
https://developer.gnome.org/libnm-glib/stable/NMClient.html#nm-client-activate-connection