refactor(dbus): D-Bus interface management with cleanup support.
Introduced a `DbusInterface` base class with a `cleanup` method to standardize resource cleanup for D-Bus interfaces. Modified `InterfacePiControl` to inherit from it and implemented `cleanup` logic for proper watchdog resource handling. Adjusted `BusProvider` to manage multiple interfaces and ensure cleanup on shutdown.
This commit is contained in:
@@ -11,6 +11,18 @@ REVPI_DBUS_NAME = "com.revolutionpi.middleware1"
|
||||
REVPI_DBUS_BASE_PATH = "/com/revolutionpi/middleware1"
|
||||
|
||||
|
||||
class DbusInterface:
|
||||
|
||||
def cleanup(self):
|
||||
"""
|
||||
Represents a method responsible for performing cleanup operations. This method is executed to properly
|
||||
release resources, close connections, or perform other necessary finalization tasks.
|
||||
|
||||
This method does not take any arguments or return a value.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def extend_interface(*args) -> str:
|
||||
"""
|
||||
Extends an interface name by appending additional segments to a pre-defined base name.
|
||||
|
||||
Reference in New Issue
Block a user