#!/usr/bin/env python3

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._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()
