problem with executing method using DBUS, why parameters passing is changed.

amol gajewar amol_gajewar at yahoo.co.in
Sun Mar 11 22:08:24 PDT 2007


Hi 
I have written one server which have one method sum which is exposed to client through DBUS. my client calls this method with 2 input parameters and one output parameter (collect the sum of 2 input nos), but i am not able to receive  any change in my output parameter though the method is executed.

Following is my XML file
<?xml version="1.0" encoding="UTF-8" ?>

<node name="/com/example/MyServer">
  
  <interface name="com.example.MyServer">
    <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_server"/>
    <method name="NoArgs">
      <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_server_no_args"/>
    </method>

    <method name="Sum">
      <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_server_sum"/>
      <arg type="i" name="num1" direction="in" />
      <arg type="i" name="num2" direction="in" />
      <arg type="i" name="sum" direction="out" />
    </method>

  </interface>
</node>

Following is the implementation of function in server

gboolean my_server_sum(int num1,int num2,int *sum)
{
    printf("\n num1 = %d num2  = %d sum = %d \n",num1,num2,sum);    
     *sum = num1 + num2;
   return TRUE;
}


Following is the call in client
com_example_MyServer_sum (proxy,num1,num2,ptr,&error);
where int num1 = 4, num2 = 3 
ptr is integer pointer holding add of integer variable.

printf on server side prints 

num1 = 134546064 num2 = 4 sum = 3

why is this happening?








 				
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20070312/8a87e4ec/attachment.html


More information about the dbus mailing list