[Gambas-user] Calling dbus method:how do I handle return values

Benoît Minisini gambas at ...1...
Tue Jun 12 21:02:36 CEST 2012


Le 10/06/2012 03:20, RICHARD WALKER a écrit :
> I am trying to call a DBus method which takes one parameter and
> returns many. The method details are: <method name="GetGraph"> <arg
> name="known_graph_version" type="t" direction="in" /> <arg
> name="current_graph_version" type="t" direction="out" /> <arg
> name="clients_and_ports" type="a(tsa(tsuu))" direction="out" /> <arg
> name="connections" type="a(tstststst)" direction="out" /> </method>
>
> If I use this: Dim graph_details As New Variant[]

The 'New' is useless. Jack.GetGraph() will create a new Variant[] an
return it.

>
> If 0<  CurrentGraph Then graph_details = Jack.GetGraph(CurrentGraph)
>
> ...then graph_details[0] will return the numeric id for the graph
> (for example, 223)
>
>
> I don't seem to be able to guess what sort of variable to use for
> assigning graph_details[1] and [2]. Stepping through the code it
> seems to suggest that graph_details[1] is a Variant[][]. Same for
> graph_details[2], but as I am completely and unredeemably confused
> by array declaration syntax I am no closer to capturing these items.

a -> array of
(...) -> Variant[]

So you will get for "client_and_ports" (graph_details[1]) a Variant[].
Each element of that array will be another Variant[] with three 
elements. The first one is a Long, the second one a string, and the 
third one an array of Variant[], each one being another Variant[] with 
four elements: a Long, a String, and two Integers.

For "connections" (graph_details[2]) you will get an array of Variant[], 
each one being another Variant[] with 9 elements: Long, String, Long, 
String, Long, String, Long, String and Long.

Regards,

-- 
Benoît Minisini




More information about the User mailing list