Introduces test infrastructure and mockup classes for
`dbus_middleware1`. Includes `BusProvider` test setup, fake device
implementations, and initialization logic to support session bus
testing. Enhances testability and isolation of the D-Bus middleware
components.
Replaces inline ioctl logic with the new `PiControlIoctl` class for
cleaner and reusable code. This improves readability, encapsulates
device operations, and simplifies error handling for resetting the
piControl driver.
Wrap DBus publishing and main loop execution in try-except blocks to
capture and log failures. This ensures better visibility into errors and
prevents silent failures during runtime.
Introduced `BusType` enum to differentiate between session and system
bus usage in D-Bus calls. Updated `simple_call` and `await_signal`
functions to include a `bus_type` parameter, improving flexibility.
Adjusted `cli_picontrol` to leverage the new `BusType` parameter for
D-Bus interactions.
This property checks if the event loop is running, enhancing code
readability and convenience. It provides an easier way to monitor the
status of the loop, which may improve debugging and control flow
handling.
This change includes the BusProvider import in the `__init__.py` file of
dbus_middleware1. It ensures the module has access to BusProvider
functionality, improving modularity and readiness for use.
Introduced a `--use-session-bus` flag to optionally use the D-Bus
session bus instead of the system bus. This allows better flexibility
for local testing and development scenarios without requiring
system-level changes. Updated related classes and functions to respect
the new flag.
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.
The ResetDriverWatchdog class was relocated from dbus_helper.py to a new
helper module, process_image_helper.py, to improve code organization
and maintainability. Updated imports in relevant files to reflect this
change.
Consolidated `REVPI_DBUS_*` constants and `extend_interface` function
into `dbus_helper.py` for better modularity and reusability. Updated
imports across modules to reflect this change.
This update introduces a new console script entry point for `revpictl`,
allowing users to execute CLI commands via `revpi_middleware
.cli_commands.cli_base:main`. It enhances functionality by providing
additional tooling for command-line interactions.
Introduced a new `await-reset` command to the CLI, allowing users to
wait for a `NotifyDriverReset` signal with an optional timeout
parameter. Updated the argument parser and implemented the signal
detection logic using `await_signal`. Ensures improved control and
monitoring of piControl driver resets via CLI.
Introduce the await_signal function to monitor D-Bus signals with a
timeout. This uses GLib's MainLoop and threading to wait for signals
efficiently while respecting a specified timeout duration.
This introduces `simple_call`, a utility function to interact with D-Bus
interfaces within the RevPi system. It facilitates method invocation on
specific interfaces and paths, improving modularity and code reuse in
middleware operations.
Introduced command line arguments for daemon mode and configuration file
support. Enhanced the application with signal handling for reload, log
rotation, and termination. Updated the main function for improved
structure and robustness.
Introduce the main daemon class for revpi-middleware with methods for
initialization, configuration, DBus handling, and a mainloop. This
implementation includes support for configuration reloads, log rotation,
and proper thread management for DBus operations.
Introduce a new DBus policy file to manage access control for
revpi-middleware. This configuration allows full access to the root
user, limited access for the 'picontrol' group, and denies unauthorized
access by default.
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.
Introduce a D-Bus middleware module for revpi_middleware, including an
interface definition and a `BusProvider` class to handle D-Bus
communication. This forms the foundation for middleware interactions
using D-Bus.
Introduced D-Bus interfaces in `process_image` to interact with the
piControl driver. Added `InterfacePiControl` class with methods to reset
the driver and signal driver reset events. This improves driver
management and integration via D-Bus.
Introduced a new helper class `ResetDriverWatchdog`, a thread-based
watchdog to detect the `reset_driver` action. The implementation is
adapted from the revpipyload project and includes methods to
register/unregister callbacks and manage the watchdog lifecycle. This
addition improves monitoring capabilities for the process image.
All basic files for testing, building and distributing the project
are added here. The Makefile can set up the virtual environment and
create different package types from the project.
For local and automated testing of the source code, the testing
folder is added. This includes all the tests that the module has to
go through. The project also uses pytest-cov, which can also create
coverage reports.
These files create a callable Python package and manage the version
number of the complete project in the __about__.py file only. All other
parts, including Makefile, will use that version number.