diff options
Diffstat (limited to 'service.py')
-rwxr-xr-x | service.py | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -33,7 +33,7 @@ import signal import tempfile import time from threading import Thread -from typing import Union +from typing import Union, Any import dbus import dbus.mainloop.glib @@ -238,17 +238,17 @@ class RWASupportSessionService(dbus.service.Object): if self.one_time: self._stop_all() - def _trigger(self, token: str) -> bool: + def _trigger(self, session_id: int, data: dict, method: str = "trigger") -> Union[dict, bool]: """Trigger a specific session via trigger token.""" - logging.info(f"Triggered with token {token}") + logging.info(f"Triggered with session ID {session_id} and {data}") for session in self.sessions.values(): - if token == session.trigger_token: - logging.info(f"Session #{session.pid} matches the token.") - session.trigger() - return True + if session.session_id == session_id: + r = session.trigger(data, method) + logging.info(f"Session #{session.pid} matches the ID: {r}") + return r - logging.warning(" No matching session found for this token.") + logging.warning(" No matching session found for this ID.") return False def _stop_all(self): |