pub struct NodeMap { /* private fields */ }Expand description
Runtime nodemap built from an XmlModel capable of reading and writing
feature values via a RegisterIo transport.
Implementations§
Source§impl NodeMap
impl NodeMap
Sourcepub fn attach_chunks(&mut self, chunks: &ChunkData)
pub fn attach_chunks(&mut self, chunks: &ChunkData)
Attach one stream buffer’s chunks, replacing any attached before.
Every register on a chunk port reads from chunks until the next
attach or NodeMap::detach_chunks; a chunk port whose ID chunks
lacks reads as GenApiError::NotAttached. Everything that depends on
a chunk port is invalidated, so nothing read from the previous buffer
survives. The chunk data is shared, not copied.
Sourcepub fn detach_chunks(&mut self)
pub fn detach_chunks(&mut self)
Detach the chunks attached by NodeMap::attach_chunks. Chunk
features then read as GenApiError::NotAttached.
Sourcepub fn attach_event(&mut self, event_id: u64, data: Bytes)
pub fn attach_event(&mut self, event_id: u64, data: Bytes)
Attach one event’s bytes to the ports whose <EventID> is event_id,
replacing the previous event with that ID.
data is the event as the device sent it, header included: event-port
addresses count from its first byte. Every corpus document that names
an event’s timestamp puts it at 0x8 on a 16-bit-block-id GigE Vision
event, where the header’s timestamp field is. Other event IDs keep
what was attached for them, as GenApi’s event model keeps the last
event of each kind.
Sourcepub fn detach_events(&mut self)
pub fn detach_events(&mut self)
Detach every event attached by NodeMap::attach_event.
Sourcepub fn ports(&self) -> Vec<(&str, PortKind)>
pub fn ports(&self) -> Vec<(&str, PortKind)>
The ports the document declares, with what each reads, in name order.
Sourcepub fn port_features(&self, port: &str) -> Vec<&str>
pub fn port_features(&self, port: &str) -> Vec<&str>
The features whose value depends on port: category members reached
from the registers on it through <pValue> chains, formulas and the
other edges NodeMap::dependents records. Sorted by name; empty for
a port nothing reads.
For FLIR’s TimestampPort that is ChunkTimestamp, an <Integer>
over the ChunkTimestamp_Val register on the port — the feature, not
the register behind it.
Source§impl NodeMap
impl NodeMap
Sourcepub fn caching_mode(&self, name: &str) -> Option<CachingMode>
pub fn caching_mode(&self, name: &str) -> Option<CachingMode>
How name’s value may be cached: its own <Cachable> — or, for a
register that declares none, the standard’s default — combined with
that of every node its value is read through. None for an unknown
name.
FLIR’s DeviceTemperature is a <Float> over a <Converter> over an
<IntReg> declared NoCache, so all three are NoCache.
Sourcepub fn polling_time(&self, name: &str) -> Option<Duration>
pub fn polling_time(&self, name: &str) -> Option<Duration>
How long name’s value may be shown before it is read again: the
shortest <PollingTime> among the node and those its value is read
through. None when nothing on the path polls, and for an unknown
name.
A viewer re-reads the features it shows at this interval. A command’s is how often to ask whether it has finished.
Sourcepub fn set_clock(&mut self, clock: Arc<dyn Clock>)
pub fn set_clock(&mut self, clock: Arc<dyn Clock>)
Measure polling times against clock rather than the system clock —
a ManualClock in a test, or the host’s clock
where there is no std::time::Instant (wasm32-unknown-unknown).
A polled value read before is treated as read at an unknown time, so it is read again. A command still running, and an enumeration whose entry is self-clearing, stay active: their polling starts again now, on the new clock.
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
The current generation: advanced by every write and every invalidation, never by a read.
Sourcepub fn changed_since(&self, since: u64) -> (Vec<String>, u64)
pub fn changed_since(&self, since: u64) -> (Vec<String>, u64)
The nodes that changed after generation since — written, or
invalidated because something they depend on was — in document order,
and the generation now, to pass next time.
A viewer keeps the generation of what it shows and re-reads the
features this names. A value the camera changes on its own appears
here once NodeMap::poll finds its polling time over, or once
something invalidates it; nothing else can know.
Sourcepub fn poll(&self) -> Vec<String>
pub fn poll(&self) -> Vec<String>
Invalidate every polled node whose polling time has passed, and
return their names with those of every node read through them, in
document order: what a viewer should read again. GenApi’s
INodeMap::Poll, measured against the node map’s clock.
A value is polled from when it was last read from the device and
reported once until it is read again; one never read is not reported.
A command is polled from its execution until NodeMap::is_done
finds it finished, an enumeration while its value is a self-clearing
entry; both are reported each time their polling time passes. The
invalidations count as changes for NodeMap::changed_since.
Source§impl NodeMap
impl NodeMap
Sourcepub fn version(&self) -> &str
pub fn version(&self) -> &str
Return the schema version string associated with the XML description.
Sourcepub fn identity(&self) -> &DocumentIdentity
pub fn identity(&self) -> &DocumentIdentity
The camera the XML describes — VendorName, ModelName — and the
version of the XML file itself (GenICam Standard v2.1.1 §2.7).
Sourcepub fn node_names(&self) -> impl Iterator<Item = &str>
pub fn node_names(&self) -> impl Iterator<Item = &str>
Return an iterator over all node names in the map, in the order the XML declares them.
Sourcepub fn selectors_of(&self, name: &str) -> Vec<&str>
pub fn selectors_of(&self, name: &str) -> Vec<&str>
The selectors that select name — every node whose <pSelected>
names it — in document order. Empty for a feature no selector selects.
Sourcepub fn dependents(&self, name: &str) -> &[String]
pub fn dependents(&self, name: &str) -> &[String]
Return the list of nodes that should be invalidated when name changes.
Returns an empty slice if the node has no dependents.
Sourcepub fn categories(&self) -> Vec<(&str, &[String])>
pub fn categories(&self) -> Vec<(&str, &[String])>
Return all category nodes as (name, children) pairs.
Sourcepub fn command_targets(&self) -> &HashSet<String>
pub fn command_targets(&self) -> &HashSet<String>
Return the names of the nodes a Node::Command executes through.
A command reaches its register through <pValue>, and the target may
delegate again through its own <pValue> — an integer’s, or an
<IntConverter>’s — or select one by index: every entry and the
default of an indexed <Integer> on the way. Every node that
NodeMap::exec_command can write along is returned, found from the
declarations rather than from node names.
None of these nodes holds a value worth displaying. Writing one
triggers an action; reading it is at best meaningless and on some
devices significant, and many declare it WO. A feature snapshot
should report them without reading them (backlog ST-21, issue #112).
Computed once, when the map is built: a feature snapshot consults it for every node.
Sourcepub fn invalidated_by(&self, name: &str) -> Vec<String>
pub fn invalidated_by(&self, name: &str) -> Vec<String>
The nodes whose value or state may change when name is written.
A write reaches the register at the end of name’s <pValue> chain
(through any entry an indexed value can select), and from there it can
move anything that depends on a node along that chain — directly or
through other nodes: a converter reading the same register, a node
whose <pMin>/<pMax>, address, pIsAvailable or pIsLocked refers
to it, a node the selector name selects, a node naming it as a
<pInvalidator>. All of them are returned, sorted, without name
itself; a viewer re-reads the ones it shows, so that writing
BalanceRatioSelector refreshes BalanceRatio (backlog ST-30).
Empty for an unknown name.
Sourcepub fn is_write_only(&self, name: &str) -> bool
pub fn is_write_only(&self, name: &str) -> bool
Whether reading name is refused because a node on its value path is
declared WO: the node itself, or one it takes its value from through
<pValue>.
The declared mode of name alone is not enough. A feature can be RW
— or declare no access mode at all — and delegate to a WO register:
GigE Vision’s ActionDeviceKey does exactly that on a Vieworks camera
in issue #112, and its read failed one hop down. Returns false for an
unknown name.
This is the static part of the answer. The node an indexed value
selects depends on its index, so whether it is write-only is a
question for the device: NodeMap::effective_access_mode answers
it, and NodeMap::feature_state and NodeMap::is_done follow it.
Sourcepub fn nodes_at_visibility(&self, level: Visibility) -> Vec<&str>
pub fn nodes_at_visibility(&self, level: Visibility) -> Vec<&str>
Return names of nodes visible at the given level or below.
A node with Visibility::Expert is visible at level Expert and Guru,
but not at Beginner.
Sourcepub fn try_from_xml(model: XmlModel) -> Result<Self, GenApiError>
pub fn try_from_xml(model: XmlModel) -> Result<Self, GenApiError>
Construct a NodeMap from an XmlModel, validating formulas.
A declaration that cannot be turned into a runtime node is dropped and
recorded in NodeMap::skipped rather than failing the whole model.
Cameras carry thousands of nodes and only a handful of them matter to
any one application; refusing to open a camera because one obscure
feature is unrepresentable serves nobody.
Sourcepub fn skipped(&self) -> &[SkippedNode]
pub fn skipped(&self) -> &[SkippedNode]
Declarations this camera has that we do not expose.
Covers both losses: a node the XML parser could not read, and one it
read but that could not be turned into a runtime node. Empty for a
document we fully understand; anything listed here is worth reporting
as a bug. viva-camctl report prints it.
Sourcepub fn ignored(&self) -> &[IgnoredElement]
pub fn ignored(&self) -> &[IgnoredElement]
Child elements of the camera’s nodes that the XML parser read past
without interpreting — viva_genapi_xml::XmlModel::ignored, kept
for a consumer that holds only the nodemap.
The nodes themselves loaded. Most of these elements are
documentation (<Extension>, a port’s <ToolTip>); one that changes
a value is worth reporting, as a skipped node is. viva-camctl report prints them.
Sourcepub fn get_integer(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<i64, GenApiError>
pub fn get_integer( &self, name: &str, io: &dyn RegisterIo, ) -> Result<i64, GenApiError>
Read an integer feature value using the provided transport.
A <Converter> evaluates in floating point; its value is rounded to
the nearest integer, as NodeMap::set_float rounds a value written
to an <IntConverter>.
Sourcepub fn set_integer(
&mut self,
name: &str,
value: i64,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_integer( &mut self, name: &str, value: i64, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write an integer feature and update dependent caches.
Sourcepub fn get_float(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<f64, GenApiError>
pub fn get_float( &self, name: &str, io: &dyn RegisterIo, ) -> Result<f64, GenApiError>
Read a floating point feature.
Sourcepub fn set_float(
&mut self,
name: &str,
value: f64,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_float( &mut self, name: &str, value: f64, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write a floating point feature using the scale/offset conversion.
Sourcepub fn get_enum(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<String, GenApiError>
pub fn get_enum( &self, name: &str, io: &dyn RegisterIo, ) -> Result<String, GenApiError>
Read an enumeration feature returning the symbolic entry name.
Sourcepub fn set_enum(
&mut self,
name: &str,
entry: &str,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_enum( &mut self, name: &str, entry: &str, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write an enumeration entry.
The entry must exist and be available now: an entry whose
pIsImplemented or pIsAvailable reads false is refused with
GenApiError::EnumEntryUnavailable and nothing is written, as
GenApi refuses it. The mvBlueFOX3-2004G accepted a write of
TestPattern=GreyHorizontalRamp, which it does not implement, read it
back, and streamed zeros.
Sourcepub fn enum_entries(&self, name: &str) -> Result<Vec<String>, GenApiError>
pub fn enum_entries(&self, name: &str) -> Result<Vec<String>, GenApiError>
List the available entry names for an enumeration feature.
In the order the XML declares them, which is the order a GUI shows, each name once.
Sourcepub fn is_implemented(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<bool, GenApiError>
pub fn is_implemented( &self, name: &str, io: &dyn RegisterIo, ) -> Result<bool, GenApiError>
Evaluate pIsImplemented for name, returning true when the feature
is implemented by the device.
Absent pIsImplemented defaults to true (matching the GenICam spec:
an undeclared predicate means “always implemented”). Evaluation errors
propagate to the caller so bad XML is visible rather than silently
reported as implemented.
Sourcepub fn is_available(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<bool, GenApiError>
pub fn is_available( &self, name: &str, io: &dyn RegisterIo, ) -> Result<bool, GenApiError>
Evaluate pIsAvailable for name.
Returns false when the feature is not implemented or when
pIsAvailable evaluates to zero.
Sourcepub fn declared_access_mode(&self, name: &str) -> Option<AccessMode>
pub fn declared_access_mode(&self, name: &str) -> Option<AccessMode>
The access mode name declares, before availability and locks.
A node that takes its value through <pValue> can do no more than the
nodes along that chain allow: an RW integer over a read-only register
cannot be written, and one over a write-only register cannot be read.
So the declared modes along the whole chain are combined: any RO on
the way removes writing, any WO removes reading. aravis takes the
mode of the linked feature instead of the node’s own; combining keeps
that and also honours a restriction the node declares itself.
An <ImposedAccessMode> anywhere on the chain is a ceiling of the
same kind: RO removes writing, WO reading, RW nothing (backlog
GA-23).
A <Converter> or <IntConverter> declares no mode of its own, so it
contributes nothing to the combination. A converter whose chain reaches
no node that declares a mode (a dangling <pValue>, or converters
naming each other) reports RO.
Returns None for an unknown name, for a node with no access mode,
such as a category, and for a chain that allows neither reading nor
writing (an RO node over a WO register).
Sourcepub fn effective_access_mode(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<AccessMode, GenApiError>
pub fn effective_access_mode( &self, name: &str, io: &dyn RegisterIo, ) -> Result<AccessMode, GenApiError>
Return the effective AccessMode for name given the current
device state.
- If the feature is unavailable (see
NodeMap::is_available), the function returnsAccessMode::RO— we cannot report “NA” without introducing a new variant, and Studio’s wire protocol carries the availability flag separately. - If
pIsLockedevaluates truthy,RWdowngrades toRO;ROandWOare unaffected. - Otherwise the statically declared access mode applies.
Sourcepub fn available_enum_entries(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<Vec<String>, GenApiError>
pub fn available_enum_entries( &self, name: &str, io: &dyn RegisterIo, ) -> Result<Vec<String>, GenApiError>
Return the subset of enum entries currently reported as available by
the device, or the full static list when no entry declares an
pIsImplemented/pIsAvailable.
Falling back to the full list preserves current behaviour for XMLs that don’t gate individual entries, so callers stop seeing the stale static list when the new predicates are added and otherwise behave as before.
Sourcepub fn get_bool(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<bool, GenApiError>
pub fn get_bool( &self, name: &str, io: &dyn RegisterIo, ) -> Result<bool, GenApiError>
Read a boolean feature.
Sourcepub fn set_bool(
&mut self,
name: &str,
value: bool,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_bool( &mut self, name: &str, value: bool, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write a boolean feature.
Sourcepub fn exec_command(
&mut self,
name: &str,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn exec_command( &mut self, name: &str, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Execute a command feature by writing its command value.
GenICam Standard v2.1.1 §2.8.8: the value — <CommandValue>, or the
node <pCommandValue> names, read now — “is written into a node which
is referenced to by a pValue element”. The command’s own guards apply
first, whichever way it reaches its register: an imposed RO, its
pIsImplemented/pIsAvailable and its pIsLocked (backlog GA-10).
Hikrobot’s UserSetSave is unavailable while Default is selected,
and the register it writes declares nothing of the kind.
Returns once the write is acknowledged. A device may still be acting on
it: poll NodeMap::is_done for completion.
Sourcepub fn is_done(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<bool, GenApiError>
pub fn is_done( &self, name: &str, io: &dyn RegisterIo, ) -> Result<bool, GenApiError>
Whether the command name has finished: GenICam’s ICommand::IsDone.
GenICam Standard v2.1.1 §2.8.8: “IsDone reads the value back and returns false as long as return value equals the command value. If the node is WriteOnly IsDone always returns true”, and it “always read the device register regardless of the state of the caches”. Applications “should always wait for the command completion by calling IsDone immediately after the Execute”, because “the state of other nodes can depend on the completion of the Command”.
So a command whose register path is write-only — a WO node along its
<pValue> chain or on the entry an indexed node on it selects now, or
an <ImposedAccessMode>WO on the command itself — is done at once, and
nothing is read. Otherwise the register is read from the device, past
every cache on that path, and compared with the command value.
When it differs, the command has finished and everything depending on
it is invalidated, so values read while it ran are read again.
A direct-address command (a <Command> with its own <Address>, an
extension no vendor document uses) declares no access mode and is
treated as write-only.
Sourcepub fn register_address(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<(u64, u32), GenApiError>
pub fn register_address( &self, name: &str, io: &dyn RegisterIo, ) -> Result<(u64, u32), GenApiError>
Resolve the device register address and length backing a feature.
This is the addressing half of typed feature access, exposed for
callers that need raw register I/O through RegisterIo — a
file-transfer buffer, for instance, whose address the XML supplies
through <pAddress> and which no typed accessor covers. Address
terms and <pIndex> scaling resolve exactly as they do for
get_integer and friends, so a caller does not have to reimplement
GenICam addressing.
Returns GenApiError::Type for a node that has no addressing of its
own because it delegates through <pValue>, and
GenApiError::NotDeviceMemory for a register on a chunk or event
port: its address counts from the start of a chunk or an event, and
handing it out as a device address is how such registers ended up
reading device memory (GA-12).
Sourcepub fn invalidate(&self, name: &str)
pub fn invalidate(&self, name: &str)
Forget name’s cached value — and that of every node it takes its
value from through <pValue> or an indexed value’s entries, which is
where a register reading is held — and those of the nodes that depend
on it, so the next read asks the device.
For a value the device changes in a way its XML does not describe — a
timestamp a latch command fills, with nothing linking the two. A value
the XML declares NoCache needs none of this, and one with a
<PollingTime> is read again once that has passed (ADR-0029). Every
timestamp in the vendor corpus is an Integer over an IntReg, so
clearing the front node alone would change nothing (Codex review of
#187). The invalidation is a change for NodeMap::changed_since.
Sourcepub fn invalidate_all(&self)
pub fn invalidate_all(&self)
Forget every cached value: for a command known to change the
device’s state wholesale, such as UserSetLoad, on a camera whose XML
does not say which features it changes. What the host itself holds —
a floating <Integer> or <Boolean> — is kept.
Sourcepub fn get_converter(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<f64, GenApiError>
pub fn get_converter( &self, name: &str, io: &dyn RegisterIo, ) -> Result<f64, GenApiError>
Read a Converter feature value (float) using the provided transport.
Sourcepub fn get_int_converter(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<i64, GenApiError>
pub fn get_int_converter( &self, name: &str, io: &dyn RegisterIo, ) -> Result<i64, GenApiError>
Read an IntConverter feature value (integer) using the provided transport.
Sourcepub fn set_converter(
&mut self,
name: &str,
value: f64,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_converter( &mut self, name: &str, value: f64, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write a Converter feature value (float) through its <FormulaTo>.
Sourcepub fn set_int_converter(
&mut self,
name: &str,
value: i64,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_int_converter( &mut self, name: &str, value: i64, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write an IntConverter feature value through its <FormulaTo>.
Sourcepub fn get_string(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<String, GenApiError>
pub fn get_string( &self, name: &str, io: &dyn RegisterIo, ) -> Result<String, GenApiError>
Read a String feature value using the provided transport.
A <StringReg> reads its register up to the first NUL. A <String>
reads the node its <pValue> names, or holds its <Value> and
whatever was last written to it.
Sourcepub fn set_string(
&mut self,
name: &str,
value: &str,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_string( &mut self, name: &str, value: &str, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write a String feature value using the provided transport.
Sourcepub fn get_register(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<Vec<u8>, GenApiError>
pub fn get_register( &self, name: &str, io: &dyn RegisterIo, ) -> Result<Vec<u8>, GenApiError>
Read a <Register> node’s bytes using the provided transport.
Returns the full declared length. For a large block — the Micro-Epsilon
scanCONTROL declares FileAccessBuffer as 100 000 bytes — that is
hundreds of chunked reads; use NodeMap::register_address and the
transport directly when a partial read is what you want.
Sourcepub fn set_register(
&mut self,
name: &str,
data: &[u8],
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_register( &mut self, name: &str, data: &[u8], io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write a <Register> node’s bytes using the provided transport.
data must be exactly the declared length. Unlike NodeMap::set_string,
which pads with NULs, a short slice is refused: zero-padding a
file-transfer buffer to 100 000 bytes because the caller supplied 12 is
data loss, not a convenience.
Source§impl NodeMap
impl NodeMap
Sourcepub fn persistence_plan(&self) -> PersistencePlan
pub fn persistence_plan(&self) -> PersistencePlan
Which features a configuration holds, under which selectors, and the order a restore writes them in — decided from the XML alone.
The features are those the XML marks <Streamable>Yes</Streamable>,
except categories and commands, which have no value. A feature is
written after every feature in the plan whose write can change it —
whatever the dependency graph links from the nodes the first is
written through to the second: a <pSelected>, a pIsAvailable or
pIsLocked provider, a <pMin>/<pMax>, an address, a
<pInvalidator>. Features that depend on one another in a cycle keep
document order between them, and otherwise the plan follows document
order too.
Sourcepub fn save_configuration(&mut self, io: &dyn RegisterIo) -> Configuration
pub fn save_configuration(&mut self, io: &dyn RegisterIo) -> Configuration
Read every streamable feature from the device: each selected one under every entry of its selectors, which are put back afterwards.
A selector selects only while it can be set: one that is not
implemented, not available, locked or read-only now leaves the
feature a single value, which is saved once, without that selector.
The mvBlueFOX3-2004G does not implement ExposureTimeSelector, and
ExposureTime used to be left out of every save for it (ADR-0028,
amendment of 2026-10-13).
A feature is left out, with the reason in Configuration::omitted,
when it cannot be both read and written — declared read-only or
write-only — or when, now, it is not implemented, not available,
locked, or its read fails. A locked feature would not be written on
restore either: what locks it (ExposureAuto for ExposureTime) is
saved and restored first. One that TLParamsLocked locks is left out
while the camera acquires, so save while it does not.
Sourcepub fn load_configuration(
&mut self,
configuration: &Configuration,
io: &dyn RegisterIo,
) -> LoadReport
pub fn load_configuration( &mut self, configuration: &Configuration, io: &dyn RegisterIo, ) -> LoadReport
Write a configuration back to the device.
Values are written in the plan’s order, whatever their order in
configuration: a feature after the selectors, availability and lock
providers and bounds it depends on. A value saved under selectors is
written with each selector set to its entry, and the selectors are put
back afterwards. A file of plain lines that sets a selector on one line
and a selected feature on the next — a replay of writes, as some tools
save — binds each such value to the selector line before it.
A write that fails is tried once more after all the others, for the
failures that are only a matter of order: Width and OffsetX bound
each other, so one of the two may have to wait. Whatever still fails
is in LoadReport::failures with its reason, in the configuration’s
order; nothing stops the load early. A configuration saved from
another camera model, or another major version of its XML, is loaded
all the same, with a warning in LoadReport::warnings.
TLParamsLocked is not touched: the standard does not ask for it, and
a camera that acquires reports the features it locks as failures.
Source§impl NodeMap
impl NodeMap
Sourcepub fn feature_state(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<FeatureState, GenApiError>
pub fn feature_state( &self, name: &str, io: &dyn RegisterIo, ) -> Result<FeatureState, GenApiError>
Read everything a viewer needs about name from the device: its value,
what it permits now, whether it is implemented and available, its
range, the enumeration entries it accepts, and its unit.
Only a node that has a value is read. A write-only node refuses the
read — locally, or with the device’s ACCESS_DENIED — and a node a
command writes through holds a trigger, not a value; some devices even
treat reading one as significant (issues #112, #135). Both are reported
with FeatureValue::None and their access mode, so a viewer still
offers the write or the execute.
A feature that is not implemented, or not available now, is not read
either — not its value, its <pMin>/<pMax> or its entries’
predicates. GenApi forbids value access on such a node, and cameras
commonly refuse to read the register behind it. It is reported with
FeatureValue::None, its static range and its declared entries.
A predicate that cannot be evaluated — its register refused, its link
down — is not satisfied, and is logged: an unread pIsImplemented
reports the feature not implemented, an unread pIsAvailable not
available, an unread pIsLocked locked (backlog GA-58: an Allied Vision
Manta G-125B refuses the inquiry register of the lens control it does
not have). A failed value read is an error.
Source§impl NodeMap
impl NodeMap
Sourcepub fn get_text(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<String, GenApiError>
pub fn get_text( &self, name: &str, io: &dyn RegisterIo, ) -> Result<String, GenApiError>
Read a feature as text, formatted by its type: an integer in decimal,
a float in the shortest form that reads back to the same value, an
enumeration as its entry’s name, a boolean as true or false.
A category has no value and a command none to read: both are errors.
So is a <Register>, a byte array with no declared interpretation;
read it with NodeMap::get_register.
Sourcepub fn set_text(
&mut self,
name: &str,
text: &str,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_text( &mut self, name: &str, text: &str, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write a feature from text, parsed by its type: the counterpart of
NodeMap::get_text. An integer is decimal or 0x-prefixed
hexadecimal; a boolean is true/false or 1/0.
Text that does not parse as the feature’s type is
GenApiError::InvalidText, and nothing is written. A command is
executed, never set, and a category has nothing to set: both are
errors.