pub struct ParamList { /* private fields */ }Expand description
Parameter library managing named parameters indexed by integer. Supports multiple addresses (addr 0..max_addr).
Implementations§
Source§impl ParamList
impl ParamList
pub fn new(max_addr: usize, multi_device: bool) -> Self
Sourcepub fn create_param(
&mut self,
name: &str,
param_type: ParamType,
) -> AsynResult<usize>
pub fn create_param( &mut self, name: &str, param_type: ParamType, ) -> AsynResult<usize>
Create a parameter. Returns its index. The parameter is created at all addresses.
Lax variant — when name already exists this returns the
existing index silently (asynSuccess). That matches the
idempotent build pattern used by ad-core-rs::ADDriverParams
and ad-plugins-rs::NDArrayDriverParams (the latter create the
shared ACQUIRE/ACQUIRE_BUSY/WAIT_FOR_PLUGINS params, then
ADDriverParams::create re-issues create_param on the same
names).
Use Self::create_param_strict when you need C parity for
asynParamAlreadyExists — paramList::createParam
(asynPortDriver/asynPortDriver.cpp:126-138) returns that
status on duplicate and the wrapper at
asynPortDriver::createParam(int list, ...) (lines 991-1011)
translates it to asynError with an ASYN_TRACE_ERROR log.
Sourcepub fn create_param_strict(
&mut self,
name: &str,
param_type: ParamType,
) -> AsynResult<usize>
pub fn create_param_strict( &mut self, name: &str, param_type: ParamType, ) -> AsynResult<usize>
Strict variant of Self::create_param — surfaces
AsynError::ParamAlreadyExists on duplicate, matching the C
asynParamAlreadyExists status returned by
paramList::createParam (asynPortDriver.cpp:126-138).
Use this from new callers that should match the C semantics.
Existing callers (ad-core-rs, ad-plugins-rs) keep using the
lax Self::create_param until they migrate; switching them
requires teaching the duplicate-name shared-base-class build
to look up the existing index instead of re-issuing
create_param.
Sourcepub fn find_param(&self, name: &str) -> Option<usize>
pub fn find_param(&self, name: &str) -> Option<usize>
Find parameter index by name.
Sourcepub fn param_name(&self, index: usize) -> Option<&str>
pub fn param_name(&self, index: usize) -> Option<&str>
Get parameter name by index.
Sourcepub fn param_type(&self, index: usize) -> Option<ParamType>
pub fn param_type(&self, index: usize) -> Option<ParamType>
Get parameter type by index.
Sourcepub fn get_value(&self, index: usize, addr: i32) -> AsynResult<&ParamValue>
pub fn get_value(&self, index: usize, addr: i32) -> AsynResult<&ParamValue>
Get the raw ParamValue.
Sourcepub fn get_int32(&self, index: usize, addr: i32) -> AsynResult<i32>
pub fn get_int32(&self, index: usize, addr: i32) -> AsynResult<i32>
Read the cached Int32 value, falling back to the type default
(0) if the parameter has not been set.
Use Self::get_int32_strict when you need C parity for
asynParamUndefined — the lax variant matches the
.unwrap_or(0) convention used throughout the workspace and
stays callable on never-set params.
Sourcepub fn get_int32_strict(&self, index: usize, addr: i32) -> AsynResult<i32>
pub fn get_int32_strict(&self, index: usize, addr: i32) -> AsynResult<i32>
Strict variant of Self::get_int32 — returns
AsynError::ParamUndefined when the entry has never been set.
C parity: paramVal::getInteger (paramVal.cpp:147-155) checks
WrongType first then NotDefined; the wrapping
paramList::getInteger (asynPortDriver.cpp:301-322) translates
ParamValNotDefined to asynParamUndefined.
pub fn set_int32( &mut self, index: usize, addr: i32, value: i32, ) -> AsynResult<()>
Sourcepub fn get_float64(&self, index: usize, addr: i32) -> AsynResult<f64>
pub fn get_float64(&self, index: usize, addr: i32) -> AsynResult<f64>
Lax variant — returns 0.0 for an undefined Float64. Use
Self::get_float64_strict for C parity.
Sourcepub fn get_float64_strict(&self, index: usize, addr: i32) -> AsynResult<f64>
pub fn get_float64_strict(&self, index: usize, addr: i32) -> AsynResult<f64>
Strict variant — returns AsynError::ParamUndefined when the
entry has never been set. C parity:
paramVal::getDouble (paramVal.cpp:258-266) +
paramList::getDouble (asynPortDriver.cpp:383-401).
pub fn set_float64( &mut self, index: usize, addr: i32, value: f64, ) -> AsynResult<()>
Sourcepub fn get_int64(&self, index: usize, addr: i32) -> AsynResult<i64>
pub fn get_int64(&self, index: usize, addr: i32) -> AsynResult<i64>
Lax variant — returns 0 for an undefined Int64. Use
Self::get_int64_strict for C parity.
Sourcepub fn get_int64_strict(&self, index: usize, addr: i32) -> AsynResult<i64>
pub fn get_int64_strict(&self, index: usize, addr: i32) -> AsynResult<i64>
Strict variant — returns AsynError::ParamUndefined when the
entry has never been set. C parity: paramVal::getInteger64
(paramVal.cpp:176-184) + paramList::getInteger64
(asynPortDriver.cpp:328-349).
pub fn set_int64( &mut self, index: usize, addr: i32, value: i64, ) -> AsynResult<()>
Sourcepub fn get_string(&self, index: usize, addr: i32) -> AsynResult<&str>
pub fn get_string(&self, index: usize, addr: i32) -> AsynResult<&str>
Lax variant — returns the empty string for an undefined Octet.
Use Self::get_string_strict for C parity.
Sourcepub fn get_string_strict(&self, index: usize, addr: i32) -> AsynResult<&str>
pub fn get_string_strict(&self, index: usize, addr: i32) -> AsynResult<&str>
Strict variant — returns AsynError::ParamUndefined when the
entry has never been set. C parity: paramVal::getString
(paramVal.cpp:283-292) + paramList::getString
(asynPortDriver.cpp:543-566).
pub fn set_string( &mut self, index: usize, addr: i32, value: String, ) -> AsynResult<()>
Sourcepub fn get_uint32(&self, index: usize, addr: i32) -> AsynResult<u32>
pub fn get_uint32(&self, index: usize, addr: i32) -> AsynResult<u32>
Lax variant — returns 0 for an undefined UInt32Digital. Use
Self::get_uint32_strict for C parity.
Sourcepub fn get_uint32_strict(&self, index: usize, addr: i32) -> AsynResult<u32>
pub fn get_uint32_strict(&self, index: usize, addr: i32) -> AsynResult<u32>
Strict variant — returns AsynError::ParamUndefined when the
entry has never been set. C parity: paramVal::getUInt32
(paramVal.cpp:215-223) + paramList::getUInt32
(asynPortDriver.cpp:355-376).
pub fn set_uint32( &mut self, index: usize, addr: i32, value: u32, mask: u32, interrupt_mask: u32, ) -> AsynResult<()>
Sourcepub fn get_uint32_interrupt_mask(
&self,
index: usize,
addr: i32,
) -> AsynResult<u32>
pub fn get_uint32_interrupt_mask( &self, index: usize, addr: i32, ) -> AsynResult<u32>
Get the UInt32Digital interrupt mask (accumulated changed bits).
Sourcepub fn take_uint32_interrupt_mask(
&mut self,
index: usize,
addr: i32,
) -> AsynResult<u32>
pub fn take_uint32_interrupt_mask( &mut self, index: usize, addr: i32, ) -> AsynResult<u32>
Read the accumulated UInt32Digital callback mask AND reset it to 0.
C parity: uint32Callback clears uInt32CallbackMask = 0
immediately after firing (asynPortDriver.cpp:855). The flush is
the single owner of this transition — it consumes the mask so the
next flush starts clean and accumulated bits do not leak forward.
A no-op returning 0 for non-UInt32 params, whose mask is always 0.
Sourcepub fn set_uint32_interrupt(
&mut self,
index: usize,
addr: i32,
mask: u32,
reason: InterruptReason,
) -> AsynResult<()>
pub fn set_uint32_interrupt( &mut self, index: usize, addr: i32, mask: u32, reason: InterruptReason, ) -> AsynResult<()>
Configure which bits of a UInt32Digital parameter should fire interrupts on transition.
C parity: paramList::setUInt32Interrupt
(asynPortDriver/asynPortDriver.cpp:480-497). The reason
argument decides which mask (rising-only, falling-only, or
both) is overwritten.
Sourcepub fn clear_uint32_interrupt(
&mut self,
index: usize,
addr: i32,
mask: u32,
) -> AsynResult<()>
pub fn clear_uint32_interrupt( &mut self, index: usize, addr: i32, mask: u32, ) -> AsynResult<()>
Clear bits from BOTH rising and falling masks for a
UInt32Digital parameter — C parity:
paramList::clearUInt32Interrupt
(asynPortDriver.cpp:504-511). The C function does not
accept an interruptReason; rising and falling masks are
always cleared together.
Sourcepub fn get_uint32_interrupt(
&self,
index: usize,
addr: i32,
reason: InterruptReason,
) -> AsynResult<u32>
pub fn get_uint32_interrupt( &self, index: usize, addr: i32, reason: InterruptReason, ) -> AsynResult<u32>
Read the configured rising / falling / combined mask.
C parity: paramList::getUInt32Interrupt
(asynPortDriver.cpp:519-535). For Both, the combined mask
is rising | falling (matching the C semantics).
pub fn get_float64_array( &self, index: usize, addr: i32, ) -> AsynResult<Arc<[f64]>>
pub fn set_float64_array( &mut self, index: usize, addr: i32, data: Vec<f64>, ) -> AsynResult<()>
pub fn get_int32_array(&self, index: usize, addr: i32) -> AsynResult<Arc<[i32]>>
pub fn set_int32_array( &mut self, index: usize, addr: i32, data: Vec<i32>, ) -> AsynResult<()>
pub fn get_int8_array(&self, index: usize, addr: i32) -> AsynResult<Arc<[i8]>>
pub fn set_int8_array( &mut self, index: usize, addr: i32, data: Vec<i8>, ) -> AsynResult<()>
pub fn get_int16_array(&self, index: usize, addr: i32) -> AsynResult<Arc<[i16]>>
pub fn set_int16_array( &mut self, index: usize, addr: i32, data: Vec<i16>, ) -> AsynResult<()>
pub fn get_int64_array(&self, index: usize, addr: i32) -> AsynResult<Arc<[i64]>>
pub fn set_int64_array( &mut self, index: usize, addr: i32, data: Vec<i64>, ) -> AsynResult<()>
pub fn get_float32_array( &self, index: usize, addr: i32, ) -> AsynResult<Arc<[f32]>>
pub fn set_float32_array( &mut self, index: usize, addr: i32, data: Vec<f32>, ) -> AsynResult<()>
pub fn get_enum( &self, index: usize, addr: i32, ) -> AsynResult<(usize, Arc<[EnumEntry]>)>
pub fn set_enum_index( &mut self, index: usize, addr: i32, value: usize, ) -> AsynResult<()>
pub fn set_enum_choices( &mut self, index: usize, addr: i32, choices: Arc<[EnumEntry]>, ) -> AsynResult<()>
pub fn get_generic_pointer( &self, index: usize, addr: i32, ) -> AsynResult<Arc<dyn Any + Send + Sync>>
pub fn set_generic_pointer( &mut self, index: usize, addr: i32, value: Arc<dyn Any + Send + Sync>, ) -> AsynResult<()>
Sourcepub fn set_value(
&mut self,
index: usize,
addr: i32,
value: ParamValue,
) -> AsynResult<()>
pub fn set_value( &mut self, index: usize, addr: i32, value: ParamValue, ) -> AsynResult<()>
Store a value of any parameter type — the single owner of the
“set a parameter from a ParamValue” dispatch.
Every caller that holds a value whose type is only known at runtime (the
port actor applying a crate::request::ParamSetValue, above all) goes
through this instead of re-enumerating the type set at the call site. The
match is exhaustive, so a new ParamValue variant is a compile error
here rather than a value that silently never reaches the store.
UInt32Digital is stored with a full write mask and no forced interrupt
bits; use Self::set_uint32 directly for C setUIntDigitalParam’s
masked set.
Sourcepub fn is_param_defined(&self, index: usize, addr: i32) -> AsynResult<bool>
pub fn is_param_defined(&self, index: usize, addr: i32) -> AsynResult<bool>
Check if a parameter has been explicitly set (C parity: valueDefined).
pub fn set_param_status( &mut self, index: usize, addr: i32, status: AsynStatus, alarm_status: u16, alarm_severity: u16, ) -> AsynResult<()>
pub fn get_param_status( &self, index: usize, addr: i32, ) -> AsynResult<(AsynStatus, u16, u16)>
pub fn set_timestamp( &mut self, index: usize, addr: i32, ts: SystemTime, ) -> AsynResult<()>
pub fn get_timestamp( &self, index: usize, addr: i32, ) -> AsynResult<Option<SystemTime>>
Sourcepub fn take_changed_single(
&mut self,
index: usize,
addr: i32,
) -> AsynResult<bool>
pub fn take_changed_single( &mut self, index: usize, addr: i32, ) -> AsynResult<bool>
Clear the changed flag for a single parameter. Returns true if it was changed.
Sourcepub fn mark_changed(&mut self, index: usize, addr: i32) -> AsynResult<()>
pub fn mark_changed(&mut self, index: usize, addr: i32) -> AsynResult<()>
Mark a parameter as changed without modifying its value. Useful for triggering I/O Intr on params whose data is served via read_*_array overrides rather than the param cache.
Sourcepub fn take_changed(&mut self, addr: i32) -> AsynResult<Vec<usize>>
pub fn take_changed(&mut self, addr: i32) -> AsynResult<Vec<usize>>
Returns indices of parameters whose values changed since last call, then clears flags.
pub fn is_empty(&self) -> bool
Sourcepub fn report(&self, out: &mut dyn Write, addr: i32)
pub fn report(&self, out: &mut dyn Write, addr: i32)
C paramList::report (asynPortDriver.cpp:885-892) — the count line, then
every parameter through ParamEntry::report.
C has one paramList per address and reports the one it was handed; here
one list holds every address, so the address is the argument. It takes no
detail level because C’s does not use it: paramVal::report prints the
same line whatever details says (paramVal.cpp:296-330), and the only
thing the level decides is how many lists are printed — which is
crate::port::PortDriverBase::report_params’s decision, and stays there.