Important: Please read the Qt Code of Conduct -

Passing QVariant as argument to QDBusInterface->Call in bluez Set method

  • I am trying to set a property (Powered) in the bluez service but fail with this error message.

    QDBusMessage(type=Error, service="", error name="org.freedesktop.DBus.Error.UnknownMethod", error message="Method "Set" with signature "ssb" on interface "org.freedesktop.DBus.Properties" doesn't exist
    ", signature="", contents=([]) )

    I should be passing a string, string, variant to the Set method. But per the error message it looks like I am sending "ssb" or string, string, bool??. This is irritating because I should be sending a QVarriant of type bool.

    When I call the Get method everything works. So I believe that the QDBusInterface is good.

    Here is the code snippet. my appologies for the formatting, it is hard to get the spacing right on the posting
    QDBusInterface *adapter1 = new QDBusInterface("org.bluez","/org/bluez/hci0","org.freedesktop.DBus.Properties",bus);

    //does not work
    QVariant power(false);
    QDBusMessage blah=adapter1->call("Set","org.bluez.Adapter1","Powered",power);

    QDBusReply<QVariant> replyAdapter=adapter1->call("Get","org.bluez.Adapter1","Powered")

Log in to reply