问题 :如果我发送矢量数据,我没有收到回调到我的glib客户端回调处理程序。
矢量数据在总线上是可靠的,因为我使用C ++客户端应用程序检查了这一点。
离散数据传输(int,int,..)回调工作正常。所以我确信设置和编组过程对于简单类型是正确的。
XML矢量定义:
arg name="vectorData" type="a(uuuuuuu)"
总线绑定工具生成:
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);
}
设置编组和回调:
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: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);
}
回调处理程序:
void _VectorEvent_handler(void *proxy, gpointer *data)
{
}
任何人都知道我的代码有什么问题以及为什么DBus不接受我的格式并处理我的回调?
My C ++ vector实现工作(在C ++客户端中),但不能在我的lib中使用。所以请仅提示glib实现。