gpt4 book ai didi

dbus - 带数组的 Systemd dbus sd_bus_call_method()

转载 作者:行者123 更新时间:2023-12-02 00:50:21 26 4
gpt4 key购买 nike

我正在尝试使用 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

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");

关于dbus - 带数组的 Systemd dbus sd_bus_call_method(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40503915/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com