diff --git a/pym/calculate/lib/utils/dbus_tools.py b/pym/calculate/lib/utils/dbus_tools.py index 1d79b51..172f466 100644 --- a/pym/calculate/lib/utils/dbus_tools.py +++ b/pym/calculate/lib/utils/dbus_tools.py @@ -41,3 +41,20 @@ def get_dbus_path_tree(bus_name, bus=None): yield x except dbus.DBusException: pass + +def run_dbus_core(hostname, port): + if hostname in ("127.0.0.1", "localhost"): + try: + from ip import check_port + if not check_port(hostname, port): + bus = dbus.SystemBus() + DBUS_INTERFACE="org.calculate.CoreInterface" + DBUS_NAME="org.calculate.Core" + DBUS_OBJECT="/Core" + try: + remote_object = bus.get_object(DBUS_NAME, DBUS_OBJECT) + remote_object.Start(port) + except dbus.DBusException: + pass + except ImportError: + pass