[systemd-devel] sd-bus read message with ConnMan

Salman Ahmed salman.isd at gmail.com
Fri Jun 7 18:07:49 UTC 2019


Hello,

I am trying to communicate with connman using sdbus from my application.
Basically I want to replicate the following cmd line procedure to get
values for "object path" and string "Host" (underlined below)
I do
*dbus-send --system              --dest=net.connman.vpn
--type=method_call            --print-reply                 /
 net.connman.vpn.Manager.GetConnections*

and I get

















































*   array [      struct {         object path
"/net/connman/vpn/connection/uk_london_privateinternetaccess_com_privateinternetaccess_com"
       array [            dict entry(               string "State"
     variant                   string "idle"            )            dict
entry(               string "Type"               variant
string "openvpn"            )            dict entry(               string
"Name"               variant                   string "PIA VPN"
)            dict entry(               string "Host"               variant
                  string "uk-london.privateinternetaccess.com
<http://uk-london.privateinternetaccess.com>"            )            dict
entry(               string "Index"               variant
int32 0            )            dict entry(               string "Domain"
             variant                   string "privateinternetaccess.com
<http://privateinternetaccess.com>"            )            dict entry(
           string "Immutable"               variant
boolean true            )            dict entry(               string
"Nameservers"               variant                   array [
    ]            )            dict entry(               string
"UserRoutes"               variant                   array [
  ]            )            dict entry(               string
"ServerRoutes"               variant                   array [
    ]            )         ]      }   ]*


In my application I am doing
       r = sd_bus_call_method( bus,
                                           "net.connman.vpn",
                                           "/",
                                           "net.connman.vpn.Manager",
                                           "GetConnections",
                                           &error,
                                           &m,  NULL, NULL);

Which succeeds.
Afterwards I want to do  sd_bus_message_read(m, "a(oa{sv})") but I have no
idea what kind of arguments should I pass in what order to get object path
and host string. I think I got the a(oa{sv}) part right?

Any help would be much appreciated

Salman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190607/40eed518/attachment.html>


More information about the systemd-devel mailing list