Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unknown Object Path even after registering object in QDbus
Forum Updated to NodeBB v4.3 + New Features

Unknown Object Path even after registering object in QDbus

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt 5.5qdbus
1 Posts 1 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • spyd3rS Offline
    spyd3rS Offline
    spyd3r
    wrote on last edited by
    #1

    I created an Interface header file and called qt5_generate_dbus_interface() from cmake to get a .xml file.
    Then I generated an adaptor from this .xml file by calling qt_add_dbus_adaptor().
    In the Interface cpp file's ctor, I binded the adaptor generated and called registerObject() and registerService() with valid arguments.
    The booleans for both returned true.
    However, I get the following error:

    Call to object / <My Service>: org.freedesktop.DBus.Error.UnknownObject (No such object path '/') failed

    Calling on the path, that I registered object at, also causes the same error.

    Some Cmake code

    set(dbus_SRCS org.kde.kdenow.Flight.xml)
     +
     +qt5_generate_dbus_interface(flightinterface.h
     +                            org.kde.kdenow.Flight.xml
     +                            OPTIONS -M
     +                            )
     +
     +qt5_add_dbus_adaptor(dbus_SRCS
     +                     ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kdenow.Flight.xml
     +                     flightinterface.h
     +                     FlightInterface
     +                    )
    
    

    flightinterface.h

    class FlightInterface : public QObject
    {
            Q_OBJECT
            Q_CLASSINFO("D-Bus Interface", "org.kde.kdenow.Flight");
    
        public:
            explicit FlightInterface(QObject* parent = 0);
            void setMap(QVariantMap& map);
    
        public Q_SLOTS:
            QVariantMap getMap();
    
        private:
            QVariantMap m_map;
    };
    

    flightinterface.cpp

    FlightInterface::FlightInterface(QObject* parent): QObject(parent)
    {
        new FlightAdaptor(this);
        QDBusConnection dbus = QDBusConnection::sessionBus();
        bool obOk = dbus.registerObject("/Flight", this);
        bool serOk= dbus.registerService("org.kde.kdenow.Flight");
        if (!obOk) {
            qDebug() << "Could not register Object";
        }
        else {
            qDebug() << "Registered object at path";
        }
        if (!serOk) {
            qDebug() << "Could not register service";
        }
        else {
            qDebug() << "Registered Service";
        }
    }
    
    void FlightInterface::setMap(QVariantMap& map)
    {
        m_map = map;
        qDebug() << m_map;
    }
    
    QVariantMap FlightInterface::getMap()
    {
        return m_map;
    }
    

    I setMap() from some other valid code.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved