sending a complex stuct ober dbus-glib

sangram.kumar.yerra at accenture.com sangram.kumar.yerra at accenture.com
Fri Apr 8 06:04:55 PDT 2011


Hi ,

     Having some problems in appending a GPtrArray to a GValueArray..
          Not sure about the way its done..


<signal name="changed_value1">
      <arg type="(a(ay)i)" name="receive" direction="out"/>
  </signal>


This is what I tried for the the complex signature used in the signal..

   gchar ch[6]="0x00,0x26,0x5F,0x4A,0xEE,0x3A";
   int val = 100;
   int i;
   GArray *bdaddress;
   GPtrArray *ptrArray;
   GValue value = {0};
   GValue val1 ={0};
   GValue va2 = {0};
   GValueArray *structInst;
   GValueArray *VA1;
   int num1=10;

   bdaddress = g_array_new (FALSE, FALSE, sizeof(gchar));

   for(i=0; i<6; i++)
   {
            printf("The value to be added = %x\n", ch[i]);
            g_array_append_val(bdaddress, ch[i]);
            }


  VA1=g_value_array_new(1);
  g_value_init (&val1,DBUS_TYPE_G_UCHAR_ARRAY);
  g_value_set_boxed(&val1,bdaddress);
  g_value_array_append(VA1, &val1);
  g_value_unset(&val1);

  ptrArray = g_ptr_array_new ();
  g_ptr_array_add (ptrArray,  &VA1);

  structInst = g_value_array_new (2);
  g_value_init (&value,G_TYPE_POINTER);
  g_value_set_pointer(&value,ptrArray);
  g_value_array_append(structInst, &value);
  g_value_unset(&value);

  g_value_array_prepend (structInst, NULL);
  g_value_init (&va2, G_TYPE_UINT);
  g_value_set_uint (&va2, num1);
  g_value_array_append(structInst, &va2);
  g_value_unset(&va2);

  This is generating            (process:5430): GLib-GObject-CRITICAL **: g_value_copy: assertion `G_IS_VALUE (src_value)' failed
Segmentation fault (core dumped) ..
                 How to add a complex Ptrarray to a structure ..




Thanks & Regards

Sangram Kumar Yerra



________________________________
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20110408/2e2eda6c/attachment-0001.htm>


More information about the dbus mailing list