use crate::{
CedCounters, ClearableUpdateFlags, FrlConfig, LtpRequests, SourceTestConfig, UpdateFlags,
};
pub trait ScdcClient {
type Error;
async fn read_flt_ready(&mut self) -> Result<bool, Self::Error>;
async fn read_update_flags(&mut self) -> Result<UpdateFlags, Self::Error>;
async fn clear_update_flags(&mut self, flags: ClearableUpdateFlags) -> Result<(), Self::Error>;
async fn read_ltp_requests(&mut self) -> Result<LtpRequests, Self::Error>;
async fn read_source_test_config(&mut self) -> Result<SourceTestConfig, Self::Error>;
async fn write_config_0_defaults(&mut self) -> Result<(), Self::Error>;
async fn write_frl_config(&mut self, config: FrlConfig) -> Result<(), Self::Error>;
async fn read_ced(&mut self) -> Result<CedCounters, Self::Error>;
}
pub trait SendScdcClient: Send {
type Error: Send;
fn read_flt_ready(&mut self) -> impl Future<Output = Result<bool, Self::Error>> + Send;
fn read_update_flags(
&mut self,
) -> impl Future<Output = Result<UpdateFlags, Self::Error>> + Send;
fn clear_update_flags(
&mut self,
flags: ClearableUpdateFlags,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn read_ltp_requests(
&mut self,
) -> impl Future<Output = Result<LtpRequests, Self::Error>> + Send;
fn read_source_test_config(
&mut self,
) -> impl Future<Output = Result<SourceTestConfig, Self::Error>> + Send;
fn write_config_0_defaults(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn write_frl_config(
&mut self,
config: FrlConfig,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn read_ced(&mut self) -> impl Future<Output = Result<CedCounters, Self::Error>> + Send;
}
impl<T: SendScdcClient> ScdcClient for T {
type Error = <T as SendScdcClient>::Error;
fn read_flt_ready(&mut self) -> impl Future<Output = Result<bool, Self::Error>> {
<T as SendScdcClient>::read_flt_ready(self)
}
fn read_update_flags(&mut self) -> impl Future<Output = Result<UpdateFlags, Self::Error>> {
<T as SendScdcClient>::read_update_flags(self)
}
fn clear_update_flags(
&mut self,
flags: ClearableUpdateFlags,
) -> impl Future<Output = Result<(), Self::Error>> {
<T as SendScdcClient>::clear_update_flags(self, flags)
}
fn read_ltp_requests(&mut self) -> impl Future<Output = Result<LtpRequests, Self::Error>> {
<T as SendScdcClient>::read_ltp_requests(self)
}
fn read_source_test_config(
&mut self,
) -> impl Future<Output = Result<SourceTestConfig, Self::Error>> {
<T as SendScdcClient>::read_source_test_config(self)
}
fn write_config_0_defaults(&mut self) -> impl Future<Output = Result<(), Self::Error>> {
<T as SendScdcClient>::write_config_0_defaults(self)
}
fn write_frl_config(
&mut self,
config: FrlConfig,
) -> impl Future<Output = Result<(), Self::Error>> {
<T as SendScdcClient>::write_frl_config(self, config)
}
fn read_ced(&mut self) -> impl Future<Output = Result<CedCounters, Self::Error>> {
<T as SendScdcClient>::read_ced(self)
}
}