pub trait Controller: Send + Sync {
type Config: Send + Sync;
type Error: Error + Send + Sync + 'static;
// Required methods
fn init<'async_trait>(
config: Self::Config,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait;
fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ControllerHealth> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn capabilities(&self) -> ControllerCapabilities;
// Provided method
fn diagnostics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HashMap<String, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Base trait for all hardware controllers
Controllers manage the lifecycle and interaction with physical hardware or simulated devices. They abstract device SDKs and provide consistent interfaces for nodes to use.
Required Associated Types§
Required Methods§
Sourcefn init<'async_trait>(
config: Self::Config,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
fn init<'async_trait>(
config: Self::Config,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
Initialize the controller with the given configuration
This should perform all necessary setup including:
- Opening device connections
- Configuring device parameters
- Running initialization sequences
- Loading calibration data
Sourcefn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start the controller
Begin data acquisition, motor control, or other active operations. This may start background threads or async tasks.
Sourcefn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop the controller
Stop all active operations gracefully. The controller should still
be in a valid state and can be restarted with start().
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ControllerHealth> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ControllerHealth> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check the health status of the controller
Sourcefn capabilities(&self) -> ControllerCapabilities
fn capabilities(&self) -> ControllerCapabilities
Get the capabilities of this controller
Returns metadata about what features and operations this controller supports. This is useful for runtime capability detection.