Project

General

Profile

« Previous | Next » 

Revision 7eba70e1

Added by David Sorber almost 8 years ago

Add quasi async behavior example which I what I really need.

View differences:

software/dbus_test/client.py
import dbus
def error_func():
print('I got called ERROR')
def reply_func():
print('I got called REPLY')
class Client():
def __init__(self):
bus = dbus.SystemBus()
service = bus.get_object('com.example.service', "/com/example/service")
self._message = service.get_dbus_method('get_message', 'com.example.service.Message')
self._poke = service.get_dbus_method('poke', 'com.example.service.Poke')
self._quit = service.get_dbus_method('quit', 'com.example.service.Quit')
def run(self):
print("Mesage from service:", self._message())
self._quit()
self._poke() #reply_handler=reply_func, error_handler=error_func)
print('post poke')
self._poke() #reply_handler=reply_func, error_handler=error_func)
print('post poke')
self._poke() #reply_handler=reply_func, error_handler=error_func)
print('post poke')
# ~ self._quit()
if __name__ == "__main__":
Client().run()

Also available in: Unified diff