I like to transfer C++ std::vector<...> data to a glib client
Problem: If I send vector data I did not get a callback into my glib client callback handler.
Vector data are sure on the bus because I checked this with a C++ client app.
Discrete data transfers (int,int,..) callbacks works fine. So I am sure the setup and marshal process is correct for simple types.
XML vector definition :
arg name="vectorData" type="a(uuuuuuu)"
bus-binding-tool generates:
gboolean com_xxx_yyy_method (DBusGProxy *proxy, const GPtrArray* IN_vectorData, GError **error)
{
return dbus_g_proxy_call (proxy, "Method", error, dbus_g_type_get_collection ("GPtrArray", dbus_g_type_get_struct ("GValueArray", G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID)), IN_vectorData, G_TYPE_INVALID, G_TYPE_INVALID);
}
Setup marshal and callback:
void setupVectorCallback(DBusGProxy *proxy)
{
dbus_g_object_register_marshaller(marshal_VOID__BOXED, // parameter
G_TYPE_NONE, // return type
G_TYPE_BOXED, // or G_TYPE_POINTER ?
G_TYPE_INVALID); // end parameter list
dbus_g_proxy_add_signal(proxy, "myVector", dbus_g_type_get_struct ("GValueArray", G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID), G_TYPE_INVALID);
dbus_g_proxy_connect_signal(proxy, "myVector", G_CALLBACK(_VectorEvent_handler), NULL, NULL);
}
Marshal:
Marshal:void marshal_VOID__BOXED (GClosure *closure, GValue *return_value G_GNUC_UNUSED, guint n_param_values, const GValue *param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data)
{
typedef void (*GMarshalFunc_VOID__BOXED) (gpointer data1,
gpointer arg_1,
gpointer data2);
register GMarshalFunc_VOID__BOXED callback;
register GCClosure *cc = (GCClosure*) closure;
register gpointer data1, data2;
//g_return_if_fail (n_param_values == 1+1);
if (G_CCLOSURE_SWAP_DATA (closure))
{
data1 = closure->data;
data2 = g_value_peek_pointer (param_values + 0);
}
else
{
data1 = g_value_peek_pointer (param_values + 0);
data2 = closure->data;
}
callback = (GMarshalFunc_VOID__BOXED) (marshal_data ? marshal_data : cc->callback);
callback (data1,
g_marshal_value_peek_boxed (param_values + 1),
data2);
}
Callback handler:
void _VectorEvent_handler(void *proxy, gpointer *data)
{
}
Anyone knows what is wrong in my code and why DBus did not accept my format and processes my callback?
My C++ vector implementation works (in the C++ client) but can not be used in my lib. So please hints only for glib implementation.