-
Notifications
You must be signed in to change notification settings - Fork 60
ObjectManager interface added #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dbus_next/message_bus.py
Outdated
result = {} | ||
|
||
for node in self._path_exports: | ||
if not node.startswith(msg.path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the spec:
their object paths start with the ObjectManager's object path plus '/'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I wasn't sure about this.
So as it is at the moment, having interfaces like
/com/example/sample0
/com/example/sample0/ex0
ObjectManager on sample0 returns:
{'/com/example/sample0': {
'com.example.SampleInterface0': {'Bar': 105, 'Foo': 42},
'com.example.SampleInterface1': {'Bar': 105, 'Foo': 42}},
'/com/example/sample0/ex0': {
'com.example.OtherInterface0': {'Bar': 105, 'Foo': 42}}}
while that on ex0:
{'/com/example/sample0/ex0': {
'com.example.OtherInterface0': {'Bar': 105,'Foo': 42}}}
Is it then suppose to be:
{'/com/example/sample0/ex0': {
'com.example.OtherInterface0': {'Bar': 105,'Foo': 42}}}
{}
?
I tried to find some real life examples but not many programs implement this interface and each seam to do their own thing.
Alternatively I cold also just restrict ObjectManager to be available only on '/'
however I don't think that's according to spec either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it then suppose to be:
Yeah the spec says it's that second thing how I read it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the behavior to work like in spec and added test in test_standard_interfaces
dbus_next/aio/message_bus.py
Outdated
@@ -28,14 +28,19 @@ class MessageBus(BaseMessageBus): | |||
:type bus_type: :class:`BusType <dbus_next.BusType>` | |||
:param bus_address: A specific bus address to connect to. Should not be | |||
used under normal circumstances. | |||
:param expanded_intr: An option to select expanded interface tree in introspection or just | |||
exported interfaces. | |||
:type expanded_intr: bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the use case for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just an effect of some experimentation. Some dbus libraries return 'expanded' while others 'collapsed' Introspection. I thought this could be, at no great cost, an option left to developer to choose.
I don't have very strong feelings toward this however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Complexity of the api is a big concern for me because it's already way too complicated. So maybe we should put this off until someone needs it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option removed
Thanks for the contribution. It needs tests. |
Cool, looks ok. Run the linter and formatter with Any plans to do the signals? |
I run the cleanup and committed the files. I don't currently have a lot of time to spare on this but will try to come up with something for the signals in the (hopefully not too distant) future. |
👍 |
This patch adds
org.freedesktop.DBus.ObjectManager
interface to the default interfaces of the Node.The interface implements
GetManagedObjects
method and it exposesInterfacesAdded
andInterfacesRemoved
although it doesn't implement automatic signal emission.In addition this patch adds option to select the way introspection is presented. If
expanded_intr
option is True (False by default) the interface tree in introspection will be expanded i.e:else introspection is presented as before: