Closed uhrm closed 1 day ago
The destination is the service you want to speak to that resides at the given path (think of it like a file system structure).
If I understand you correctly, Register
is called by an external service. When this method is called, you want to call some other method (defined by the well-known interface org.example.Callback
) on an object that resides at the path that is provided as a parameter of the aforementioned Register
method. Is this correct? In that case, simply set your destination to the interface name of the service you want to call, i.e. org.example.Callback
.
Ok, here is a diagram of what I'm trying to do.
Some external process makes a DBus call to register
of my interface. As a parameter, I receive an ObjectPath to where the org.example.Callback
lives in the external process. I have to invoke a method on that interface from inside my OnRegister
handler.
What I got wrong in my original submission is that I need the sender (MethodContext.Request.SenderAsString
) to be able to construct a proxy for the callback interface. But it is still essentially the same problem.
Yeah that looks like a legit use-case. We could probably just expose the Message object as the first argument, would this work for you?
Yes, that would solve my problem. (In fact, this is what I did as a work-around.)
It may be a little tricky to do this in a backwards-compatible way, though.
https://github.com/affederaffe/Tmds.DBus.SourceGenerator/commit/7aa0e0c91d580516ce57b589b2c4952bea40117b should address this use-case. Do you mind testing it out and report if this solution works for you?
Yes, this solves my problem.
Thanks a lot.
I have the problem to implement a DBus interface handler with a 'register' method that receives an ObjectPath as an argument. The object sitting at that ObjectPath implements a well-known interface (e.g.
org.example.Callback
). My goal is to create a proxy of that interface at ObjectPath inside the 'register' method. I.e. somethinkg likeHowever, the constructor of proxy objects also requires a
destination
. How can I get the destination from inside the 'register' method?In principle, this information would be available in the
MethodContext.Request.DestinationAsString
property. But I have found not way to get to this information.