0

I need to catch the signal from QDBus and I am new for this and don't know how to catch the signal from QDbus. Please explain with examples so i can understand.

sathish
  • 153
  • 1
  • 11

1 Answers1

2

There are a couple of options:

  1. Use QDBusConnection::connect()
  2. Create a generic QDBusInterface object for the remote interface and use it as the sender in a normale QObject::connect() withn SIGNAL/SLOT macros
  3. Generate a specific interface object from the service's XML introspection data using the qdbusxml2cpp code generator

The D-Bus Chat example uses both (1) and (3) and has (2) in a commented line for reference.

Kevin Krammer
  • 5,159
  • 2
  • 9
  • 22
  • Yes but i have a signal with arguments like newSignal(object path, Dict of{String, Dict of {String, Variant }} ) . Here I don't know how to declare this signal with these arguments, Can you guide me about this – sathish Mar 13 '17 at 06:33
  • You could try a `QVariantMap` as the second argument or a `QMap`. – Kevin Krammer Mar 13 '17 at 07:32
  • I have declared slot in a class as below public slots: int Devicefound(QDBusObjectPath path, QMap map){ qDebug() << "DEVICE FOUND >>>>>>> ", path; } – sathish Mar 18 '17 at 12:32
  • I have declared slot in a class as below slots: int Devicefound(QDBusObjectPath path, QMap map){ qDebug() << "DEVICE FOUND",; } and calling a function as below but also unable to catch the signal void BlueTooth::startDiscovery(bool state) { QDBusConnection::systemBus().connect("org.bluez","/","org.freedesktop.DBus.ObjectManager","InterfacesAdded",this,"Devicefound"); } – sathish Mar 18 '17 at 12:44
  • The slot argument should be `SLOT(Devicefound(...))`, like in a `QObject::connect()` – Kevin Krammer Mar 19 '17 at 08:35