Skip to main content

FakeCameraBuilder

Struct FakeCameraBuilder 

Source
pub struct FakeCameraBuilder { /* private fields */ }
Expand description

Builder for configuring and starting a fake GigE Vision camera.

Implementations§

Source§

impl FakeCameraBuilder

Source

pub fn width(self, width: u32) -> Self

Set the image width in pixels.

Source

pub fn height(self, height: u32) -> Self

Set the image height in pixels.

Source

pub fn fps(self, fps: u32) -> Self

Set the target frame rate.

Source

pub fn bind_ip(self, ip: Ipv4Addr) -> Self

Set the IPv4 address to bind the GVCP socket to.

Source

pub fn port(self, port: u16) -> Self

Set the GVCP control port (default: 3956).

Source

pub fn pixel_format(self, code: u32) -> Self

Set the initial pixel format (PFNC code). Default: Mono8.

Use MONO8 or RGB8 constants.

Source

pub fn zip_xml(self, enable: bool) -> Self

Serve the GenApi XML as a ZIP archive (default: plain XML).

Many real cameras (Basler, FLIR, Hikrobot, …) publish their register-description XML zipped; enable this to exercise that path.

Source

pub fn enforce_heartbeat(self, enable: bool) -> Self

Release control privilege when the controller stops sending GVCP commands for longer than GevHeartbeatTimeout (default: off).

See registers::RegisterMap::enforce_heartbeat for why this is not the default even though every real device behaves this way.

Source

pub fn max_packet_size(self, max: u32) -> Self

Clamp GevSCPSPacketSize to max, the way a real camera caps it.

A request above max is acknowledged and silently reduced, so the register reads back lower than what was written. Off by default: the fake accepts any size, which is what every existing test expects.

The fake accepted anything until 0.4.1, so it could not express the camera behind #112 and no test could have caught that defect — the ADR-0019 failure mode of a fake that only ever agrees with its client.

Source

pub fn max_on_wire(self, max: u32) -> Self

Silently drop any GVSP datagram larger than max, as a network path with a smaller frame ceiling than either endpoint believes does.

Different from FakeCameraBuilder::max_packet_size, and the difference is the whole of #112: that camera accepts and stores 16114, then streams nothing, because the link tops out at a 9216-byte frame. No register read can find that — only a test packet can.

Source

pub fn heartbeat_timeout_ms(self, timeout_ms: u32) -> Self

Report a different GevHeartbeatTimeout than the 3 000 ms default.

A shorter window keeps a test that has to wait one out from dominating the suite’s runtime.

Source

pub async fn build(self) -> Result<FakeCamera, Error>

Start the fake camera and return a handle.

Trait Implementations§

Source§

impl Default for FakeCameraBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.

§

impl<T> Instrument for T

§

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

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

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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