[Interest] Get QtDbus interface name?

Nate Rogers bob119er at yahoo.com
Wed Oct 1 17:04:05 CEST 2014


I guess I really don't need to use properties, I will just convert my code over to use public slots instead.

So I had this idea where I could have a method in each of my interfaces that a caller could use to register a name so that future calls from that bus address would have that name associated with it (for logging).  The caller would have to set it's name for each interface that it wanted to call.  For example let's say I setup a member variable from the caller like this:

m_ServiceData = new com::GDM::ServiceData("com.GDM.ServiceData", "/ServiceData", QDBusConnection::systemBus(), this);
m_ServiceData->registerMyName("CanData");

This would create a connection to the ServiceData interface that the member variable m_ServiceData points to.  Calling registerMyName would allow the ServiceData interface to store the name "CanData" and the bus interface (ex: 1.67) it came from.  So long as m_ServiceData isn't destroyed would it always have the same bus address each time the caller uses it?  Does my idea work or am I not understanding something?  Thanks!

Nate



On Tuesday 30 September 2014 13:23:45 Nate Rogers wrote:
> I get a segfault.  Is this a known bug in Qt?

No. It might be a bug, but it's not known.

> Also is there any way to set a name for the process that is calling the
> testMethod function so that I get a service name rather than a bus
> address?  Thanks!

The caller can request multiple names. Unfortunately, there's no mapping of 
unique name to service names, since it can be more than one.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list