Commit 1bde63d9 authored by Devaev Maxim's avatar Devaev Maxim

Added support of D-Bus signals

parent ffc35d5b
...@@ -22,6 +22,17 @@ class Hello(settingsd.service.FunctionObject) : ...@@ -22,6 +22,17 @@ class Hello(settingsd.service.FunctionObject) :
settingsd.shared.Functions.Hello.removeFromConnection() settingsd.shared.Functions.Hello.removeFromConnection()
settingsd.shared.Functions.removeSharedObject("Hello") settingsd.shared.Functions.removeSharedObject("Hello")
###
@settingsd.service.functionMethod("dbus")
def dbusEcho(self, text) :
self.dbusEchoSignal(text)
@settingsd.service.functionSignal("dbus")
def dbusEchoSignal(self, text) :
pass
class Service(settingsd.service.Service) : class Service(settingsd.service.Service) :
def initService(self) : def initService(self) :
self.Functions.addSharedObject("Hello", Hello(self.serviceName())) self.Functions.addSharedObject("Hello", Hello(self.serviceName()))
......
...@@ -104,13 +104,32 @@ def customMethod(interface_name) : ...@@ -104,13 +104,32 @@ def customMethod(interface_name) :
def functionMethod(interface_name) : def functionMethod(interface_name) :
def decorator(function) : def decorator(function) :
return customMethod(dbus_tools.joinMethod(config.value(config.APPLICATION_SECTION, return customMethod(dbus_tools.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"),
"service_name"), "functions", interface_name))(function) "functions", interface_name))(function)
return decorator return decorator
def actionsMethod(interface_name) : def actionsMethod(interface_name) :
def decorator(function) : def decorator(function) :
return customMethod(dbus_tools.joinMethod(config.value(config.APPLICATION_SECTION, return customMethod(dbus_tools.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"),
"service_name"), "actions", interface_name))(function) "actions", interface_name))(function)
return decorator
###
def customSignal(interface_name) :
def decorator(function) :
return dbus.service.signal(interface_name)(function)
return decorator
def functionSignal(interface_name) :
def decorator(function) :
return customSignal(dbus_tools.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"),
"functions", interface_name))(function)
return decorator
def actionsSignal(interface_name) :
def decorator(function) :
return customSignal(dbus_tools.joinMethod(config.value(config.APPLICATION_SECTION, "service_name"),
"actions", interface_name))(function)
return decorator return decorator
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment