Closed pkcinna01 closed 3 years ago
Please read the docs for the low level interface https://python-dbus-next.readthedocs.io/en/latest/low-level-interface/index.html
There's plenty of examples there to show you how to use it.
Sorry. I couldn't figure it out with the low level api. Another problem I was having was ofono creates a lot of objects on the fly defined by a path. With dbus-next, I didn't see a method to get the interface from a proxy object to listen for events on one object. I did find BaseProxyObject.ProxyInterface but could not add listeners with calls like "ProxyInterface.on_call_started". It is easy with dbus with code like this:
self.voice_call_manager = dbus.Interface(sysBus.get_object('org.ofono', self.modem_path), 'org.ofono.VoiceCallManager')
Btw, I tried to use the "Chat" link in the README but it was asking for personal credentials (phone number).
One useful tip for working with introspected classes like this is to use statements like print(dir(interface))
. Other than that i don't know how to help without having a specific question to answer.
I guess the question is how to convert the code below to the interface for one object defined by modem_path. There will be lots of VoiceCallMangers created dynamically.
modem_interface = dbus.Interface(sysBus.get_object('org.ofono', modem_path),'org.ofono.VoiceCallManager')
With dbus-next, i can get the proxy_object but not clear how to get the interface from there... my hope was calling proxy_object.get_interface() with no arguments would return the interface to keep it simple.
Ofono is a popular framework for interacting with cell phones via bluetooth. I could not figure out how to get events for a specific phone or phone call without having access to a proxy object.