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:
@@ -6,3 +6,23 @@ from ..__about__ import __author__, __copyright__, __license__, __version__
|
|||||||
|
|
||||||
REVPI_DBUS_NAME = "com.revolutionpi.middleware1"
|
REVPI_DBUS_NAME = "com.revolutionpi.middleware1"
|
||||||
REVPI_DBUS_BASE_PATH = "/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])
|
||||||
|
|||||||
Reference in New Issue
Block a user