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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user