<HTML><HEAD>
<META http-equiv=Content-Type content='text/html; charset=utf-8'>
<title>Samsung Enterprise Portal mySingle</title>
<style> P, td, li {font-family:Arial, arial; font-size:9pt; margin-top:5px;margin-bottom:5px;} body{font-family:Arial, arial; font-size:9pt;}</style>
</HEAD><BODY>Hi,
<p>Actully as u know that when data traverse through DBUS it goes according
to the data types(g_value) define on the bus.</p>
<p>We also tried to pass one structure using DBUS directly in the past but stuck
due to the same problem actully in case of structure there are multiple g_value,but
we felt it has to be possible using <br>GValueArray but it also takes
same data type only we stopped it trying but i feel it is possible if we first
before sending do some conversion from struct ---> g_value.</p>
<p>Regards,</p>
<p>Deepesh</p>
<p> </p><p> </p><br><br>------- <b>Original Message</b> -------<br><b>Sender</b> : ravikumar.paluri<ravikumar.paluri@azingo.com><br><b>Date</b> : Jul 03, 2009 19:12 (GMT+09:00)<br><b>Title</b> : Passing structure from Server to Client on DBus<br><br>Hi all,<br> I would like to fill and send a structure from Server to Client on<br>DBus.<br><br>The structure I want to send from server app is:<br>struct download_info<br> {<br> char *URL;<br> char *file_name;<br> long int content_length;<br> char *mime_type;<br> char *encoding;<br> };<br>The inrospection XML file contents are as below:<br><br><?xml version ="1.0" encoding ="UTF-8"?><br><node><br> <interface name="org.azingo.dlmgr"><br> <method name="download_getdownloadinfo"><br> <annotation name="org.freedesktop.DBus.GLib.CSymbol"<br>value="download_daemon_getdownloadinfo"/><br> <arg type="i" name="download_handle" direction="in"/><br> <arg type="(ssxss)" name="dl_info" direction="out"/><br> <arg type="i" name="error" direction="out"><br> <annotation name="org.freedesktop.DBus.GLib.ReturnVal"<br>value="error"/><br> </arg><br> </method><br> </interface><br></node><br><br>The client side binding I generated for this is as below:<br><br>gboolean<br>org_azingo_dlmgr_download_getdownloadinfo (DBusGProxy *proxy, const gint<br>IN_download_handle, GValueArray** OUT_dl_info, gint* OUT_error, GError<br>**error)<br><br>{<br> return dbus_g_proxy_call (proxy, "download_getdownloadinfo", error,<br>G_TYPE_INT, IN_download_handle, G_TYPE_INVALID, dbus_g_type_get_struct<br>("GValueArray", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT64,<br>G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID), OUT_dl_info, G_TYPE_INT,<br>OUT_error, G_TYPE_INVALID);<br>}<br><br><br>For this I allocated memory on the client side as shown below:<br> GValueArray *gvalue_dl_info_client = NULL;<br> gvalue_dl_info_client = g_value_array_new(6);<br><br>and called <br><br>org_azingo_dlmgr_download_getdownloadinfo (remoteDldaemon,<br>20, &gvalue_dl_info_client, &error, &gerror);<br><br>On the server side, I did the following:<br><br>gint download_daemon_getdownloadinfo(DownloadDaemon* DaemonObject,<br> DOWNLOAD_HANDLE download_handle,<br> GValueArray **gvalue_dl_info,<br> GError** error)<br>{<br> DownloadManager* download_object = (DownloadManager*)download_handle;<br> <br> dl_info = (download_info *)g_malloc0(sizeof(download_info));<br><br> dl_info->URL = "www.google.com";<br> dl_info->file_name = "azingo";<br> dl_info->content_length = 12344;<br> dl_info->mime_type = "image/jpg";<br> dl_info->encoding = "utf-8";<br><br> <br> g_value_array_append (*gvalue_dl_info, NULL);<br> g_value_set_string (g_value_array_get_nth(*gvalue_dl_info, 0),<br>dl_info->URL);<br><br> g_value_array_append (*gvalue_dl_info, NULL);<br> g_value_set_string (g_value_array_get_nth(*gvalue_dl_info, 1),<br>dl_info->file_name);<br><br> g_value_array_append (*gvalue_dl_info, NULL);<br> g_value_set_long (g_value_array_get_nth(*gvalue_dl_info, 2),<br>dl_info->content_length);<br><br> g_value_array_append (*gvalue_dl_info, NULL);<br> g_value_set_string (g_value_array_get_nth(*gvalue_dl_info, 3),<br>dl_info->mime_type);<br><br> g_value_array_append (*gvalue_dl_info, NULL);<br> g_value_set_string (g_value_array_get_nth(*gvalue_dl_info, 4),<br>dl_info->encoding);<br><br>}<br><br> so, Ideally, *gvalue_dl_info should point to a valid memory since I<br>have allocated memory for it in the client app but I'm getting the<br>following assertion:<br><br>(process:22619): GLib-GObject-CRITICAL **: g_value_array_append:<br>assertion `value_array != NULL' failed<br><br>(process:22619): GLib-GObject-CRITICAL **: g_value_array_get_nth:<br>assertion `value_array != NULL' failed<br><br> Which in turn means that (*gvalue_dl_info == NULL)<br><br>The client and Server are two different processes. <br>So, is it possible to send the address of memory allocated in Client app<br>to Server app on DBus? If not, is there any other way to send a<br>structure from Server to Client?<br><br>Any pointers would be appreciated.<br><br>Thanks,<br>Ravi.<br><br><br>_______________________________________________<br>dbus mailing list<br>dbus@lists.freedesktop.org<br>http://lists.freedesktop.org/mailman/listinfo/dbus<br><p> </p><p> </p><!--SP:deepesh.t--><!--deepesh.t:EP--><p> </p><p> </p></BODY></HTML>