pub struct Camera<T: RegisterIo> { /* private fields */ }Expand description
Camera facade combining a nodemap with a transport implementing RegisterIo.
Implementations§
Source§impl<T: RegisterIo> Camera<T>
impl<T: RegisterIo> Camera<T>
Sourcepub fn restore_events(
&mut self,
saved: EventConfiguration,
) -> EventRestoreReport
pub fn restore_events( &mut self, saved: EventConfiguration, ) -> EventRestoreReport
Restore event settings from this same camera session, best-effort.
No writes occur for a different camera, a monitor, lost/released control, or a disconnected USB transport. The transport also checks ownership on every write, so a refusal stops later writes as soon as loss is known. This is blocking register I/O; call on a blocking thread.
Source§impl Camera<GigeRegisterIo>
impl Camera<GigeRegisterIo>
Sourcepub async fn configure_events_restorable(
&mut self,
local_ip: Ipv4Addr,
port: u16,
selectors: &[&str],
) -> Result<EventConfiguration, EventSetupError>
pub async fn configure_events_restorable( &mut self, local_ip: Ipv4Addr, port: u16, selectors: &[&str], ) -> Result<EventConfiguration, EventSetupError>
Configure event notification with an explicit restoration token.
Bind Self::open_event_stream first (port 0 is supported), then use
its actual port here. Requested event choices are validated before
message-channel writes. A setup error includes rollback results.
No configuration is automatically replayed on a replacement camera.
Source§impl<T: UsbTransfer + 'static> Camera<U3vRegisterIo<T>>
impl<T: UsbTransfer + 'static> Camera<U3vRegisterIo<T>>
Sourcepub fn configure_events_restorable(
&mut self,
selectors: &[&str],
) -> Result<EventConfiguration, EventSetupError>
pub fn configure_events_restorable( &mut self, selectors: &[&str], ) -> Result<EventConfiguration, EventSetupError>
Enable named USB3 Vision events, retaining only changed settings for explicit restoration. Open the event reader separately; it preserves the EventEnable word it found when opened.
Source§impl<T: RegisterIo> Camera<T>
The helpers for standard features. Each looks its feature up by the
names cameras declare it under (StandardFeature::names), in that
order, and takes the first of a kind it can drive; one the camera has
under none of them is GenicamError::MissingFeature, naming them all.
impl<T: RegisterIo> Camera<T>
The helpers for standard features. Each looks its feature up by the
names cameras declare it under (StandardFeature::names), in that
order, and takes the first of a kind it can drive; one the camera has
under none of them is GenicamError::MissingFeature, naming them all.
The lookup is by declaration: a feature declared but not implemented on this device reports so when it is used, rather than being skipped for the next name.
Sourcepub fn resolve(
&self,
feature: StandardFeature,
) -> Result<ResolvedFeature, GenicamError>
pub fn resolve( &self, feature: StandardFeature, ) -> Result<ResolvedFeature, GenicamError>
Find the node feature goes by on this camera.
Sourcepub fn exposure_time(&self) -> Result<f64, GenicamError>
pub fn exposure_time(&self) -> Result<f64, GenicamError>
The exposure time, in the unit of the feature that holds it:
microseconds for ExposureTime and ExposureTimeAbs, the device’s
own for ExposureTimeRaw (StandardFeature::ExposureTime says
which this camera has, and its declared unit).
Sourcepub fn set_exposure_time(
&mut self,
value: f64,
) -> Result<ResolvedFeature, GenicamError>
pub fn set_exposure_time( &mut self, value: f64, ) -> Result<ResolvedFeature, GenicamError>
Write the exposure time, in the unit of the feature that holds it —
rounded to the nearest integer for ExposureTimeRaw — and say which
feature that was.
Sourcepub fn gain(&self) -> Result<f64, GenicamError>
pub fn gain(&self) -> Result<f64, GenicamError>
The gain of the selected gain control, in the unit of the feature
that holds it: decibels for SFNC’s Gain, the device’s own for
GainRaw.
Sourcepub fn set_gain(&mut self, value: f64) -> Result<ResolvedFeature, GenicamError>
pub fn set_gain(&mut self, value: f64) -> Result<ResolvedFeature, GenicamError>
Write the gain of the selected gain control (Camera::select_gain),
in the unit of the feature that holds it — rounded to the nearest
integer for an integer GainRaw — and say which feature that was.
Sourcepub fn gain_selectors(&self) -> Result<Vec<String>, GenicamError>
pub fn gain_selectors(&self) -> Result<Vec<String>, GenicamError>
The gain controls GainSelector offers, such as All or Tap1, in
the XML’s order. 26 of the 38 vendor-corpus documents declare one.
Sourcepub fn select_gain(&mut self, selector: &str) -> Result<(), GenicamError>
pub fn select_gain(&mut self, selector: &str) -> Result<(), GenicamError>
Select the gain control Camera::gain and Camera::set_gain
act on. Without a call, they act on whichever the camera has
selected.
Sourcepub fn acquisition_mode(&self) -> Result<String, GenicamError>
pub fn acquisition_mode(&self) -> Result<String, GenicamError>
The acquisition mode: Continuous, SingleFrame, MultiFrame, or
one of a vendor’s own.
Sourcepub fn set_acquisition_mode(&mut self, mode: &str) -> Result<(), GenicamError>
pub fn set_acquisition_mode(&mut self, mode: &str) -> Result<(), GenicamError>
Write the acquisition mode by entry name.
Sourcepub fn enable_trigger(
&mut self,
selector: &str,
source: &str,
) -> Result<(), GenicamError>
pub fn enable_trigger( &mut self, selector: &str, source: &str, ) -> Result<(), GenicamError>
Make trigger selector — FrameStart, most often — wait for
source: Software, Line1, … It is selected, given its source,
then turned on: the source first, since a camera may refuse to change
it while the trigger is on. It stays selected, for
Camera::trigger_software.
Sourcepub fn disable_trigger(&mut self, selector: &str) -> Result<(), GenicamError>
pub fn disable_trigger(&mut self, selector: &str) -> Result<(), GenicamError>
Turn trigger selector off: the camera runs free again.
Sourcepub fn trigger_software(&mut self) -> Result<(), GenicamError>
pub fn trigger_software(&mut self) -> Result<(), GenicamError>
Fire the selected trigger once (TriggerSoftware). It acts on a
trigger whose source is Software (Camera::enable_trigger).
Sourcepub fn roi(&self) -> Result<Roi, GenicamError>
pub fn roi(&self) -> Result<Roi, GenicamError>
The region of interest. A camera without offsets reads as one at the origin.
Sourcepub fn set_roi(&mut self, roi: Roi) -> Result<(), GenicamError>
pub fn set_roi(&mut self, roi: Roi) -> Result<(), GenicamError>
Move and size the region of interest.
A size’s maximum shrinks as its offset grows, and an offset’s as the size grows, so the order of writes decides whether a region can be reached at all: the offsets go to zero first, which only widens the sizes’ range, then the sizes, then the offsets. Every value is checked against its feature’s increment before anything is written.
A camera without offsets accepts only a region at the origin.
Sourcepub fn binning(&self) -> Result<(i64, i64), GenicamError>
pub fn binning(&self) -> Result<(i64, i64), GenicamError>
The binning, horizontal and vertical.
Sourcepub fn set_binning(
&mut self,
horizontal: i64,
vertical: i64,
) -> Result<(), GenicamError>
pub fn set_binning( &mut self, horizontal: i64, vertical: i64, ) -> Result<(), GenicamError>
Combine horizontal × vertical pixels into one.
An <Integer> is written the factor. An <Enumeration>, as the
Hikrobot MV-CS050-10GC declares its binning, is written the entry
whose name ends in the factor (BinningHorizontal2); one whose
entries name no factor — SVS’s Off/On — is refused with its
entries listed. Both directions are checked before either is written.
Sourcepub fn frame_rate(&self) -> Result<f64, GenicamError>
pub fn frame_rate(&self) -> Result<f64, GenicamError>
The acquisition frame rate, in frames per second.
Sourcepub fn set_frame_rate(
&mut self,
hz: f64,
) -> Result<ResolvedFeature, GenicamError>
pub fn set_frame_rate( &mut self, hz: f64, ) -> Result<ResolvedFeature, GenicamError>
Fix the acquisition frame rate at hz, and say which feature holds
it. Where the camera has a switch for it
(StandardFeature::FrameRateEnable) it is turned on first: until
then the rate is often unavailable, or not applied.
Sourcepub fn disable_frame_rate(&mut self) -> Result<(), GenicamError>
pub fn disable_frame_rate(&mut self) -> Result<(), GenicamError>
Let the camera choose its frame rate again: turn
StandardFeature::FrameRateEnable off. A camera without one has
nothing to turn off, which is an error.
Sourcepub fn user_sets(&self) -> Result<Vec<String>, GenicamError>
pub fn user_sets(&self) -> Result<Vec<String>, GenicamError>
The user sets UserSetSelector offers, Default among them, in the
XML’s order.
Sourcepub fn load_user_set(&mut self, set: &str) -> Result<(), GenicamError>
pub fn load_user_set(&mut self, set: &str) -> Result<(), GenicamError>
Load user set set into the camera’s settings, waiting on the
calling thread for the camera to finish (up to COMMAND_TIMEOUT).
A load changes features the XML need not name, so every cached value is forgotten afterwards.
Sourcepub fn save_user_set(&mut self, set: &str) -> Result<(), GenicamError>
pub fn save_user_set(&mut self, set: &str) -> Result<(), GenicamError>
Save the camera’s current settings into user set set, waiting on the
calling thread for the camera to finish (up to COMMAND_TIMEOUT).
A camera refuses to overwrite Default.
Sourcepub fn set_default_user_set(
&mut self,
set: &str,
) -> Result<ResolvedFeature, GenicamError>
pub fn set_default_user_set( &mut self, set: &str, ) -> Result<ResolvedFeature, GenicamError>
Make user set set the one the camera loads at power-up, and say
which feature holds that: SFNC 2’s UserSetDefault, or the older
UserSetDefaultSelector.
Source§impl<T: UsbTransfer + 'static> Camera<U3vRegisterIo<T>>
impl<T: UsbTransfer + 'static> Camera<U3vRegisterIo<T>>
Sourcepub fn open_stream(
&mut self,
options: U3vStreamOptions,
) -> Result<U3vFrameStream, GenicamError>
pub fn open_stream( &mut self, options: U3vStreamOptions, ) -> Result<U3vFrameStream, GenicamError>
Open the camera’s stream, ready for acquisition_start: the recipe
Camera::open_stream is for GigE
Vision, with the camera’s PayloadSize as the hint when the device’s
SIRM gives none, and its time sync.
Without PayloadSize, the hint is computed from Width, Height and
PixelFormat; a camera that has the feature and cannot answer it is
an error, since a computed size misses padding and chunk data.
Source§impl Camera<GigeRegisterIo>
impl Camera<GigeRegisterIo>
Sourcepub fn open_stream(
&mut self,
options: StreamOptions,
) -> Result<FrameStream, GenicamError>
pub fn open_stream( &mut self, options: StreamOptions, ) -> Result<FrameStream, GenicamError>
Open a GVSP stream from this camera, ready for acquisition_start.
The one recipe every consumer uses (API-17), as
GigeRegisterIo::open_stream
describes it, with the camera’s PayloadSize and time sync. A camera
without a readable PayloadSize still streams: buffers are then sized
from each leader.
StreamOptions::monitor instead watches a multicast stream another
application configured, claiming and writing nothing; it is the only
stream a camera opened with Access::Monitor
can open.
Source§impl<T: RegisterIo> Camera<T>
impl<T: RegisterIo> Camera<T>
Sourcepub fn new(transport: T, nodemap: NodeMap) -> Self
pub fn new(transport: T, nodemap: NodeMap) -> Self
Create a new camera wrapper from a transport and a nodemap.
Sourcepub fn transport_mut(&mut self) -> &mut T
pub fn transport_mut(&mut self) -> &mut T
Return a mutable reference to the underlying transport.
Sourcepub fn nodemap_mut(&mut self) -> &mut NodeMap
pub fn nodemap_mut(&mut self) -> &mut NodeMap
Mutable access to the nodemap.
Sourcepub fn invalidate(&self, name: &str)
pub fn invalidate(&self, name: &str)
Forget name’s cached value, and those of the registers it is read
through and of everything that depends on it, so the next read asks
the camera: for a value the camera changed in a way its XML does not
describe. See NodeMap::invalidate.
A value the XML declares NoCache needs none of this, and one with a
<PollingTime> is read again once that has passed (ADR-0029).
Sourcepub fn invalidate_all(&self)
pub fn invalidate_all(&self)
Forget every cached value, after something that may have changed the
camera wholesale. Camera::load_user_set does this itself.
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
The nodemap’s current generation, advanced by every write and every
invalidation: where a viewer starts Camera::changed_since from.
Sourcepub fn changed_since(&self, since: u64) -> (Vec<String>, u64)
pub fn changed_since(&self, since: u64) -> (Vec<String>, u64)
The features — and the nodes behind them — that changed after
generation since, in document order, and the generation now. A
viewer re-reads the ones it shows. See NodeMap::changed_since.
Sourcepub fn poll(&self) -> Vec<String>
pub fn poll(&self) -> Vec<String>
Invalidate the values whose <PollingTime> has passed since they were
read, and return their names with those of everything read through
them: what a viewer should read again. Call it as often as the shortest
polling time a viewer shows. See NodeMap::poll.
Sourcepub fn enum_entries(&self, name: &str) -> Result<Vec<String>, GenicamError>
pub fn enum_entries(&self, name: &str) -> Result<Vec<String>, GenicamError>
List available entries for an enumeration feature.
Sourcepub fn feature_state(&self, name: &str) -> Result<FeatureState, GenicamError>
pub fn feature_state(&self, name: &str) -> Result<FeatureState, GenicamError>
Read everything a viewer needs about a feature at once: its typed value, what it permits now, whether it is implemented and available, its range, the enumeration entries it accepts, and its unit.
Sourcepub fn get_integer(&self, name: &str) -> Result<i64, GenicamError>
pub fn get_integer(&self, name: &str) -> Result<i64, GenicamError>
Read an integer feature: an <Integer>, an <IntConverter>, an
integer <IntSwissKnife>, or a <Converter> rounded to the nearest
integer. See NodeMap::get_integer.
Sourcepub fn set_integer(
&mut self,
name: &str,
value: i64,
) -> Result<(), GenicamError>
pub fn set_integer( &mut self, name: &str, value: i64, ) -> Result<(), GenicamError>
Write an integer feature, within its bounds and increment.
Sourcepub fn get_float(&self, name: &str) -> Result<f64, GenicamError>
pub fn get_float(&self, name: &str) -> Result<f64, GenicamError>
Read a float feature: a <Float>, a <Converter>, a float
<SwissKnife>, or an <IntConverter>. An <Integer> is not a
float: read it with Camera::get_integer.
Sourcepub fn set_float(&mut self, name: &str, value: f64) -> Result<(), GenicamError>
pub fn set_float(&mut self, name: &str, value: f64) -> Result<(), GenicamError>
Write a float feature, within its bounds.
Sourcepub fn set_bool(&mut self, name: &str, value: bool) -> Result<(), GenicamError>
pub fn set_bool(&mut self, name: &str, value: bool) -> Result<(), GenicamError>
Write a boolean feature.
Sourcepub fn get_enum(&self, name: &str) -> Result<String, GenicamError>
pub fn get_enum(&self, name: &str) -> Result<String, GenicamError>
Read an enumeration: the name of its current entry.
Sourcepub fn set_enum(&mut self, name: &str, entry: &str) -> Result<(), GenicamError>
pub fn set_enum(&mut self, name: &str, entry: &str) -> Result<(), GenicamError>
Write an enumeration by entry name.
Sourcepub fn get_string(&self, name: &str) -> Result<String, GenicamError>
pub fn get_string(&self, name: &str) -> Result<String, GenicamError>
Read a <StringReg>.
Sourcepub fn set_string(
&mut self,
name: &str,
value: &str,
) -> Result<(), GenicamError>
pub fn set_string( &mut self, name: &str, value: &str, ) -> Result<(), GenicamError>
Write a <StringReg>, NUL-padded to its length.
Sourcepub fn get_register(&self, name: &str) -> Result<Vec<u8>, GenicamError>
pub fn get_register(&self, name: &str) -> Result<Vec<u8>, GenicamError>
Read a <Register>’s bytes. See NodeMap::get_register.
Sourcepub fn set_register(
&mut self,
name: &str,
data: &[u8],
) -> Result<(), GenicamError>
pub fn set_register( &mut self, name: &str, data: &[u8], ) -> Result<(), GenicamError>
Write a <Register>’s bytes, exactly its length. See
NodeMap::set_register.
Sourcepub fn get(&self, name: &str) -> Result<String, GenicamError>
pub fn get(&self, name: &str) -> Result<String, GenicamError>
Read a feature as text, formatted by its type: for a program that
does not know the type in advance, such as a command line. The typed
accessors (Camera::get_integer and the like) read without the
round trip. See NodeMap::get_text.
A category has no value and a command none to read: both are errors.
Sourcepub fn set(&mut self, name: &str, value: &str) -> Result<(), GenicamError>
pub fn set(&mut self, name: &str, value: &str) -> Result<(), GenicamError>
Write a feature from text, parsed by its type: the counterpart of
Camera::get. Text that does not parse as the feature’s type is
GenApiError::InvalidText (in GenicamError::GenApi), and nothing
is written.
A command is not set but executed, with Camera::execute_command or
Camera::execute_and_wait: setting one is an error, and nothing is
written. So is setting a category.
Sourcepub fn save_features(
&mut self,
out: &mut impl Write,
) -> Result<Configuration, GenicamError>
pub fn save_features( &mut self, out: &mut impl Write, ) -> Result<Configuration, GenicamError>
Save the camera’s configuration — every feature its XML marks
<Streamable> — to out, in the GenApi feature-file layout
(ADR-0028). A feature behind a selector is saved under each of the
selector’s entries, and the selector is put back; behind a selector
that cannot be set now — not implemented, not available, locked — it
has one value, saved once.
Returns what was saved, and in Configuration::omitted what was
left out and why; the file carries the same as comments. Save while
the camera is not acquiring: what TLParamsLocked locks is left out
otherwise.
Sourcepub fn load_features(
&mut self,
input: &mut impl Read,
) -> Result<LoadReport, GenicamError>
pub fn load_features( &mut self, input: &mut impl Read, ) -> Result<LoadReport, GenicamError>
Restore a configuration Camera::save_features wrote, or another
GenApi-based tool did in the same layout.
Values are written in the order the camera’s dependencies require, a write that fails is tried once more after the others, and the report lists every value that still could not be written, with the reason. A file saved from another camera model, or another major version of its XML, is loaded too, with a warning in the report. Only a file that cannot be read at all is an error.
Sourcepub fn load_configuration(
&mut self,
configuration: &Configuration,
) -> LoadReport
pub fn load_configuration( &mut self, configuration: &Configuration, ) -> LoadReport
Restore a configuration already read, such as the one
Camera::save_features returned: Camera::load_features without
the file.
Sourcepub async fn time_calibrate(
&mut self,
samples: usize,
interval_ms: u64,
) -> Result<(), GenicamError>
pub async fn time_calibrate( &mut self, samples: usize, interval_ms: u64, ) -> Result<(), GenicamError>
Capture device/host timestamp pairs and fit a mapping model.
Sourcepub fn map_dev_ts(&self, dev_ticks: u64) -> Option<SystemTime>
pub fn map_dev_ts(&self, dev_ticks: u64) -> Option<SystemTime>
Map device tick counters to host time using the fitted model; None
before time_calibrate has fitted one.
Sourcepub fn time_reset(&mut self) -> Result<(), GenicamError>
pub fn time_reset(&mut self) -> Result<(), GenicamError>
Reset the device timestamp counter when supported by the camera.
Sourcepub fn execute_command(&mut self, name: &str) -> Result<(), GenicamError>
pub fn execute_command(&mut self, name: &str) -> Result<(), GenicamError>
Execute a command feature by name.
Camera::set already dispatches to this for Node::Command, but
only from a &str value; callers that hold a command name directly
would otherwise have to reach through Camera::nodemap_mut and
Camera::transport at once, which the borrow checker rejects from
outside the struct. Splitting the two fields here is the same thing
Camera::acquisition_start does.
Sourcepub async fn execute_and_wait(
&mut self,
name: &str,
timeout: Duration,
) -> Result<(), GenicamError>
pub async fn execute_and_wait( &mut self, name: &str, timeout: Duration, ) -> Result<(), GenicamError>
Execute a command and wait until the camera reports it finished.
GenICam Standard v2.1.1 §2.8.8: “the state of other nodes can depend on
the completion of the Command therefore applications … should always
wait for the command completion by calling IsDone immediately after the
Execute”. This polls NodeMap::is_done at the command’s
<PollingTime> — every COMMAND_POLL_INTERVAL when it declares
none — until it answers true or timeout passes.
A command whose register path is write-only — most of them — is done
as soon as the write is acknowledged, so this returns as quickly as
Camera::execute_command does. A self-clearing command (its register
reads back the command value until the device has finished) is waited
on. Reads made afterwards see the state the command left.
Returns GenicamError::CommandNotDone when the camera has not
finished by timeout; the command was still executed.
Sourcepub fn execute_and_wait_blocking(
&mut self,
name: &str,
timeout: Duration,
) -> Result<(), GenicamError>
pub fn execute_and_wait_blocking( &mut self, name: &str, timeout: Duration, ) -> Result<(), GenicamError>
Camera::execute_and_wait on the calling thread, for a program
without an async runtime; it sleeps between polls.
Sourcepub fn is_done(&self, name: &str) -> Result<bool, GenicamError>
pub fn is_done(&self, name: &str) -> Result<bool, GenicamError>
Whether the command name has finished: GenICam’s IsDone.
See NodeMap::is_done; Camera::execute_and_wait polls it.
Sourcepub fn acquisition_start(&mut self) -> Result<(), GenicamError>
pub fn acquisition_start(&mut self) -> Result<(), GenicamError>
Start acquisition: set TLParamsLocked, then execute
AcquisitionStart.
TLParamsLocked is how the transport layer tells the camera’s XML a
stream is running, so that features which would change the payload —
Width, PixelFormat — are locked until it stops (33 of the 38
vendor-corpus documents declare it). A camera without it is started
all the same; one that refuses it is started with a warning. If the
start fails, the lock is cleared again.
Sourcepub fn acquisition_stop(&mut self) -> Result<(), GenicamError>
pub fn acquisition_stop(&mut self) -> Result<(), GenicamError>
Stop acquisition: execute AcquisitionStop, then clear
TLParamsLocked — cleared even when the stop fails, so the features
it locked can be written again.
Sourcepub fn configure_chunks(
&mut self,
cfg: &ChunkConfig,
) -> Result<(), GenicamError>
pub fn configure_chunks( &mut self, cfg: &ChunkConfig, ) -> Result<(), GenicamError>
Configure chunk mode and enable the requested selectors.
Sourcepub fn with_chunks<R>(&mut self, frame: &Frame, f: impl FnOnce(&Self) -> R) -> R
pub fn with_chunks<R>(&mut self, frame: &Frame, f: impl FnOnce(&Self) -> R) -> R
Read features from a frame’s chunks: attach them to the nodemap’s
chunk ports, run f, and detach them again.
Inside f, cam.get("ChunkExposureTime") reads the value this frame
carried — from the chunk whose ID the camera’s XML names, at the offset
and in the byte order the XML declares (ADR-0026). Nothing is read from
the device for it. A frame without chunks attaches none, and chunk
features then fail with GenApiError::NotAttached.
let exposure = camera.with_chunks(frame, |cam| cam.get("ChunkExposureTime"))?;Sourcepub fn chunk_features(
&mut self,
frame: &Frame,
) -> Vec<(String, Result<String, GenicamError>)>
pub fn chunk_features( &mut self, frame: &Frame, ) -> Vec<(String, Result<String, GenicamError>)>
Every feature frame’s chunks feed, with its value or the error that
kept it from being read, sorted by name.
The features are the ones the camera’s XML lists in a category and
derives from a chunk port whose chunk the frame carries — ChunkTimestamp,
not the ChunkTimestamp_Val register behind it. Empty for a frame
without chunks.
Sourcepub fn with_event<R>(&mut self, event: &Event, f: impl FnOnce(&Self) -> R) -> R
pub fn with_event<R>(&mut self, event: &Event, f: impl FnOnce(&Self) -> R) -> R
Read features from a received event: attach it to the ports whose
<EventID> is the event’s, run f, and detach events again.
Inside f, cam.get("EventExposureEndTimestamp") reads the event’s
own bytes at the offset the camera’s XML declares — 0x8 for the
timestamp on every corpus document, which is where the event header has
it.
Sourcepub fn event_features(
&mut self,
event: &Event,
) -> Vec<(String, Result<String, GenicamError>)>
pub fn event_features( &mut self, event: &Event, ) -> Vec<(String, Result<String, GenicamError>)>
Every feature event feeds, with its value or the error that kept it
from being read, sorted by name: the category features derived from a
port whose <EventID> is the event’s. Empty when the XML declares no
port for it.
Sourcepub fn event_name(&self, event_id: u16) -> Option<String>
pub fn event_name(&self, event_id: u16) -> Option<String>
The EventSelector entry an event with event_id belongs to, when
the XML says.
SFNC names an event’s data features Event<Entry> and
Event<Entry>Timestamp, so an entry with either feature on the port
whose <EventID> is event_id names the event. Otherwise an entry
whose literal <Value> is the ID does, as Basler’s do. None when
neither matches, or the camera has no EventSelector.
Source§impl Camera<GigeRegisterIo>
What only a GigE Vision camera has: a GVCP message channel for events
and a stream channel that can go to a multicast group. Streams and
control privilege are here too (Camera::open_stream,
GigeRegisterIo::control_state). A USB3 Vision camera has none of
them, so none of this compiles against one.
impl Camera<GigeRegisterIo>
What only a GigE Vision camera has: a GVCP message channel for events
and a stream channel that can go to a multicast group. Streams and
control privilege are here too (Camera::open_stream,
GigeRegisterIo::control_state). A USB3 Vision camera has none of
them, so none of this compiles against one.
Sourcepub async fn configure_events(
&mut self,
local_ip: Ipv4Addr,
port: u16,
enable_ids: &[&str],
) -> Result<(), GenicamError>
pub async fn configure_events( &mut self, local_ip: Ipv4Addr, port: u16, enable_ids: &[&str], ) -> Result<(), GenicamError>
Configure the GVCP message channel and enable delivery of the requested events.
GigE Vision only:
let _ = camera.configure_events(std::net::Ipv4Addr::LOCALHOST, 10020, &[]).await;Sourcepub fn configure_stream_multicast(
&mut self,
stream_idx: u32,
group: Ipv4Addr,
port: u16,
) -> Result<(), GenicamError>
pub fn configure_stream_multicast( &mut self, stream_idx: u32, group: Ipv4Addr, port: u16, ) -> Result<(), GenicamError>
Configure the stream channel for multicast delivery: point GevSCDA
at group and GevSCPHostPort at port.
A multicast destination address is all it takes; SFNC has no
separate enable. Without the SFNC nodes the bootstrap registers are
written directly. Camera::open_stream with
StreamOptions::multicast does this and starts receiving too.
GigE Vision only:
let _ = camera.configure_stream_multicast(0, std::net::Ipv4Addr::new(239, 0, 0, 1), 5000);Sourcepub async fn open_event_stream(
&self,
local_ip: Ipv4Addr,
port: u16,
) -> Result<EventStream, GenicamError>
pub async fn open_event_stream( &self, local_ip: Ipv4Addr, port: u16, ) -> Result<EventStream, GenicamError>
Open a GVCP event stream bound to the provided local endpoint.
GigE Vision only:
let _ = camera.open_event_stream(std::net::Ipv4Addr::LOCALHOST, 10020).await;Source§impl<T: UsbTransfer + 'static> Camera<U3vRegisterIo<T>>
What only a USB3 Vision camera has: an event interface, whose events
arrive on a USB endpoint rather than a GVCP message channel (backlog
TC-27 (4)). Its stream is
Camera::open_stream too.
impl<T: UsbTransfer + 'static> Camera<U3vRegisterIo<T>>
What only a USB3 Vision camera has: an event interface, whose events
arrive on a USB endpoint rather than a GVCP message channel (backlog
TC-27 (4)). Its stream is
Camera::open_stream too.
Sourcepub fn configure_events(
&mut self,
enable_ids: &[&str],
) -> Result<(), GenicamError>
pub fn configure_events( &mut self, enable_ids: &[&str], ) -> Result<(), GenicamError>
Turn on notification of the events named — "ExposureEnd", say —
through SFNC’s EventSelector and EventNotification. They arrive on
a stream from open_event_stream.
Sourcepub fn open_event_stream(&self) -> Result<U3vEventStream, GenicamError>
pub fn open_event_stream(&self) -> Result<U3vEventStream, GenicamError>
Set the event interface’s EventEnable and read its endpoint on a
thread of its own. Events carry their device time in ns, mapped to
host time once time_calibrate has fitted
a clock; dropping the stream restores the previous EventEnable word.