I'm using qt-dbus to expose some API from my software.
I convert foo.xml with interface declaration to foo_adaptor.cpp and foo_adaptor.h holding FooAdaptor class via qdbusxml2cpp, then I bind real Foo class to the FooAdaptor by calling new FooAdaptor(this) inside Foo's constructor.
So, it works: Foo metods are called, when I send message via dbus-send to my app.
For specific builds of my software I want to disable some methods. I need somehow to inform the caller, that some method call actually unallowed and does nothing/have no meaning. Is there any function to call/exception to throw to do this?
Error responses can be sent by making your D-Bus object (the one registered with QDBusConnection::registerObject(), not the adaptor) inherit from QDBusContext and then using the sendErrorReply() method:
http://qt-project.org/doc/qt-5.1/qtdbus/qdbuscontext.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With