1

gbdus中除了使用org.freedesktop.DBus.Properties之外,还有其他方法可以设置接口的属性吗:</p>

g_dbus_connection_call_sync(conn,
                                "org.example",
                                "/org/example/object",
                                "org.freedesktop.DBus.Properties",
                                "Set",
                                g_variant_new(),
                                NULL,
                                G_DBUS_CALL_FLAGS_NONE,
                                -1,
                                NULL,
                                &error);

有没有更方便的API?

4

1 回答 1

1

如果您使用的接口有很多方法或属性,另一种方法可能更方便,GDBusProxy它是使用gdbus-codegen. 然后调用生成的包装器上的方法来设置属性。

这是一个如何使用的示例gdbus-codegen

于 2022-01-31T10:42:36.427 回答