<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 &nbsp;<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 ---&gt; g_value.</p>
<p>Regards,</p>
<p>Deepesh</p>
<p>&nbsp;</p><p>&nbsp;</p><br><br>------- <b>Original Message</b> -------<br><b>Sender</b> : ravikumar.paluri&lt;ravikumar.paluri@azingo.com&gt;<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&nbsp;all,<br>&nbsp;&nbsp;&nbsp;I&nbsp;would&nbsp;like&nbsp;to&nbsp;fill&nbsp;and&nbsp;send&nbsp;a&nbsp;structure&nbsp;from&nbsp;Server&nbsp;to&nbsp;Client&nbsp;on<br>DBus.<br><br>The&nbsp;structure&nbsp;I&nbsp;want&nbsp;to&nbsp;send&nbsp;from&nbsp;server&nbsp;app&nbsp;is:<br>struct&nbsp;download_info<br>&nbsp;{<br>&nbsp;&nbsp;&nbsp;char&nbsp;*URL;<br>&nbsp;&nbsp;&nbsp;char&nbsp;*file_name;<br>&nbsp;&nbsp;&nbsp;long&nbsp;int&nbsp;content_length;<br>&nbsp;&nbsp;&nbsp;char&nbsp;*mime_type;<br>&nbsp;&nbsp;&nbsp;char&nbsp;*encoding;<br>&nbsp;};<br>The&nbsp;inrospection&nbsp;XML&nbsp;file&nbsp;contents&nbsp;are&nbsp;as&nbsp;below:<br><br>&lt;?xml&nbsp;version&nbsp;=&quot;1.0&quot;&nbsp;encoding&nbsp;=&quot;UTF-8&quot;?&gt;<br>&lt;node&gt;<br>&nbsp;&nbsp;&lt;interface&nbsp;name=&quot;org.azingo.dlmgr&quot;&gt;<br>&nbsp;&nbsp;&lt;method&nbsp;name=&quot;download_getdownloadinfo&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;annotation&nbsp;name=&quot;org.freedesktop.DBus.GLib.CSymbol&quot;<br>value=&quot;download_daemon_getdownloadinfo&quot;/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;arg&nbsp;type=&quot;i&quot;&nbsp;name=&quot;download_handle&quot;&nbsp;direction=&quot;in&quot;/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;arg&nbsp;type=&quot;(ssxss)&quot;&nbsp;name=&quot;dl_info&quot;&nbsp;direction=&quot;out&quot;/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;arg&nbsp;type=&quot;i&quot;&nbsp;name=&quot;error&quot;&nbsp;direction=&quot;out&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;annotation&nbsp;name=&quot;org.freedesktop.DBus.GLib.ReturnVal&quot;<br>value=&quot;error&quot;/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/arg&gt;<br>&nbsp;&nbsp;&lt;/method&gt;<br>&nbsp;&nbsp;&lt;/interface&gt;<br>&lt;/node&gt;<br><br>The&nbsp;client&nbsp;side&nbsp;binding&nbsp;I&nbsp;generated&nbsp;for&nbsp;this&nbsp;is&nbsp;as&nbsp;below:<br><br>gboolean<br>org_azingo_dlmgr_download_getdownloadinfo&nbsp;(DBusGProxy&nbsp;*proxy,&nbsp;const&nbsp;gint<br>IN_download_handle,&nbsp;GValueArray**&nbsp;OUT_dl_info,&nbsp;gint*&nbsp;OUT_error,&nbsp;GError<br>**error)<br><br>{<br>&nbsp;&nbsp;return&nbsp;dbus_g_proxy_call&nbsp;(proxy,&nbsp;&quot;download_getdownloadinfo&quot;,&nbsp;error,<br>G_TYPE_INT,&nbsp;IN_download_handle,&nbsp;G_TYPE_INVALID,&nbsp;dbus_g_type_get_struct<br>(&quot;GValueArray&quot;,&nbsp;G_TYPE_STRING,&nbsp;G_TYPE_STRING,&nbsp;G_TYPE_INT64,<br>G_TYPE_STRING,&nbsp;G_TYPE_STRING,&nbsp;G_TYPE_INVALID),&nbsp;OUT_dl_info,&nbsp;G_TYPE_INT,<br>OUT_error,&nbsp;G_TYPE_INVALID);<br>}<br><br><br>For&nbsp;this&nbsp;I&nbsp;allocated&nbsp;memory&nbsp;on&nbsp;the&nbsp;client&nbsp;side&nbsp;as&nbsp;shown&nbsp;below:<br>&nbsp;GValueArray&nbsp;*gvalue_dl_info_client&nbsp;=&nbsp;NULL;<br>&nbsp;gvalue_dl_info_client&nbsp;=&nbsp;g_value_array_new(6);<br><br>and&nbsp;called&nbsp;<br><br>org_azingo_dlmgr_download_getdownloadinfo&nbsp;(remoteDldaemon,<br>20,&nbsp;&amp;gvalue_dl_info_client,&nbsp;&amp;error,&nbsp;&amp;gerror);<br><br>On&nbsp;the&nbsp;server&nbsp;side,&nbsp;I&nbsp;did&nbsp;the&nbsp;following:<br><br>gint&nbsp;download_daemon_getdownloadinfo(DownloadDaemon*&nbsp;DaemonObject,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOWNLOAD_HANDLE&nbsp;download_handle,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GValueArray&nbsp;**gvalue_dl_info,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GError**&nbsp;error)<br>{<br>&nbsp;&nbsp;DownloadManager*&nbsp;download_object&nbsp;=&nbsp;(DownloadManager*)download_handle;<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;dl_info&nbsp;=&nbsp;(download_info&nbsp;*)g_malloc0(sizeof(download_info));<br><br>&nbsp;&nbsp;&nbsp;&nbsp;dl_info-&gt;URL&nbsp;=&nbsp;&quot;www.google.com&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;dl_info-&gt;file_name&nbsp;=&nbsp;&quot;azingo&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;dl_info-&gt;content_length&nbsp;=&nbsp;12344;<br>&nbsp;&nbsp;&nbsp;&nbsp;dl_info-&gt;mime_type&nbsp;=&nbsp;&quot;image/jpg&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;dl_info-&gt;encoding&nbsp;=&nbsp;&quot;utf-8&quot;;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;g_value_array_append&nbsp;(*gvalue_dl_info,&nbsp;NULL);<br>&nbsp;g_value_set_string&nbsp;(g_value_array_get_nth(*gvalue_dl_info,&nbsp;0),<br>dl_info-&gt;URL);<br><br>&nbsp;g_value_array_append&nbsp;(*gvalue_dl_info,&nbsp;NULL);<br>&nbsp;g_value_set_string&nbsp;(g_value_array_get_nth(*gvalue_dl_info,&nbsp;1),<br>dl_info-&gt;file_name);<br><br>&nbsp;&nbsp;g_value_array_append&nbsp;(*gvalue_dl_info,&nbsp;NULL);<br>&nbsp;&nbsp;g_value_set_long&nbsp;(g_value_array_get_nth(*gvalue_dl_info,&nbsp;2),<br>dl_info-&gt;content_length);<br><br>&nbsp;&nbsp;g_value_array_append&nbsp;(*gvalue_dl_info,&nbsp;NULL);<br>&nbsp;&nbsp;g_value_set_string&nbsp;(g_value_array_get_nth(*gvalue_dl_info,&nbsp;3),<br>dl_info-&gt;mime_type);<br><br>&nbsp;&nbsp;g_value_array_append&nbsp;(*gvalue_dl_info,&nbsp;NULL);<br>&nbsp;&nbsp;g_value_set_string&nbsp;(g_value_array_get_nth(*gvalue_dl_info,&nbsp;4),<br>dl_info-&gt;encoding);<br><br>}<br><br>&nbsp;&nbsp;so,&nbsp;Ideally,&nbsp;*gvalue_dl_info&nbsp;should&nbsp;point&nbsp;to&nbsp;a&nbsp;valid&nbsp;memory&nbsp;since&nbsp;I<br>have&nbsp;allocated&nbsp;memory&nbsp;for&nbsp;it&nbsp;in&nbsp;the&nbsp;client&nbsp;app&nbsp;but&nbsp;I&#39;m&nbsp;getting&nbsp;the<br>following&nbsp;assertion:<br><br>(process:22619):&nbsp;GLib-GObject-CRITICAL&nbsp;**:&nbsp;g_value_array_append:<br>assertion&nbsp;`value_array&nbsp;!=&nbsp;NULL&#39;&nbsp;failed<br><br>(process:22619):&nbsp;GLib-GObject-CRITICAL&nbsp;**:&nbsp;g_value_array_get_nth:<br>assertion&nbsp;`value_array&nbsp;!=&nbsp;NULL&#39;&nbsp;failed<br><br>&nbsp;&nbsp;Which&nbsp;in&nbsp;turn&nbsp;means&nbsp;that&nbsp;(*gvalue_dl_info&nbsp;==&nbsp;NULL)<br><br>The&nbsp;client&nbsp;and&nbsp;Server&nbsp;are&nbsp;two&nbsp;different&nbsp;processes.&nbsp;<br>So,&nbsp;is&nbsp;it&nbsp;possible&nbsp;to&nbsp;send&nbsp;the&nbsp;address&nbsp;of&nbsp;memory&nbsp;allocated&nbsp;in&nbsp;Client&nbsp;app<br>to&nbsp;Server&nbsp;app&nbsp;on&nbsp;DBus?&nbsp;If&nbsp;not,&nbsp;is&nbsp;there&nbsp;any&nbsp;other&nbsp;way&nbsp;to&nbsp;send&nbsp;a<br>structure&nbsp;from&nbsp;Server&nbsp;to&nbsp;Client?<br><br>Any&nbsp;pointers&nbsp;would&nbsp;be&nbsp;appreciated.<br><br>Thanks,<br>Ravi.<br><br><br>_______________________________________________<br>dbus&nbsp;mailing&nbsp;list<br>dbus@lists.freedesktop.org<br>http://lists.freedesktop.org/mailman/listinfo/dbus<br><p>&nbsp;</p><p>&nbsp;</p><!--SP:deepesh.t--><!--deepesh.t:EP--><p>&nbsp;</p><p>&nbsp;</p></BODY></HTML>