pub struct StatusInterface {}Expand description
Instance of a zbus::object_server::Interface constructed using the zbus::interface macro.
Implementations§
Source§impl StatusInterface
See crate::comm::dbus for a summary of this interface’s methods, or
crate::comm::dbus::status_interface for a summary of this interface in general.
impl StatusInterface
See crate::comm::dbus for a summary of this interface’s methods, or crate::comm::dbus::status_interface for a summary of this interface in general.
Sourceasync fn get_status_message(
&self,
platform_string: &str,
) -> Result<String, Error>
async fn get_status_message( &self, platform_string: &str, ) -> Result<String, Error>
Get a human-readable status message for all FPGA devices on the platform.
Returns a formatted status string whose content is platform-specific.
§Arguments
platform_string: Platform compatibility string (must not be empty).
§Returns: Result<String, fdo::Error>
Ok(String)– Platform-specific status message.Err(fdo::Error)ifplatform_stringis empty or the platform cannot be determined.
§Examples
let msg = status_interface.get_status_message("xlnx-sys").await?;
println!("{msg}");Sourceasync fn get_fpga_state(
&self,
platform_string: &str,
device_handle: &str,
) -> Result<String, Error>
async fn get_fpga_state( &self, platform_string: &str, device_handle: &str, ) -> Result<String, Error>
The device handle (e.g., fpga0) of the FPGA.
§Arguments
platform_string: Platform compatibility string.device_handle: The device handle (e.g.,fpga0) of the FPGA.
§Returns: Result<String, fdo::Error>
Ok(String)– the current FPGA state (e.g.,"operating","unknown").Err(fdo::Error)if the device handle is invalid or the platform cannot be determined.
§Examples
let state = status_interface.get_fpga_state("xlnx,zynqmp-pcap-fpga", "fpga0").await?;
assert_eq!(state, "operating");Sourcepub async fn get_overlay_status(
&self,
platform_string: &str,
overlay_handle: &str,
) -> Result<String, Error>
pub async fn get_overlay_status( &self, platform_string: &str, overlay_handle: &str, ) -> Result<String, Error>
Retrieve the status of a specific device-tree overlay.
§Arguments
platform_string: Platform compatibility string.overlay_handle: The handle (name) of the device-tree overlay to query.
§Returns: Result<String, fdo::Error>
Ok(String)– Status of the overlay (e.g.,"loaded","unapplied").Err(fdo::Error)If the overlay handle is empty or not found.
§Examples
let status = status_interface.get_overlay_status(
"xlnx,zynqmp-pcap-fpga",
"my_overlay"
).await?;
assert_eq!(status, "applied");Sourceasync fn get_overlays(&self) -> Result<String, Error>
async fn get_overlays(&self) -> Result<String, Error>
Retrieve a list of all available device-tree overlay handles (names of the device-tree overlay directories present on the system)
§Returns: Result<String, fdo::Error>
Ok(String)– List of existing overlay handles, separated by newline (\n).Err(fdo::Error)-FpgadError::IOReadDirif dir cannot be read
§Examples
let overlays = status_interface.get_overlays().await?;§Example Ok(String) values
§no overlays present:
assert_eq!(overlays, "");§One overlay present:
assert_eq!(overlays, "my_overlay");§Multiple overlays present:
assert_eq!(overlays, "my_overlay1\nmy_overlay2\n...\nmy_overlayN");Sourceasync fn get_platform_type(&self, device_handle: &str) -> Result<String, Error>
async fn get_platform_type(&self, device_handle: &str) -> Result<String, Error>
Get the compatibility string for a single FPGA device.
§Arguments
device_handle: FPGA device handle.
§Returns: Result<String, Error>
Ok(String)– Device’s platform compatibility string.Err(fdo::Error)if device validation or reading the compatible string fails.
§Examples
let platform_string = status_interface.get_platform_type("fpga0").await?;
assert_eq!(platform_string, "xlnx,zynqmp-pcap-fpga");Sourceasync fn get_platform_types(&self) -> Result<String, Error>
async fn get_platform_types(&self) -> Result<String, Error>
Get a list of all FPGA devices and their platform types.
§Returns: Result<String, Error>
Ok(String)– Each line formatted as<device_handle>:<platform_string>\n. Devices without a valid string appear as<device_handle>:\n.Err(fdo::Error)if reading FPGA managers directory or compatible strings fails.
§Examples
let platform_map = status_interface.get_platform_types().await?;If only one device:
assert_eq!(platform_map, "fpga0:xlnx,zynqmp-pcap-fpga\n");or for multiple devices
assert_eq!(platform_map, "fpga0:xlnx,zynqmp-pcap-fpga\nfpga1:xlnx,versal-fpga\n");Sourceasync fn xlnx_sys(&self, sub_cmd: &str, path_str: &str) -> Result<String, Error>
async fn xlnx_sys(&self, sub_cmd: &str, path_str: &str) -> Result<String, Error>
Entrypoint for xilinx_sys platform specific operations.
§Arguments
sub_cmd- The read operation to perform - seecrate::platforms::xilinx_sys::ReadSubCommandpath_str- Device handle or full sysfs path to flags forread_flags(e.g.fpga0or/sys/class/fpga_manager/fpga0/flags), or sysfs property path forread_property.
§Returns: Result<String, fdo::Error>
Ok(String)– The property value or flags as a string.Err(fdo::Error)– If thesub_cmdis unrecognised or the path is invalid / outside the allowed directory.
§Examples
// Read the FPGA manager name
let name = status_interface
.xlnx_sys("read_property", "/sys/class/fpga_manager/fpga0/name")
.await?;
// Read the current programming flags for fpga0
let flags = status_interface
.xlnx_sys("read_flags", "fpga0")
.await?;Trait Implementations§
Source§impl Interface for StatusInterface
impl Interface for StatusInterface
Source§fn name() -> InterfaceName<'static>
fn name() -> InterfaceName<'static>
Return the name of the interface.
Source§fn spawn_tasks_for_methods(&self) -> bool
fn spawn_tasks_for_methods(&self) -> bool
Whether each method call will be handled from a different spawned task.
Source§fn get<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'async_trait>(
&'life0 self,
__zbus__property_name: &'life1 str,
__zbus__object_server: &'life2 ObjectServer,
__zbus__connection: &'life3 Connection,
__zbus__header: Option<&'life4 Header<'life5>>,
__zbus__signal_emitter: &'life6 SignalEmitter<'life7>,
) -> Pin<Box<dyn Future<Output = Option<Result<OwnedValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
'life7: 'async_trait,
fn get<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'async_trait>(
&'life0 self,
__zbus__property_name: &'life1 str,
__zbus__object_server: &'life2 ObjectServer,
__zbus__connection: &'life3 Connection,
__zbus__header: Option<&'life4 Header<'life5>>,
__zbus__signal_emitter: &'life6 SignalEmitter<'life7>,
) -> Pin<Box<dyn Future<Output = Option<Result<OwnedValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
'life7: 'async_trait,
Get a property value. Returns None if the property doesn’t exist.
Source§fn get_all<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
&'life0 self,
__zbus__object_server: &'life1 ObjectServer,
__zbus__connection: &'life2 Connection,
__zbus__header: Option<&'life3 Header<'life4>>,
__zbus__signal_emitter: &'life5 SignalEmitter<'life6>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, OwnedValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
fn get_all<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
&'life0 self,
__zbus__object_server: &'life1 ObjectServer,
__zbus__connection: &'life2 Connection,
__zbus__header: Option<&'life3 Header<'life4>>,
__zbus__signal_emitter: &'life5 SignalEmitter<'life6>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, OwnedValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
Return all the properties.
Source§fn set<'call>(
&'call self,
__zbus__property_name: &'call str,
value: &'call Value<'_>,
__zbus__object_server: &'call ObjectServer,
__zbus__connection: &'call Connection,
__zbus__header: Option<&'call Header<'_>>,
__zbus__signal_emitter: &'call SignalEmitter<'_>,
) -> DispatchResult2<'call>
fn set<'call>( &'call self, __zbus__property_name: &'call str, value: &'call Value<'_>, __zbus__object_server: &'call ObjectServer, __zbus__connection: &'call Connection, __zbus__header: Option<&'call Header<'_>>, __zbus__signal_emitter: &'call SignalEmitter<'_>, ) -> DispatchResult2<'call>
Set a property value (&self).
Source§fn set_mut<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'life8, 'life9, 'async_trait>(
&'life0 mut self,
__zbus__property_name: &'life1 str,
value: &'life2 Value<'life3>,
__zbus__object_server: &'life4 ObjectServer,
__zbus__connection: &'life5 Connection,
__zbus__header: Option<&'life6 Header<'life7>>,
__zbus__signal_emitter: &'life8 SignalEmitter<'life9>,
) -> Pin<Box<dyn Future<Output = Option<Result<()>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
'life7: 'async_trait,
'life8: 'async_trait,
'life9: 'async_trait,
fn set_mut<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'life8, 'life9, 'async_trait>(
&'life0 mut self,
__zbus__property_name: &'life1 str,
value: &'life2 Value<'life3>,
__zbus__object_server: &'life4 ObjectServer,
__zbus__connection: &'life5 Connection,
__zbus__header: Option<&'life6 Header<'life7>>,
__zbus__signal_emitter: &'life8 SignalEmitter<'life9>,
) -> Pin<Box<dyn Future<Output = Option<Result<()>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
'life7: 'async_trait,
'life8: 'async_trait,
'life9: 'async_trait,
Set a property value (&mut self). Invoked when set returns RequiresMut.
Source§fn call<'call>(
&'call self,
__zbus__object_server: &'call ObjectServer,
__zbus__connection: &'call Connection,
__zbus__message: &'call Message,
name: MemberName<'call>,
) -> DispatchResult2<'call>
fn call<'call>( &'call self, __zbus__object_server: &'call ObjectServer, __zbus__connection: &'call Connection, __zbus__message: &'call Message, name: MemberName<'call>, ) -> DispatchResult2<'call>
Call a method (&self).
Source§fn call_mut<'call>(
&'call mut self,
__zbus__object_server: &'call ObjectServer,
__zbus__connection: &'call Connection,
__zbus__message: &'call Message,
name: MemberName<'call>,
) -> DispatchResult2<'call>
fn call_mut<'call>( &'call mut self, __zbus__object_server: &'call ObjectServer, __zbus__connection: &'call Connection, __zbus__message: &'call Message, name: MemberName<'call>, ) -> DispatchResult2<'call>
Call a method (&mut self). Invoked when call returns RequiresMut.
Source§fn introspect_to_writer(&self, writer: &mut dyn Write, level: usize)
fn introspect_to_writer(&self, writer: &mut dyn Write, level: usize)
Write introspection XML to the writer, with the given indentation level.