Commit Graph

41 Commits

Author SHA1 Message Date
3909fab379 feat(dbus): Add GUI configuration handling to interface_config.py
Introduced the `configure_gui` function to manage GUI enabling,
disabling, availability, and status retrieval. Updated the
`AVAILABLE_FEATURES` dictionary to include GUI management functionality,
leveraging systemd and os module operations.
2025-04-20 15:34:16 +02:00
9ce36c78e7 feat(dbus): Add D-Bus interface for system configuration in middleware
Introduced `InterfaceRevpiConfig` to manage feature actions like
enable/disable, status, and availability using D-Bus. Includes support
for predefined features with systemd integration and exception handling
for unsupported features.
2025-04-20 15:18:27 +02:00
c24c78761f fix(cli): Change absolute imports to relative imports 2025-04-20 15:12:09 +02:00
3cc64f514f feat(dbus): Add grep function to search for patterns in a file
The new `grep` function reads a specified file and returns lines
containing a given pattern. It handles file not found errors and logs
unexpected exceptions, improving resilience in file operations.
2025-04-20 15:11:43 +02:00
865d2ca7a9 refactor: Update interface name from 'picontrol' to 'PiControl'
Renamed all occurrences of 'picontrol' to 'PiControl' in the D-Bus
interface definitions, method calls, and test cases for consistency and
adherence to naming conventions. This ensures uniformity across the
codebase and resolves potential naming-related issues.
2025-04-20 12:19:41 +02:00
157b7bd118 test(dbus): Add support for testing driver reset notification
Introduce `FakeResetDriverWatchdog` to simulate driver reset triggers.
Update existing tests and add a new test, `test_notify_reset_driver`, to
verify reset notifications using the event signaling mechanism.
v0.0.2
2025-04-19 15:56:59 +02:00
26c3ac0afb 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.
2025-04-19 15:55:49 +02:00
f8bc1532e3 refactor(dbus): Fix typo and remove unused thread instance
Corrected a typo in the `timeout` parameter name in `method_await_reset`
and removed an unused thread instance `th_sleep` from `dbus_helper.py`.
These changes improve code clarity and eliminate redundant components.
2025-04-19 15:05:47 +02:00
7207845b13 test(dbus): Add unit tests for PiControl D-Bus interface
Introduces initial tests for the PiControl interface in
`dbus_middleware1`. These tests cover basic functionality like checking
activity status and resetting the driver while verifying IOCTL calls.
2025-04-19 14:40:05 +02:00
3f808c55f8 test(dbus): Add unit test framework for dbus_middleware1 module
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.
2025-04-19 14:40:05 +02:00
4ccc328d0b refactor(dbus): piControl driver reset with PiControlIoctl class
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.
2025-04-19 13:57:56 +02:00
76b53423c1 fix(dbus): Add error handling for DBus publishing and main loop
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.
2025-04-19 12:43:22 +02:00
114cbd8099 refactor(cli): D-Bus helpers support session and system bus types
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.
2025-04-19 12:24:37 +02:00
487d5b3d46 feat(dbus): Add running property to BusProvider
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.
2025-04-19 12:13:45 +02:00
93b328bf3f feat(dbus): Add import for BusProvider in dbus_middleware1 module
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.
2025-04-19 12:13:44 +02:00
bde3920fc1 feat: Add session bus option for local testing and development
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.
2025-04-19 09:33:54 +02:00
a4ccb9081f 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.
2025-04-19 08:21:24 +02:00
4c1dc1c9b5 refactor(dbus): Move ResetDriverWatchdog to process_image_helper.py
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.
2025-04-19 08:13:02 +02:00
e756d68556 refactor(dbus): Move D-Bus helper functions to a dedicated file
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.
2025-04-19 07:56:17 +02:00
96db211240 feat(cli): Add new CLI tool entry point for revpictl
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.
v0.0.1
2025-04-18 19:21:53 +02:00
de7abe3b9c chore(build): Update requirements for this project 2025-04-18 19:21:53 +02:00
e8c2482bea feat(cli): Add await-reset to wait for piControl reset signal
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.
2025-04-18 19:21:53 +02:00
527a921bfd feat(cli): Add await_signal function to handle D-Bus signals
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.
2025-04-18 19:21:53 +02:00
6dca9880c8 feat(cli): Add D-Bus helper functions for CLI commands.
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.
2025-04-18 19:21:53 +02:00
06d33b218f feat: Add daemon mode and signal handling to main application
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.
2025-04-18 19:21:53 +02:00
964e0b997c feat: Add MiddlewareDaemon implementation to revpi-middleware
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.
2025-04-18 19:21:53 +02:00
46a2b3f0ce feat(dbus): Add DBus policy configuration for revpi-middleware
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.
2025-04-18 19:21:53 +02:00
46f23a13d3 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.
2025-04-18 19:21:53 +02:00
b442369b42 feat(dbus): Add initial D-Bus middleware implementation
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.
2025-04-18 19:21:53 +02:00
11b68a0c15 feat(process_image): Add D-Bus interface for piControl driver
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.
2025-04-18 19:21:53 +02:00
91a1fae411 feat(dbus): Add ResetDriverWatchdog helper as global dbus helper
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.
2025-04-18 19:21:53 +02:00
049ddfdc0f chore: Update proginit to 1.4.0 2025-04-18 19:21:53 +02:00
Sven Sager
0380311a9d feat: Add systemd file and data to integrate the app as a daemon 2025-04-18 19:21:53 +02:00
Sven Sager
c1bd98c444 feat: Add dummy main application script
The script uses the logger system and prints an string. You can try
the programm call with and without `-vv`so see the differences of
logging levels.
2025-04-17 12:06:14 +02:00
Sven Sager
92666f117d build: Add all necessary files for the build system
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.
2025-04-17 12:06:14 +02:00
Sven Sager
8124a687f0 test: Add tests directory with a dummy test
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.
2025-04-17 12:06:14 +02:00
Sven Sager
2b36297afb feat: Add the data directory for additional data files for the project
The data directory will hold everything your projekt needs and more.
You can create SystemD unit files or other templates, which packagers
can use.
2025-04-17 12:06:14 +02:00
Sven Sager
a9b6bb076c feat: Add proginit application basic module
The proginit.py module provides standards for programs. These include
program parameters, program configuration files and the log system.
2025-04-17 12:06:14 +02:00
Sven Sager
cc5eb516bf feat: Add python base project files
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.
2025-04-17 12:06:14 +02:00
Sven Sager
251bec2b38 docs: Use 'reuse' for SPDX Headers and Licenses 2025-04-17 12:06:14 +02:00
Sven Sager
1a53494d13 docs: Start git project with python git-ignore and Readme 2025-04-17 11:38:25 +02:00