Accessing Network settings from Application


We use Colibri iMX6 with Linux OS. We would like to control the dhcp setting, setting static IP, etc . I read about Connman which allows you to control all the network related elements from the command line but we would like to do it from our application.

How can we change all the network related setting from the application ?



Technically you can not change connmand settings from the command line.

The tool connmanctr allows to do that by useing connmand’s dbus interface. So you could use dbus in your application to do so too.

The doc folder contains descriptions on the dbus API. The connmanctr sources in the client folder could also give some ideas on how to use the API.

Alternatively you could use the syscall() function from unistd.h to make use of connmanctr from within your application.

Alternatively you could stop connmand, edit the relevant configuration file(s) in /var/lib/connman/ to you needs and restart connmand.