use epics_base_rs::error::CaResult;
use epics_base_rs::server::device_support::{DeviceReadOutcome, DeviceSupport, DeviceUdf};
use epics_base_rs::server::record::Record;
use crate::records::epid::EpidRecord;
pub struct EpidSoftCallbackDeviceSupport;
impl Default for EpidSoftCallbackDeviceSupport {
fn default() -> Self {
Self::new()
}
}
impl EpidSoftCallbackDeviceSupport {
pub fn new() -> Self {
Self
}
}
impl DeviceSupport for EpidSoftCallbackDeviceSupport {
fn dtyp(&self) -> &str {
"Async Soft Channel"
}
fn read(&mut self, record: &mut dyn Record) -> CaResult<DeviceReadOutcome> {
let epid = record
.as_any_mut()
.and_then(|a| a.downcast_mut::<EpidRecord>())
.expect("EpidSoftCallbackDeviceSupport requires an EpidRecord");
super::epid_soft::EpidSoftDeviceSupport::do_pid(epid);
Ok(DeviceReadOutcome::computed(DeviceUdf::Untouched))
}
fn write(&mut self, _record: &mut dyn Record) -> CaResult<()> {
Ok(())
}
}