<font size=2 face="sans-serif">Dears</font>
<br>
<br><font size=2 face="sans-serif">I made a sample program to call methods
published by bluez. Here is the api description.</font>
<br>
<br><font size=2 face="sans-serif">object CreateApplication(dict
config)</font>
<br>
<br><font size=2 face="sans-serif">
Returns the path of the new registered application.</font>
<br>
<br><font size=2 face="sans-serif">
Dict is defined as bellow:</font>
<br><font size=2 face="sans-serif">
{</font>
<br><font size=2 face="sans-serif">
"DataType":
uint16, (mandatory)</font>
<br><font size=2 face="sans-serif">
"Role"
: ("Source" or "Sink"), (mandatory)</font>
<br><font size=2 face="sans-serif">
"Description"
: string, (optional)</font>
<br><font size=2 face="sans-serif">
"ChannelType"
: ("Reliable" or "Streaming")</font>
<br><font size=2 face="sans-serif">
(just for Sources, optional)</font>
<br><font size=2 face="sans-serif">
}</font>
<br>
<br><font size=2 face="sans-serif">
Application will be closed by the call or
implicitly when the</font>
<br><font size=2 face="sans-serif">
programs leaves the bus.</font>
<br>
<br><font size=2 face="sans-serif">
Possible errors: org.bluez.Error.InvalidArguments</font>
<br>
<br><font size=2 face="sans-serif">Now, I create a sample by using dbus-glib
as following, I get an error message.</font>
<br><font size=2 color=red face="Monospace">Caught remote method exception
org.bluez.Error.InvalidArguments: Invalid arguments in method call</font>
<br>
<br><font size=2 face="sans-serif">Maybe it's a problem about send a{sv}
data as parameters of method call. Is there any one help me to resolve
the problem?</font>
<br>
<br><font size=2 face="sans-serif">here is the code:</font>
<br>
<br><font size=2 color=#603181 face="Monospace"><b>dbus_g_proxy_call</b></font><font size=2 face="Monospace">(proxy,
</font><font size=2 color=#4200ff face="Monospace">"CreateApplication"</font><font size=2 face="Monospace">,
&err,</font>
<br><font size=2 face="Monospace">
get_hdp_properties_type(),
<b>create_hdp_properties</b>, G_TYPE_INVALID,</font>
<br><font size=2 face="Monospace">
G_TYPE_STRING, &app_path,
G_TYPE_INVALID)</font>
<br>
<br><font size=2 color=#00603c face="Monospace">GHashTable</font><font size=2 face="Monospace">
*<b>create_hdp_properties</b>()</font>
<br><font size=2 face="Monospace">{</font>
<br><font size=2 face="Monospace"> </font><font size=2 color=#00603c face="Monospace">GHashTable</font><font size=2 face="Monospace">
*hash;</font>
<br><font size=2 face="Monospace"> </font><font size=2 color=#00603c face="Monospace">GValue</font><font size=2 face="Monospace">
*val;</font>
<br><font size=2 face="Monospace"> </font><font size=2 color=#3f8080 face="Monospace">//GVariant
*val_data_type, *val_role;</font>
<br><font size=2 face="Monospace"> hash
= </font><font size=2 color=#603181 face="Monospace"><b>g_hash_table_new_full</b></font><font size=2 face="Monospace">(</font><font size=2 color=#603181 face="Monospace"><b>g_str_hash</b></font><font size=2 face="Monospace">,
NULL, NULL, release_val);</font>
<br>
<br><font size=2 face="Monospace"> val
= g_new0(</font><font size=2 color=#00603c face="Monospace">GValue</font><font size=2 face="Monospace">,
1);</font>
<br><font size=2 face="Monospace"> </font><font size=2 color=#603181 face="Monospace"><b>g_value_init</b></font><font size=2 face="Monospace">
(val, G_TYPE_UINT);</font>
<br><font size=2 face="Monospace"> </font><font size=2 color=#603181 face="Monospace"><b>g_value_set_uint</b></font><font size=2 face="Monospace">(val,
4100);</font>
<br><font size=2 face="Monospace"> </font><font size=2 color=#603181 face="Monospace"><b>g_hash_table_insert</b></font><font size=2 face="Monospace">(hash,
</font><font size=2 color=#4200ff face="Monospace">"DataType"</font><font size=2 face="Monospace">,
val);</font>
<br><font size=2 color=#3f8080 face="Monospace">/*</font>
<br><font size=2 color=#3f8080 face="Monospace">
val_data_type = g_variant_new_uint32(4100);</font>
<br><font size=2 color=#3f8080 face="Monospace">
g_hash_table_insert(hash, "DataType", val_data_type);</font>
<br><font size=2 color=#3f8080 face="Monospace">*/</font>
<br><font size=2 face="Monospace"> val
= g_new0(</font><font size=2 color=#00603c face="Monospace">GValue</font><font size=2 face="Monospace">,
1);</font>
<br><font size=2 face="Monospace"> </font><font size=2 color=#603181 face="Monospace"><b>g_value_init</b></font><font size=2 face="Monospace">(val,
G_TYPE_STRING);</font>
<br><font size=2 face="Monospace"> </font><font size=2 color=#603181 face="Monospace"><b>g_value_set_string</b></font><font size=2 face="Monospace">(val,
</font><font size=2 color=#4200ff face="Monospace">"Sink"</font><font size=2 face="Monospace">);</font>
<br><font size=2 face="Monospace"> </font><font size=2 color=#603181 face="Monospace"><b>g_hash_table_insert</b></font><font size=2 face="Monospace">(hash,
</font><font size=2 color=#4200ff face="Monospace">"Role"</font><font size=2 face="Monospace">,
val);</font>
<br><font size=2 face="Monospace"> </font><font size=2 color=#3f8080 face="Monospace">/*</font>
<br><font size=2 color=#3f8080 face="Monospace">
val_role = g_variant_new_string("Sink");</font>
<br><font size=2 color=#3f8080 face="Monospace">
g_hash_table_insert(hash, "Role", val_role);</font>
<br><font size=2 color=#3f8080 face="Monospace">
*/</font>
<br>
<br><font size=2 face="Monospace"> </font><font size=2 color=#820040 face="Monospace"><b>return</b></font><font size=2 face="Monospace">
hash;</font>
<br><font size=2 face="Monospace">}</font>
<br>
<br><font size=2 color=#00603c face="Monospace">GType</font><font size=2 face="Monospace">
<b>get_hdp_properties_type</b>()</font>
<br><font size=2 face="Monospace">{</font>
<br><font size=2 face="Monospace"> </font><font size=2 color=#820040 face="Monospace"><b>return</b></font><font size=2 face="Monospace">
</font><font size=2 color=#603181 face="Monospace"><b>dbus_g_type_get_map</b></font><font size=2 face="Monospace">(</font><font size=2 color=#4200ff face="Monospace">"GHashTable"</font><font size=2 face="Monospace">,
G_TYPE_STRING, G_TYPE_VALUE);</font>
<br><font size=2 face="Monospace">}</font>
<br>
<br>
<br><font size=2 face="sans-serif">Thanks &<br>
Best regards,<br>
<br>
Yihui,Fan (·¶Òæ»Ô)<br>
Associate IT Architect<br>
Healthcare Standards<br>
Emerging Technology Institute(ETI)<br>
IBM China Software Development Lab<br>
Tel: (8610) 82454982 | Fax: (8610) 82453600 <br>
Mobile: 86-13911564003| Email: yihuifan@cn.ibm.com<br>
Address: Tower B, Diamond Building, Zhongguancun Software Park, Haidian
District, Beijing 100193, P.R.China<br>
</font>