refactor(dbus): Parameterize picontrol_device and config_rsc

Replaced hardcoded paths with configurable parameters `picontrol_device`
and `config_rsc` across multiple classes. This improves flexibility,
making the components adaptable to various environments or setups.
Updated corresponding initialization and method implementations to use
these parameters.
This commit is contained in:
2025-04-19 08:21:24 +02:00
parent 4c1dc1c9b5
commit a4ccb9081f
3 changed files with 17 additions and 9 deletions

View File

@@ -16,19 +16,26 @@ log = getLogger(__name__)
class BusProvider(Thread):
def __init__(self):
def __init__(
self,
picontrol_device="/dev/piControl0",
config_rsc="/etc/revpi/config.rsc",
):
log.debug("enter BusProvider.__init__")
super().__init__()
self._bus = SystemBus()
self._loop = GLib.MainLoop()
self.picontrol_device = picontrol_device
self.config_rsc = config_rsc
def run(self):
log.debug("enter BusProvider.run")
self._bus.publish(
REVPI_DBUS_NAME,
InterfacePiControl(),
InterfacePiControl(self.picontrol_device, self.config_rsc),
)
self._loop.run()