Kistler-Group/sdbus-cpp

Error when implementing ObjectManager on System Bus Connection

Opened this issue · 0 comments

Describe the bug
When implementing the various ways to implement ObjectManager (either ObjectManager_Adaptor or addObjectManager() member function) on a System Bus connection the object isn't introspectable in d-feet. If I do the same on a session bus it works as expected.

To Reproduce
This example is taken from #50 and adapted slightly but it also happens with my ObjectManager_Adaptor code.

#include "sdbus-c++/IConnection.h"
#include <sdbus-c++/sdbus-c++.h>

int main(int argc, char *argv[])
{
    // Create D-Bus connection to the system bus and requests name on it.
    const char* serviceName = "org.example.service";
    // auto connection = sdbus::createSystemBusConnection(serviceName);
    auto connection = sdbus::createSessionBusConnection(serviceName);


    // Create D-Bus object.
    const char* objectPath = "/org/example/service";
    auto serviceObject = sdbus::createObject(*connection, objectPath);

    // Register D-Bus property on the object, and export the object.
    const char* interfaceName = "org.example.service";
    serviceObject->registerProperty("Name").onInterface(interfaceName).withGetter([](){ return "hello"; }).withSetter([](const uint32_t& value){  });

    serviceObject->addObjectManager();
    serviceObject->finishRegistration();

    // Start the service
    connection->enterEventLoop();
}

Uncomment the different connection types to test.

Expected behavior
I expect the ObjectManager to behave the same on both system and session bus unless my understanding is incorrect.

Real (buggy) behavior
System bus object isn't introspectable.

Additional context

  • Ubuntu 20.04 - 5.15.0-88-generic.
  • Systemd version 245.