-
-
Save tranthamp/2721326 to your computer and use it in GitHub Desktop.
# Connman Technology API examples: (Object Path: /net/connman/technology/<wifi/ethernet>, Interface: net.connman.Technology) | |
# GetProperties | |
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/wifi net.connman.Technology.GetProperties | |
# Scan | |
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/wifi net.connman.Technology.Scan | |
# Disable/Enable wifi | |
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/wifi net.connman.Technology.SetProperty string:Powered variant:boolean:true | |
# Disable/Enable ethernet | |
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/ethernet net.connman.Technology.SetProperty string:Powered variant:boolean:true | |
# Connman Manager API examples: (Object Path: /, Interface: net.connman.Manager) | |
dbus-send --system --dest=net.connman --print-reply / net.connman.Manager.GetProperties | |
dbus-send --system --dest=net.connman --print-reply / net.connman.Manager.GetTechnologies | |
dbus-send --system --dest=net.connman --print-reply / net.connman.Manager.GetServices | |
# See: http://git.kernel.org/?p=network/connman/connman.git;a=tree;f=doc;hb=HEAD |
Hello,
I found the answer myself. In fact, when the dictionary has variant values, it must be specified explicitly by passing through the dbus.Dictionary object, my above command becomes:
data = { "Method": "manual", "Address": "X.X.X.X", "Netmask": "X.X.X.X", "Gateway": "X.X.X.X" } net_service.SetProperty('IPv4.Configuration', dbus.Dictionary(data, signature='sv'))
Here is example using gdbus-codegen api
ConnmanProxyService *sproxy;
GError *error;
const gchar *opt = "IPv4.Configuration";
error = NULL;
sproxy = connman_proxy_service_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE,
"net.connman", "/net/connman/service/ethernet_bcaec5b96673_cable", NULL, &error);
GVariantBuilder *b;
GVariant *dict;
b = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (b, "{sv}", "Method", g_variant_new_string ("manual"));
g_variant_builder_add (b, "{sv}", "Address", g_variant_new_string ("192.168.0.111"));
g_variant_builder_add (b, "{sv}", "Netmask", g_variant_new_string ("255.255.255.0"));
dict = g_variant_builder_end (b);
connman_proxy_service_call_set_property_sync(sproxy, opt, g_variant_new("v", dict), NULL, &error);
Hi @pridybailo-n
Thanks for the example. I am planing to write a c based proxy library to communicate with connman manager. Basically i want to use c library instead of connmanctl commandline.
Do you have any sample how did you create xml file or generated gdbus-codegen api
Thanks
Can anyone help with a dbus connman example to connect without using an agent to a protected wif-fi with password?
Is it possible without an agent?
Qt 5.15 for Device Creation has a QNetworkSettingsUserAgent which I understand uses dbus internally. I cannot get QNetworkSettingsUserAgent to work. I was hoping the dbus connman API could send password without using using an agent?
My work-around has been to programmatically create:
File: /var/lib/connman/SSID-psk.config
[service_wifi_d4ca6e60d8d5_626164626565_managed_psk]
AutoConnect=true
Name=mywif
Passphrase=mySecretPassphrase
Type=wifi
Hello,
Thanks for this indications.
Do you know how to modify IP configuration manually using the library dbus-python? By reading the docs, i have seen that the IPv4.Configuration dictionary needs to be changed by passing it the same values as the IPv4 dictionary, but when i tried to do changes, i got "net.connman.Error.InvalidArguments: Invalid arguments". This is an example of request i'm trying to do:
net_service.SetProperty('IPv4.Configuration', { "Method": "manual", "Address": "X.X.X.X", "Netmask": "X.X.X.X", "Gateway": "X.X.X.X" })