gdbus-codegen and array parameters




Hi,

I try to use BlueZ via DBus from C program using gdbus-codegen.

I found that gdbus-codegen generates

  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
    "WriteValue",
    g_variant_new ("(^ay)",
                   arg_value),
    G_DBUS_CALL_FLAGS_NONE,
    -1,
    cancellable,
    callback,
    user_data);

for <arg name="value" type="ay" direction="in"/> xml.

But I cannot find a way to pass byte array like "\x00\x01\x02" to such
function in arg_value.

I can do it replacing g_variant_new... with

GVariant *q = g_variant_parse(G_VARIANT_TYPE("(^ay)"), "[0, 1, 2]",
NULL, NULL, NULL);

Does somebody know how to pass byte array (not null-terminated string)
to generated by gdbus-codegen function without modification?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]