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

2019-06-10 Thread Mantas Mikul─Śnas
On Fri, Jun 7, 2019 at 9:08 PM Salman Ahmed  wrote:

> 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
> ")dict
> entry(   string "Index"   variant
> int32 0)dict entry(   string "Domain"
>  variant   string "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",
>,
>,  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?
>

Use sd_bus_message_enter_container() first. Here's a very similar example:

https://github.com/systemd/systemd/blob/master/src/core/dbus-manager.c#L802


-- 
Mantas Mikul─Śnas
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

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

2019-06-07 Thread Salman Ahmed
Some issue with formatting.I copy message again here
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"
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"
)
dict entry(
   string "Index"
   variant   int32 0
)
dict entry(
   string "Domain"
   variant   string "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",
   ,
   ,  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

On Fri, Jun 7, 2019 at 8:07 PM Salman Ahmed  wrote:

> 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
> ")dict
> entry(   string "Index"   variant
> int32 0)dict entry(   string "Domain"
>  variant   string "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",
>  

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

2019-06-07 Thread Salman Ahmed
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
")dict
entry(   string "Index"   variant
int32 0)dict entry(   string "Domain"
 variant   string "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",
   ,
   ,  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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel