带数组的 Systemd dbus sd_bus_call_method()
Systemd dbus sd_bus_call_method() with array
我正在尝试使用 systemd dbus 修改一些代码。
方法调用如下所示:
res = sd_bus_call_method(bus,
SERVICE_NAME,
OBJECT_PATH,
INTERFACE,
"AddData",
&error, &m,
"ss",
data->key,
data->valyue);
现在我正在尝试将其更改为:
res = sd_bus_call_method(bus,
SERVICE_NAME,
OBJECT_PATH,
INTERFACE,
"AddData",
&error, &m,
"(a(ss))",
/* WHAT DO I PASS HERE? */);
我找不到示例或文档,代码对我来说不是很清楚。
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.
有关参数的详细信息,请参见 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");
我正在尝试使用 systemd dbus 修改一些代码。
方法调用如下所示:
res = sd_bus_call_method(bus,
SERVICE_NAME,
OBJECT_PATH,
INTERFACE,
"AddData",
&error, &m,
"ss",
data->key,
data->valyue);
现在我正在尝试将其更改为:
res = sd_bus_call_method(bus,
SERVICE_NAME,
OBJECT_PATH,
INTERFACE,
"AddData",
&error, &m,
"(a(ss))",
/* WHAT DO I PASS HERE? */);
我找不到示例或文档,代码对我来说不是很清楚。
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.
有关参数的详细信息,请参见 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");