feat(dbus): Add extend_interface function for dynamic interface naming

This function constructs a fully qualified interface name by appending
segments to a predefined base name. It simplifies and standardizes the
process of generating extended interface names in the middleware.
This commit is contained in:
2025-04-18 16:42:42 +02:00
parent b442369b42
commit 46f23a13d3

View File

@@ -6,3 +6,23 @@ from ..__about__ import __author__, __copyright__, __license__, __version__
REVPI_DBUS_NAME = "com.revolutionpi.middleware1"
REVPI_DBUS_BASE_PATH = "/com/revolutionpi/middleware1"
def extend_interface(*args) -> str:
"""
Extends an interface name by appending additional segments to a pre-defined base name.
This function takes multiple arguments, concatenates them with a predefined base
interface name, and returns the resulting string, effectively constructing an
extended interface name.
Args:
*args: str
Components to be appended to the base interface name.
Returns:
str
Fully constructed interface name by joining the base interface name with
the provided segments.
"""
return ".".join([REVPI_DBUS_NAME, *args])