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

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.7k Views
  • 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.
  • S Offline
    S Offline
    spyd3r
    wrote on 1 Jul 2016, 08:36 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

    1/1

    1 Jul 2016, 08:36

    • Login

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