evading
evading

Reputation: 3090

Systemd dbus sd_bus_call_method() with array

I am trying to modify some code using systemd dbus.

The method call looks like this:

res = sd_bus_call_method(bus,
    SERVICE_NAME,
    OBJECT_PATH,
    INTERFACE,
    "AddData",
    &error, &m,
    "ss",
    data->key,
    data->valyue);

Now I'm trying to change that to:

res = sd_bus_call_method(bus,
    SERVICE_NAME,
    OBJECT_PATH,
    INTERFACE,
    "AddData",
    &error, &m,
    "(a(ss))",
    /* WHAT DO I PASS HERE? */);

I can't find examples or documentation and the code is not super clear to me.

Upvotes: 2

Views: 4116

Answers (1)

evading
evading

Reputation: 3090

From documentation sd_bus_call_method

sd_bus_call_method() is a convenience function for initializing a bus message object and calling the corresponding D-Bus method. It combines the sd_bus_message_new_method_call(3), sd_bus_message_append(3) and sd_bus_call(3) functions into a single function call.

Details about parameters can be found on sd_bus_message_append().

res = sd_bus_call_method(bus,
    SERVICE_NAME,
    OBJECT_PATH,
    INTERFACE,
    "AddData",
    &error, &m,
    "(a(ss))",
    1, /* size of array */
    "hello",
    "world");

Upvotes: 6

Related Questions