comparison sat_frontends/bridge/dbus_bridge.py @ 3143:830fce0db15d

bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
author Goffi <goffi@goffi.org>
date Wed, 29 Jan 2020 18:54:40 +0100
parents 9d0df638c8b4
children d10b2368684e
comparison
equal deleted inserted replaced
3142:cd90c24b2836 3143:830fce0db15d
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 #-*- coding: utf-8 -*- 2
3 3 # SàT communication bridge
4 # SAT communication bridge
5 # Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org) 4 # Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org)
6 5
7 # This program is free software: you can redistribute it and/or modify 6 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as published by 7 # it under the terms of the GNU Affero General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or 8 # the Free Software Foundation, either version 3 of the License, or
19 18
20 import asyncio 19 import asyncio
21 import dbus 20 import dbus
22 import ast 21 import ast
23 from sat.core.i18n import _ 22 from sat.core.i18n import _
24 from .bridge_frontend import BridgeException 23 from sat.tools import config
25 from sat.core.log import getLogger 24 from sat.core.log import getLogger
26 from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError 25 from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError
27 from dbus.mainloop.glib import DBusGMainLoop 26 from dbus.mainloop.glib import DBusGMainLoop
27 from .bridge_frontend import BridgeException
28
28 29
29 DBusGMainLoop(set_as_default=True) 30 DBusGMainLoop(set_as_default=True)
30 log = getLogger(__name__) 31 log = getLogger(__name__)
31 32
32 33
33 const_INT_PREFIX = "org.salutatoi.SAT" # Interface prefix 34 # Interface prefix
35 const_INT_PREFIX = config.getConfig(
36 config.parseMainConf(),
37 "",
38 "bridge_dbus_int_prefix",
39 "org.salutatoi.SAT")
34 const_ERROR_PREFIX = const_INT_PREFIX + ".error" 40 const_ERROR_PREFIX = const_INT_PREFIX + ".error"
35 const_OBJ_PATH = '/org/salutatoi/SAT/bridge' 41 const_OBJ_PATH = '/org/salutatoi/SAT/bridge'
36 const_CORE_SUFFIX = ".core" 42 const_CORE_SUFFIX = ".core"
37 const_PLUGIN_SUFFIX = ".plugin" 43 const_PLUGIN_SUFFIX = ".plugin"
38 const_TIMEOUT = 120 44 const_TIMEOUT = 120