Skip to content

How to create two (or more) interfaces with the same name #103

@arkq

Description

@arkq

I have a case where I have to create two interfaces with the same name, but with different properties (these interfaces are exposed on different paths). Basically I have two options: a) create one class which will return properties based on exposed path (some props are optional) b) create two classes with the same interface name. Unfortunately, both these solutions are not possible right now.

In case of option a) the limitation seems to be imposed by libsystemd. It's not possible to define property as "optional", i.e. when property is not available, the org.freedesktop.DBus.Properties.GetAll does not return value for such property and org.freedesktop.DBus.Properties.Get returns org.freedesktop.DBus.Error.InvalidArgs: No such property 'Name'. The problem is that the sd_bus_emit_interfaces_added_strv() function collects all properties internally and in case when property value getter fails, the entire sd_bus_emit_interfaces_ added_* call fails. There are some possibilities like libsystemd-specific PropertyExplicitFlag flag, but this conflicts with PropertyEmitsChangeFlag. So, such approach is not ideal.

For option b) the problem is with sdbus internals where parse_properties_changed uses global DBUS_INTERFACE_NAME_TO_CLASS mapping... Would it be possible to remove internal mapping in favor of user provided list of interfaces? This function takes interface argument but does not use it...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions