implemented generic linux sal with heuristics
This commit is contained in:
@@ -48,7 +48,7 @@ impl<T: PreflightAuditor + ?Sized> PreflightAuditor for Arc<T> {
|
||||
}
|
||||
|
||||
/// Suppresses conflicting daemons (tlp, thermald).
|
||||
pub trait EnvironmentGuard {
|
||||
pub trait EnvironmentGuard: Send + Sync {
|
||||
fn suppress(&mut self) -> Result<()>;
|
||||
fn restore(&mut self) -> Result<()>;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ impl<T: SensorBus + ?Sized> SensorBus for Arc<T> {
|
||||
}
|
||||
|
||||
/// Write-only interface for hardware commands.
|
||||
pub trait ActuatorBus {
|
||||
pub trait ActuatorBus: Send + Sync {
|
||||
fn set_fan_mode(&self, mode: &str) -> Result<()>;
|
||||
fn set_sustained_power_limit(&self, watts: f32) -> Result<()>;
|
||||
fn set_burst_power_limit(&self, watts: f32) -> Result<()>;
|
||||
@@ -96,7 +96,7 @@ impl<T: ActuatorBus + ?Sized> ActuatorBus for Arc<T> {
|
||||
}
|
||||
|
||||
/// Concurrent monitor for catastrophic states.
|
||||
pub trait HardwareWatchdog {
|
||||
pub trait HardwareWatchdog: Send + Sync {
|
||||
fn check_emergency(&self) -> Result<bool>;
|
||||
}
|
||||
|
||||
@@ -105,3 +105,8 @@ impl<T: HardwareWatchdog + ?Sized> HardwareWatchdog for Arc<T> {
|
||||
(**self).check_emergency()
|
||||
}
|
||||
}
|
||||
|
||||
/// Aggregate trait for a complete platform implementation.
|
||||
pub trait PlatformSal: PreflightAuditor + SensorBus + ActuatorBus + EnvironmentGuard + HardwareWatchdog {}
|
||||
|
||||
impl<T: PreflightAuditor + SensorBus + ActuatorBus + EnvironmentGuard + HardwareWatchdog + ?Sized> PlatformSal for T {}
|
||||
|
||||
Reference in New Issue
Block a user