Trait cameraunit::CameraUnit

source ·
pub trait CameraUnit: CameraInfo {
Show 29 methods // Required methods fn get_vendor(&self) -> &str; fn capture_image(&self) -> Result<DynamicSerialImage, Error>; fn start_exposure(&self) -> Result<(), Error>; fn download_image(&self) -> Result<DynamicSerialImage, Error>; fn image_ready(&self) -> Result<bool, Error>; fn set_exposure(&mut self, _exposure: Duration) -> Result<Duration, Error>; fn get_exposure(&self) -> Duration; fn set_roi(&mut self, roi: &ROI) -> Result<&ROI, Error>; fn set_bpp(&mut self, bpp: PixelBpp) -> Result<PixelBpp, Error>; fn get_bpp(&self) -> PixelBpp; fn get_roi(&self) -> &ROI; // Provided methods fn get_handle(&self) -> Option<&dyn Any> { ... } fn get_gain(&self) -> f32 { ... } fn get_gain_raw(&self) -> i64 { ... } fn set_gain(&mut self, _gain: f32) -> Result<f32, Error> { ... } fn set_gain_raw(&mut self, _gain: i64) -> Result<i64, Error> { ... } fn get_offset(&self) -> i32 { ... } fn set_offset(&mut self, _offset: i32) -> Result<i32, Error> { ... } fn get_min_exposure(&self) -> Result<Duration, Error> { ... } fn get_max_exposure(&self) -> Result<Duration, Error> { ... } fn get_min_gain(&self) -> Result<i64, Error> { ... } fn get_max_gain(&self) -> Result<i64, Error> { ... } fn set_shutter_open(&mut self, _open: bool) -> Result<bool, Error> { ... } fn get_shutter_open(&self) -> Result<bool, Error> { ... } fn set_flip(&mut self, _x: bool, _y: bool) -> Result<(), Error> { ... } fn get_flip(&self) -> (bool, bool) { ... } fn get_bin_x(&self) -> u32 { ... } fn get_bin_y(&self) -> u32 { ... } fn get_status(&self) -> String { ... }
}
Expand description

Trait for controlling the camera. This trait is intended to be applied to a non-clonable object that is used to capture images and can not be shared across threads.

Required Methods§

source

fn get_vendor(&self) -> &str

Get the camera vendor.

source

fn capture_image(&self) -> Result<DynamicSerialImage, Error>

Capture an image.

Raises a Message with the message "Not implemented" if unimplemented.

source

fn start_exposure(&self) -> Result<(), Error>

Start an exposure and return. This function does NOT block.

source

fn download_image(&self) -> Result<DynamicSerialImage, Error>

Download the image captured in CameraUnit::start_exposure.

source

fn image_ready(&self) -> Result<bool, Error>

Get exposure status. This function is useful for checking if a non-blocking exposure has finished running.

source

fn set_exposure(&mut self, _exposure: Duration) -> Result<Duration, Error>

Set the exposure time.

§Arguments
  • exposure - The exposure time as a Duration.
§Returns

The exposure time that was set, or error.

source

fn get_exposure(&self) -> Duration

Get the currently set exposure time.

§Returns
source

fn set_roi(&mut self, roi: &ROI) -> Result<&ROI, Error>

Set the image region of interest (ROI).

§Arguments
  • roi - The region of interest.

Note:

  • The region of interest is defined in the binned pixel space.
  • Setting all values to 0 will set the ROI to the full detector size.
§Returns

The region of interest that was set, or error.

source

fn set_bpp(&mut self, bpp: PixelBpp) -> Result<PixelBpp, Error>

Set the pixel format.

§Arguments
  • format - The pixel format.
source

fn get_bpp(&self) -> PixelBpp

Get the pixel format.

§Returns

The pixel format.

source

fn get_roi(&self) -> &ROI

Get the region of interest.

§Returns
  • The region of interest.

Provided Methods§

source

fn get_handle(&self) -> Option<&dyn Any>

Get a handle to the internal camera. This is intended to be used for development purposes, as (presumably FFI and unsafe) internal calls are abstracted away from the user.

Defaults to None if unimplemented.

source

fn get_gain(&self) -> f32

Get the current gain (in percentage units).

Defaults to 0.0 if unimplemented.

source

fn get_gain_raw(&self) -> i64

Get the current gain (in raw values).

Defaults to 0 if unimplemented.

source

fn set_gain(&mut self, _gain: f32) -> Result<f32, Error>

Set the gain (in percentage units).

Raises a Message with the message "Not implemented" if unimplemented.

source

fn set_gain_raw(&mut self, _gain: i64) -> Result<i64, Error>

Set the gain (in raw values).

Raises a Message with the message "Not implemented" if unimplemented.

source

fn get_offset(&self) -> i32

Get the current pixel offset.

Defaults to 0 if unimplemented.

source

fn set_offset(&mut self, _offset: i32) -> Result<i32, Error>

Set the pixel offset.

Raises a GeneralError with the message "Not implemented" if unimplemented.

source

fn get_min_exposure(&self) -> Result<Duration, Error>

Get the minimum exposure time.

Raises a Message with the message "Not implemented" if unimplemented.

source

fn get_max_exposure(&self) -> Result<Duration, Error>

Get the maximum exposure time.

Raises a Message with the message "Not implemented" if unimplemented.

source

fn get_min_gain(&self) -> Result<i64, Error>

Get the minimum gain (in raw units).

Raises a Message with the message "Not implemented" if unimplemented.

source

fn get_max_gain(&self) -> Result<i64, Error>

Get the maximum gain (in raw units).

Raises a Message with the message "Not implemented" if unimplemented.

source

fn set_shutter_open(&mut self, _open: bool) -> Result<bool, Error>

Set the shutter to open (always/when exposing).

Raises a Message with the message "Not implemented" if unimplemented.

source

fn get_shutter_open(&self) -> Result<bool, Error>

Get the shutter state.

Raises a Message with the message "Not implemented" if unimplemented.

source

fn set_flip(&mut self, _x: bool, _y: bool) -> Result<(), Error>

Flip the image along X and/or Y axes.

Raises a Message with the message "Not implemented" if unimplemented.

source

fn get_flip(&self) -> (bool, bool)

Check if the image is flipped along X and/or Y axes.

Defaults to (false, false) if unimplemented.

source

fn get_bin_x(&self) -> u32

Get the X binning factor.

Defaults to 1 if unimplemented.

source

fn get_bin_y(&self) -> u32

Get the Y binning factor.

Defaults to 1 if unimplemented.

source

fn get_status(&self) -> String

Get the current operational status of the camera.

Defaults to "Not implemented" if unimplemented.

Implementors§