pub struct FakeCamera { /* private fields */ }Expand description
Handle to a running fake GigE Vision camera.
The camera runs as background tokio tasks. Call stop or
drop the handle to shut down the camera.
Implementations§
Source§impl FakeCamera
impl FakeCamera
Sourcepub fn builder() -> FakeCameraBuilder
pub fn builder() -> FakeCameraBuilder
Create a new builder.
Sourcepub async fn start() -> Result<Self, Error>
pub async fn start() -> Result<Self, Error>
Start a fake camera with default settings on 127.0.0.1:3956.
Sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
The local address the GVCP socket is bound to.
Sourcepub fn commands(&self) -> &CommandCounters
pub fn commands(&self) -> &CommandCounters
Which register-access commands this camera has received, and where.
For tests that must assert how a value reached the device: READREG and READMEM return identical bytes, so a test that checks only the value cannot tell them apart.
Sourcepub fn blocks_sent(&self) -> u64
pub fn blocks_sent(&self) -> u64
GVSP blocks this camera has produced, including any its packet script then dropped whole.
The left-hand side of a receiver’s accounting identity: every block is complete, incomplete, missed or dropped to backpressure on the host.
Sourcepub fn message_channel(&self) -> MessageChannelStats
pub fn message_channel(&self) -> MessageChannelStats
What this camera’s message channel did: messages sent, how often,
acknowledged or abandoned, and events lost to a full queue
(events module: one message outstanding, sent again every GevMCTT
until acknowledged, as an Allied Vision Manta G-125B does).
Sourcepub fn resends(&self) -> ResendStats
pub fn resends(&self) -> ResendStats
What this camera did with PACKETRESEND_CMDs: requests received,
packets sent again, packets it no longer held.
Sourcepub fn spoofed_packets(&self) -> u64
pub fn spoofed_packets(&self) -> u64
Datagrams sent from the spoof_source
address.
Sourcepub async fn controller(&self) -> Option<SocketAddr>
pub async fn controller(&self) -> Option<SocketAddr>
The application holding control privilege — the address and port its
commands come from — or None.
Sourcepub async fn revoke_control(&self)
pub async fn revoke_control(&self)
Give control privilege up on the device side, as a device does when the controller’s heartbeat expires: CCP reads 0 from then on.
Sourcepub fn unplug(&self)
pub fn unplug(&self)
Take the camera’s link down, as a pulled cable does: from now on
every datagram to it is lost unanswered, and every one it sends —
stream, events — is lost on the way. The camera itself runs on: it
keeps acquiring, and its heartbeat timer keeps counting.
plug_in brings the link back.
Sourcepub fn heartbeat_expiries(&self) -> u64
pub fn heartbeat_expiries(&self) -> u64
How often the heartbeat rule has revoked control privilege.
Sourcepub fn actions(&self) -> u64
pub fn actions(&self) -> u64
Action commands this camera acted on: its device key, group key and a
group mask that shares a bit with its own (FAKE_DEVICE_KEY,
FAKE_GROUP_KEY, FAKE_GROUP_MASK). One addressed elsewhere, or
malformed, is not counted.
Sourcepub fn discovery_requests(&self) -> Vec<DiscoveryRequest>
pub fn discovery_requests(&self) -> Vec<DiscoveryRequest>
Every DISCOVERY_CMD this camera received, in arrival order.
Sourcepub async fn peek(&self, addr: u64, len: usize) -> Vec<u8> ⓘ
pub async fn peek(&self, addr: u64, len: usize) -> Vec<u8> ⓘ
Read len bytes of device state directly, bypassing GVCP.
Not subject to access modes and not counted, so a test can check what a write actually stored without trusting the client’s own read-back.
Sourcepub async fn event_notification_on(&self, event_id: u16) -> bool
pub async fn event_notification_on(&self, event_id: u16) -> bool
Whether EventNotification is On for event_id, as the device
keeps it per event, whatever EventSelector currently selects. Read
past the protocol, like FakeCamera::peek.
Sourcepub async fn software_triggers(&self) -> u64
pub async fn software_triggers(&self) -> u64
How many times TriggerSoftware was executed, counted by the device.
Sourcepub async fn saved_exposure(&self, set: u32) -> Option<f64>
pub async fn saved_exposure(&self, set: u32) -> Option<f64>
The exposure saved in user set set by UserSetSave, or None if
nothing has been saved there. Read past the protocol, like
FakeCamera::peek.
Sourcepub async fn stop(self)
pub async fn stop(self)
Stop the fake camera and wait for its background tasks to exit.
The GVCP server cancels and drains its delayed acknowledgements, then the other tasks are aborted and joined. No delayed task retains the listening socket when this returns: a later fixture must not compete with an obsolete socket for datagrams on the same port.