Commit 41021b91 authored by Devaev Maxim's avatar Devaev Maxim

Hieratic structure of shareds

parent 0b72ba22
# -*- coding: utf-8 -*-
import time
from settingsd import config
from settingsd import service
from settingsd import shared
##### Private classes #####
class Example(service.FunctionObject) :
### DBus methods ###
@service.functionMethod("example")
def hello(self) :
return config.value(self.service().serviceName(), "hello_string")
@service.functionMethod("example")
def echo(self, text) :
return text
def time(self) :
return time.ctime()
@service.customMethod("com.example.settingsd")
def die(self) :
shared.Functions.Test.Example.removeFromConnection()
shared.Functions.Test.removeSharedObject("Example")
return self.sharedPath()
###
@service.functionMethod("dbus")
def dbusEcho(self, text) :
self.dbusEchoSignal(text)
@service.functionSignal("dbus")
def dbusEchoSignal(self, text) :
pass
##### Public classes #####
class Service(service.Service) :
def initService(self) :
shared.Functions.addShared("Test")
shared.Functions.Test.addSharedObject("Example", Example(self.serviceName(), "Test.Example", self))
@classmethod
def serviceName(self) :
return "example"
@classmethod
def optionsList(self) :
return [
(self.serviceName(), "hello_string", "Hello, World!", str)
]
......@@ -30,7 +30,7 @@ class Service(service.Service) :
### Public ###
def initService(self) :
shared.Functions.addSharedObject("Settingsd", Settingsd(const.DEFAULT_SERVICE_PATH))
shared.Functions.addSharedObject("Settingsd", Settingsd(const.DEFAULT_SERVICE_PATH, "Settingsd", self))
@classmethod
def serviceName(self) :
......
# -*- coding: utf-8 -*-
import sys
import settingsd.service
import settingsd.shared
class Hello(settingsd.service.FunctionObject) :
@settingsd.service.functionMethod("test")
def hello(self) :
return "Hello, World!"
@settingsd.service.functionMethod("test")
def echo(self, text) :
return text
@settingsd.service.customMethod("org.liksys.settingsd")
def dump(self) :
return str(self)
@settingsd.service.customMethod("org.liksys.settingsd")
def die(self) :
settingsd.shared.Functions.Hello.removeFromConnection()
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) :
def initService(self) :
self.Functions.addSharedObject("Hello", Hello(self.serviceName()))
@classmethod
def serviceName(self) :
return "hello"
@classmethod
def optionsList(self) :
return [
(self.serviceName(), "hello_string", "Hello, World!", str)
]
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