Commit Graph

129 Commits

Author SHA1 Message Date
Sven Sager
f3ffdd8eaa fix(io): Fix ios1 dbus policy
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-03-11 15:12:45 +01:00
Sven Sager
f4eff16ab6 refactor: Update type annotations
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-27 15:42:15 +01:00
Sven Sager
d95a65c18c test(dbus): Update bus_address for BusProvider clases
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-27 15:42:15 +01:00
Sven Sager
2b22c103c8 fixup: Integrate NotifyDriverReset handling for ios1
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-27 15:42:15 +01:00
Sven Sager
794089a5b5 refactor: Simplify D-Bus handling by using address-based connections
Replaced direct `SystemBus` and `SessionBus` instances with
address-based D-Bus connections. BusProviders will open their own bus
connections and close it at the end.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-27 15:39:02 +01:00
Sven Sager
5dfd8b9f2f feat: Add published event to bus providers for thread synchronization
Introduced a threading `Event` named `published` in `bus_provider_ios1`
and `bus_provider_middleware1` modules to signal successful D-Bus
publishing.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 18:52:29 +01:00
Sven Sager
4ea8d6bc9a feat: Add monitoring and automatic restart for bus provider threads
Implemented checks in `MiddlewareDaemon` to monitor the status of
`bp_middleware1` and `bp_ios1` threads. Added automatic restarts for
non-alive threads using `dbus_start`.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 18:23:55 +01:00
Sven Sager
fdaf7b3ac6 refactor: Restructure and rename bus provider modules and classes
Renamed and moved `BusProvider` and `BusProviderIo` to
`BusProviderMiddleware1` and `BusProviderIos1` respectively for better
clarity and modular organization. Updated all related imports and
references accordingly.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 18:23:01 +01:00
Sven Sager
3dbad93975 feat: Add bus_filter to dbus_stop for selective stopping
Enhanced the `dbus_stop` method in `MiddlewareDaemon` to support an
optional `bus_filter` parameter, allowing selective stopping of bus
providers. Updated imports to include `List` from `typing`.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 18:23:01 +01:00
Sven Sager
cf90b2dd55 refactor: Rename bus provider attributes for clarity
Replaced `bus_provider` and `io_bus_provider` with `bp_middleware1` and
`bp_ios1` to improve naming consistency and readability in
`MiddlewareDaemon`.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 18:23:01 +01:00
Sven Sager
4bd8fa74a9 refactor: Add helper functions for D-Bus connections and bus handling
Replaced direct D-Bus initialization with
`get_new_system_dbus_connection` and `get_new_session_dbus_connection`
helper functions. This functions will create a new connection to use
separate busses.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 17:25:51 +01:00
Sven Sager
bf5bef114c chore: Reformat with black
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 16:53:02 +01:00
Sven Sager
2c08829a13 feat(io): Replace property with method to get IOs of a device
Introduced methods for retrieving input and output object paths in the
`InterfaceDevice` class. Removed `inp` and `out` properties in favor of
these methods.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 08:59:36 +01:00
Sven Sager
ce1a25ac0e feat(io): Add EmitsChangedSignal annotations to device properties
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 08:50:02 +01:00
Sven Sager
f387b0a836 refactor(io): Rename GetIO method to GetByName in IO manager
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 08:43:11 +01:00
Sven Sager
10ad65a62c refactor(io): Update get_*_object_path to accept objects instead
Modified `get_io_object_path` and `get_device_object_path` functions to
accept full `IOBase` and `Device` objects instead of string identifiers.
All properties are available in case of changing the object path format.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 08:41:29 +01:00
Sven Sager
0e69ef432b refactor(io): Simplify InterfaceDeviceManager and device handling
Streamlined device management by introducing a dedicated `object_path`
property in `InterfaceDevice`. Refactored `InterfaceDeviceManager` to
use this property and accept a list of `InterfaceDevice` instances,
removing direct `RevPiModIO` dependencies. Updated D-Bus publishing to
reflect the new structure.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-06 08:36:39 +01:00
Sven Sager
35dbed0798 refactor(io): Rename Get method to GetIO in IOManager interface
Updated method name in D-Bus interface and backend to do not use the
same name as org.freedesktop.DBus.Properties. Som libs will map all
methods of a node to an object for direct calling. If the names are the
same, you have to filter the interface.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-05 16:23:27 +01:00
Sven Sager
1842bbd2f5 feat(io): Emit property change signals for byteorder and signedness
Added `PropertiesChanged` signals for `byteorder` and `signed` property
updates. Updated D-Bus interface annotations to specify change signal
behavior for properties. Simplified `emit_io_change` implementation.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-05 16:12:15 +01:00
Sven Sager
3d64cd5837 refactor(io): Simplify generation of io object path
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-05 16:11:32 +01:00
Sven Sager
5528f6dff4 doc(io): Update io_controller.py example file
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 16:06:48 +01:00
Sven Sager
6372ed4e7f feat(io): Add Set* (Byteorder, Signed, Value) methods to IO interface
Introduced `SetByteorder` and `SetSigned` methods in both the `Input`
and `Output` D-Bus interfaces, and added the `SetValue` method
specifically for the `Output` interface. Implemented corresponding
methods in the backend.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
710d7b2078 feat(io): Add GetByName and GetByPosition methods to DeviceManager
Introduced `GetByName` and `GetByPosition` methods in the D-Bus
interface and implementation for retrieving device object paths by name
or position. Updated `GetAllDevices` return type to `ao`.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
8ee5e0836f feat(io): Add position property to InterfaceDevice
Introduced a new `position` property with read access in the D-Bus
interface and implemented its corresponding method.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
6f1bd7f7ea refactor(io): Rename IO event methods to signal methods for clarity
Renamed `ActivateIoEvents` to `ActivateIoSignals` and
`DeactivateIoEvents` to `DeactivateIoSignals` in both the D-Bus
interface and implementation to better align with D-Bus signal
semantics.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
785569c86b fix(io): Do not read/wirte process image while device is in self-update
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
415e8502f7 fix(io): Handle large integer values with fallback to raw byte arrays
Added a fallback mechanism to handle cases where integer values exceed
valid range by using raw byte arrays (`ay`). Updated D-Bus methods and
properties to support this behavior.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
b16331cf84 feat(io): Add bitaddress property to IO interfaces
Introduced the `bitaddress` property with read-write access to `Input`
and `Output` D-Bus interfaces. Implemented corresponding property
methods.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
a2d1531e77 feat(io): Simplify IO interface hierarchy and unify property handling
Replaced specific IO interface classes (`InterfaceInpBool`,
`InterfaceInpInt`, etc.) with generic `InterfaceInput` and
`InterfaceOutput` classes to simplify the hierarchy.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-04 15:20:34 +01:00
Sven Sager
bbbbd3e0e1 fix(io): Add argument names to D-Bus methods for input/output paths
Updated `GetAllInputs` and `GetAllOutputs` methods in the D-Bus
interface to include explicit argument names (`object-path-list`) and
adjusted their types to `ao` not strings.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-03 08:54:56 +01:00
Sven Sager
a43fc764c6 doc: Add D-Bus data types documentation
Added a new `docs/dbus.md` file with an overview of standardized D-Bus
data types and their signatures. Updated `README.md` with a reference to
the documentation.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-03 08:03:37 +01:00
Sven Sager
0716169a03 feat(io): Add min_value and max_value properties to IOs
Added `min_value` and `max_value` properties to integer IOs for
determining value ranges. Updated D-Bus interface with corresponding
properties.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-03 08:03:37 +01:00
Sven Sager
77a3fbb16c feat(io): Add inp and out properties to InterfaceDeviceManager
Added `inp` and `out` properties for accessing input and output paths in
`InterfaceDeviceManager`. Updated D-Bus interface with corresponding
properties.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-02 17:06:34 +01:00
Sven Sager
037e9c05ac style(io): Reformatted with black
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-02 17:06:34 +01:00
Sven Sager
66c8c9851b refactor(io): Replace _get_io_path method with get_io_path utility
The `_get_io_path` method was removed from `InterfaceIoManager` and
replaced with the `get_io_path` utility function from `ios1_helper.py`
to reduce redundancy and improve code reusability.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-02 17:06:34 +01:00
Sven Sager
afdae78336 feat(io): Add new IO properties and corresponding methods
Added `address`, `byteorder`, and `length` properties to D-Bus
interfaces for IOs. Implemented corresponding property methods in
`ios1_helper.py`.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-02-02 17:06:33 +01:00
Sven Sager
4dd4c814b5 fix(io): Add property methods on integer IOs
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-30 13:26:21 +01:00
Sven Sager
b8b99ed3b0 feat(io): Add InterfaceDevice class for device handling via D-Bus
Introduced the `InterfaceDevice` class, enabling detailed device
property access through D-Bus. Updated `bus_provider_io` to include
device interfaces in the D-Bus provider.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-30 13:06:15 +01:00
Sven Sager
b68f1ffb36 feat(io): Add InterfaceDeviceManager to D-Bus bus provider
Integrated the InterfaceDeviceManager class into the com.revolutionpi
.ios1 D-Bus bus provider. This addition enables managing device paths
and querying all devices via D-Bus.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-30 12:29:08 +01:00
Marc Kittner
ffd04a0410 fix: Use variant_type instead of hard coded boolean
Signed-off-by: Marc Kittner <m.kittner@kunbus.com>
2026-01-30 11:26:15 +01:00
Sven Sager
549cddf594 feat(io): Integrate com.revolutionpi.ios1 bus to daemon
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-16 14:27:41 +01:00
Sven Sager
f56db7ab1c doc(io): Add IO example program
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-16 14:27:41 +01:00
Sven Sager
208b391aa9 feat(io): Add dbus policy for com.revolutionpi.ios1 bus
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-16 14:27:41 +01:00
Sven Sager
917ab7ab1f feat(io): Add dbus bus com.revolutionpi.ios1
Signed-off-by: Sven Sager <s.sager@kunbus.com>
2026-01-16 14:27:41 +01:00
Sven Sager
b4f817b477 feat(examples): Add revpi-config CLI tool for RevPi configuration
Introduced a new Python-based command-line tool `revpi-config` to manage
Revolution Pi features via D-Bus. The tool supports enabling,
disabling, checking status, and availability for various features.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-06-04 08:10:52 +02:00
Sven Sager
66046b6a9d feat(dbus): Update systemd unit state check to include 'activating'
Previously, the check only considered 'active' as a valid ActiveState.
This update ensures the system also accounts for units in the
'activating' state, improving compatibility with transitional states in
systemd services.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:54:44 +02:00
Sven Sager
9ec1e04d2b feat(dbus): Update service key for systemd-timesyncd to 'ntp'
Renamed the key 'systemd-timesyncd' to 'ntp' in the services mapping.
This improves naming consistency and aligns it with the expected service
identifier. No functional changes were introduced.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:54:14 +02:00
Sven Sager
1cb1062138 feat(dbus): Update feature key from 'dphys-swapfile' to 'swapfile'
Renamed the feature key for swapfile configuration to ensure consistency
and simplify naming.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:28:07 +02:00
Sven Sager
8d01eee66d feat(dbus): Update status change notification in feature toggle methods
Added calls to `StatusChanged` in `Disable` and `Enable` methods to
notify when a feature's state is updated. This ensures proper tracking
and external communication of feature status changes.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:28:07 +02:00
Sven Sager
40059d6068 feat(dbus): Add InterfaceSoftwareServices to bus provider initialization
This change integrates the InterfaceSoftwareServices class into the list
of interfaces initialized by the bus provider. It ensures the new
interface is properly registered and available for use, improving
system functionality and extensibility.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
2025-05-27 14:18:37 +02:00