1

I use QtDBus on Qt 5.8.0. I am writing an application read sensor and i want to open an interface for other application, in order to they can get sensor value. I use QDBusconnection to create a service in system bus but always failed. I don't know why? Here is my code:

bool retVal; 
QDBusConnection dbus = QDBusConnection::systemBus();
retVal = dbus.registerService("com.thinhnguyen.GY86");

retVal is always false. Does anyone has experience on QtDBus could give me advices?

UPDATE: I still don't understand why some DBus service such as: NetworkManager, Connman, UDisks2...can create a DBus service in system bus without change anything in system.conf (eg. org.freedesktop.NetworkManager) but i cannot?

  • 1
    Since you are connecting to system bus, it could be a permissions related issue. See for example [this](https://stackoverflow.com/questions/4560877/dbus-bus-request-name-connections-are-not-allowed-to-own-the-service?noredirect=1&lq=1) and [this](https://stackoverflow.com/questions/18077753/qtservice-application-cannot-connect-to-system-bus-when-running-as-a-service?noredirect=1&lq=1) – arhzu Jun 06 '17 at 06:54
  • It seem to work now, thank for your help. I edited /usr/share/dbus-1/system.conf as example. –  Jun 07 '17 at 04:15

0 Answers0