Re: libnm

On Fri, 2019-02-15 at 12:32 +0200, Kalev Toots wrote:

I try to connect 3G GSM modem to network using Network Manager,libnm
and C/C++ code.
I cannot find any C/C++ example code which connects prepared NM
to network
and waits until connection is up or error or timeout. Can anybody
me to such
piece of code.



NetworkManager is profile based, that means in one step you create the
profile to your liking, then you just call
nm_client_activate_connection_async(). This returns you a D-Bus path to
the NMActiveConnection (which represents the activation and ties the
profile (NMRemoteConnection) to the device (NMDevice).

See for example,

The complicated part is waiting until the profile is fully activated:

Another example is the ansible-role (Which is Python with libnm via GObject introspection):
This is a rather unconventional example, because it manually iterates the
glib mainloop. If you are unclear how to use the glib mainloop, then this might
*not* be the example to look at.


Attachment: signature.asc
Description: This is a digitally signed message part

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]