1010//
1111// You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
1212
13+ //! DBus proxy for the fpgad control interface.
14+ //!
15+ //! This module provides the auto-generated DBus proxy for the `com.canonical.fpgad.control`
16+ //! interface, which handles all write operations to the FPGA subsystem including:
17+ //! - Loading FPGA bitstreams
18+ //! - Applying device tree overlays
19+ //! - Removing overlays
20+ //! - Writing to FPGA manager properties
21+ //! - Setting FPGA flags
22+ //!
23+ //! The proxy is generated using the `zbus` crate's `#[proxy]` macro and provides
24+ //! type-safe, asynchronous access to the daemon's control interface.
25+ //!
26+ //! # DBus Interface Details
27+ //!
28+ //! - **Service**: `com.canonical.fpgad`
29+ //! - **Interface**: `com.canonical.fpgad.control`
30+ //! - **Object Path**: `/com/canonical/fpgad/control`
31+ //!
32+ //! # Usage
33+ //!
34+ //! ```rust,no_run
35+ //! use zbus::Connection;
36+ //! use control_proxy::ControlProxy;
37+ //!
38+ //! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
39+ //! let connection = Connection::system().await?;
40+ //! let proxy = ControlProxy::new(&connection).await?;
41+ //! let result = proxy.write_bitstream_direct(
42+ //! "",
43+ //! "fpga0",
44+ //! "/lib/firmware/design.bit.bin",
45+ //! ""
46+ //! ).await?;
47+ //! # Ok(())
48+ //! # }
49+ //! ```
50+ //!
51+ //! For detailed method documentation, see the daemon's
52+ //! [control interface documentation](../../../../daemon/comm/dbus/control_interface/index.html).
53+
1354use zbus:: { Result , proxy} ;
55+
56+ /// DBus proxy trait for the fpgad control interface.
57+ ///
58+ /// This trait is auto-generated by the `#[proxy]` macro and provides methods to invoke
59+ /// the control interface methods on the fpgad daemon. All methods return `Result<String>`
60+ /// containing success messages or FpgadError messages.
61+ ///
62+ /// See the main [module documentation](index.html) for usage examples.
1463#[ proxy(
1564 default_service = "com.canonical.fpgad" ,
1665 interface = "com.canonical.fpgad.control" ,
1766 default_path = "/com/canonical/fpgad/control"
1867) ]
1968pub trait Control {
69+ /// Set FPGA programming flags for a device.
70+ ///
71+ /// # Arguments
72+ ///
73+ /// * `platform_string` - Platform identifier (can be empty for auto-detection)
74+ /// * `device_handle` - [Device handle](../../index.html#device-handles) (e.g., "fpga0")
75+ /// * `flags` - Programming flags as a 32-bit unsigned integer
76+ ///
77+ /// # Returns: `Result<String>`
78+ /// * `Ok(String)` - Success message with confirmation of flags set
79+ /// * `Err(zbus::Error)` - DBus error or FpgadError.
80+ /// See [Error Handling](../../index.html#error-handling)
2081 async fn set_fpga_flags (
2182 & self ,
2283 platform_string : & str ,
2384 device_handle : & str ,
2485 flags : u32 ,
2586 ) -> Result < String > ;
2687
88+ /// Write a bitstream directly to an FPGA device.
89+ ///
90+ /// # Arguments
91+ ///
92+ /// * `platform_string` - Platform identifier (can be empty for auto-detection)
93+ /// * `device_handle` - [Device handle](../../index.html#device-handles) (e.g., "fpga0")
94+ /// * `bitstream_path_str` - Absolute path to the bitstream file
95+ /// * `firmware_lookup_path` - Optional firmware search path (empty for default)
96+ ///
97+ /// # Returns: `Result<String>`
98+ /// * `Ok(String)` - Success message confirming bitstream loaded
99+ /// * `Err(zbus::Error)` - DBus error or FpgadError.
100+ /// See [Error Handling](../../index.html#error-handling)
27101 async fn write_bitstream_direct (
28102 & self ,
29103 platform_string : & str ,
@@ -32,6 +106,19 @@ pub trait Control {
32106 firmware_lookup_path : & str ,
33107 ) -> Result < String > ;
34108
109+ /// Apply a device tree overlay to the system.
110+ ///
111+ /// # Arguments
112+ ///
113+ /// * `platform_string` - Platform identifier string
114+ /// * `overlay_handle` - [Overlay handle](../../index.html#overlay-handles) for the overlay directory
115+ /// * `overlay_source_path` - Absolute path to the overlay file (.dtbo)
116+ /// * `firmware_lookup_path` - Optional firmware search path (empty for default)
117+ ///
118+ /// # Returns: `Result<String>`
119+ /// * `Ok(String)` - Success message confirming overlay applied
120+ /// * `Err(zbus::Error)` - DBus error or FpgadError.
121+ /// See [Error Handling](../../index.html#error-handling)
35122 async fn apply_overlay (
36123 & self ,
37124 platform_string : & str ,
@@ -40,8 +127,42 @@ pub trait Control {
40127 firmware_lookup_path : & str ,
41128 ) -> Result < String > ;
42129
130+ /// Remove a device tree overlay from the system.
131+ ///
132+ /// # Arguments
133+ ///
134+ /// * `platform_str` - Platform identifier string
135+ /// * `overlay_handle` - [Overlay handle](../../index.html#overlay-handles) to remove
136+ ///
137+ /// # Returns: `Result<String>`
138+ /// * `Ok(String)` - Success message confirming overlay removed
139+ /// * `Err(zbus::Error)` - DBus error or FpgadError.
140+ /// See [Error Handling](../../index.html#error-handling)
43141 async fn remove_overlay ( & self , platform_str : & str , overlay_handle : & str ) -> Result < String > ;
44142
143+ /// Write a string value to an FPGA manager property.
144+ ///
145+ /// # Arguments
146+ ///
147+ /// * `property_path_str` - Full sysfs path to the property (must be under `/sys/class/fpga_manager/`)
148+ /// * `data` - String data to write
149+ ///
150+ /// # Returns: `Result<String>`
151+ /// * `Ok(String)` - Success message confirming write
152+ /// * `Err(zbus::Error)` - DBus error or FpgadError.
153+ /// See [Error Handling](../../index.html#error-handling)
45154 async fn write_property ( & self , property_path_str : & str , data : & str ) -> Result < String > ;
155+
156+ /// Write binary data to an FPGA manager property.
157+ ///
158+ /// # Arguments
159+ ///
160+ /// * `property_path_str` - Full sysfs path to the property (must be under `/sys/class/fpga_manager/`)
161+ /// * `data` - Binary data to write as a byte slice
162+ ///
163+ /// # Returns: `Result<String>`
164+ /// * `Ok(String)` - Success message confirming write
165+ /// * `Err(zbus::Error)` - DBus error or FpgadError.
166+ /// See [Error Handling](../../index.html#error-handling)
46167 async fn write_property_bytes ( & self , property_path_str : & str , data : & [ u8 ] ) -> Result < String > ;
47168}
0 commit comments