Skip to main content

ParamList

Struct ParamList 

Source
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

Source

pub fn new(max_addr: usize, multi_device: bool) -> Self

Source

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 asynParamAlreadyExistsparamList::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.

Source

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.

Source

pub fn find_param(&self, name: &str) -> Option<usize>

Find parameter index by name.

Source

pub fn param_name(&self, index: usize) -> Option<&str>

Get parameter name by index.

Source

pub fn param_type(&self, index: usize) -> Option<ParamType>

Get parameter type by index.

Source

pub fn get_value(&self, index: usize, addr: i32) -> AsynResult<&ParamValue>

Get the raw ParamValue.

Source

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.

Source

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.

Source

pub fn set_int32( &mut self, index: usize, addr: i32, value: i32, ) -> AsynResult<()>

Source

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.

Source

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).

Source

pub fn set_float64( &mut self, index: usize, addr: i32, value: f64, ) -> AsynResult<()>

Source

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.

Source

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).

Source

pub fn set_int64( &mut self, index: usize, addr: i32, value: i64, ) -> AsynResult<()>

Source

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.

Source

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).

Source

pub fn set_string( &mut self, index: usize, addr: i32, value: String, ) -> AsynResult<()>

Source

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.

Source

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).

Source

pub fn set_uint32( &mut self, index: usize, addr: i32, value: u32, mask: u32, interrupt_mask: u32, ) -> AsynResult<()>

Source

pub fn get_uint32_interrupt_mask( &self, index: usize, addr: i32, ) -> AsynResult<u32>

Get the UInt32Digital interrupt mask (accumulated changed bits).

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub fn get_float64_array( &self, index: usize, addr: i32, ) -> AsynResult<Arc<[f64]>>

Source

pub fn set_float64_array( &mut self, index: usize, addr: i32, data: Vec<f64>, ) -> AsynResult<()>

Source

pub fn get_int32_array(&self, index: usize, addr: i32) -> AsynResult<Arc<[i32]>>

Source

pub fn set_int32_array( &mut self, index: usize, addr: i32, data: Vec<i32>, ) -> AsynResult<()>

Source

pub fn get_int8_array(&self, index: usize, addr: i32) -> AsynResult<Arc<[i8]>>

Source

pub fn set_int8_array( &mut self, index: usize, addr: i32, data: Vec<i8>, ) -> AsynResult<()>

Source

pub fn get_int16_array(&self, index: usize, addr: i32) -> AsynResult<Arc<[i16]>>

Source

pub fn set_int16_array( &mut self, index: usize, addr: i32, data: Vec<i16>, ) -> AsynResult<()>

Source

pub fn get_int64_array(&self, index: usize, addr: i32) -> AsynResult<Arc<[i64]>>

Source

pub fn set_int64_array( &mut self, index: usize, addr: i32, data: Vec<i64>, ) -> AsynResult<()>

Source

pub fn get_float32_array( &self, index: usize, addr: i32, ) -> AsynResult<Arc<[f32]>>

Source

pub fn set_float32_array( &mut self, index: usize, addr: i32, data: Vec<f32>, ) -> AsynResult<()>

Source

pub fn get_enum( &self, index: usize, addr: i32, ) -> AsynResult<(usize, Arc<[EnumEntry]>)>

Source

pub fn set_enum_index( &mut self, index: usize, addr: i32, value: usize, ) -> AsynResult<()>

Source

pub fn set_enum_choices( &mut self, index: usize, addr: i32, choices: Arc<[EnumEntry]>, ) -> AsynResult<()>

Source

pub fn get_generic_pointer( &self, index: usize, addr: i32, ) -> AsynResult<Arc<dyn Any + Send + Sync>>

Source

pub fn set_generic_pointer( &mut self, index: usize, addr: i32, value: Arc<dyn Any + Send + Sync>, ) -> AsynResult<()>

Source

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.

Source

pub fn is_param_defined(&self, index: usize, addr: i32) -> AsynResult<bool>

Check if a parameter has been explicitly set (C parity: valueDefined).

Source

pub fn set_param_status( &mut self, index: usize, addr: i32, status: AsynStatus, alarm_status: u16, alarm_severity: u16, ) -> AsynResult<()>

Source

pub fn get_param_status( &self, index: usize, addr: i32, ) -> AsynResult<(AsynStatus, u16, u16)>

Source

pub fn set_timestamp( &mut self, index: usize, addr: i32, ts: SystemTime, ) -> AsynResult<()>

Source

pub fn get_timestamp( &self, index: usize, addr: i32, ) -> AsynResult<Option<SystemTime>>

Source

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.

Source

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.

Source

pub fn take_changed(&mut self, addr: i32) -> AsynResult<Vec<usize>>

Returns indices of parameters whose values changed since last call, then clears flags.

Source

pub fn len(&self) -> usize

Number of parameters.

Source

pub fn is_empty(&self) -> bool

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more