Struct cameleon::u3v::register_map::Abrm

source ·
pub struct Abrm { /* private fields */ }
Expand description

Represent Technology Agnostic Boot Register Map (ABRM), refer to GenCP specification for more information about ABRM.

To maintain consistency with the device data, Abrm doesn’t cache any data. It means that all methods of this struct cause communication with the device every time, thus the device is expected to be opened when methods are called.

Examples

use cameleon::Camera;
use cameleon::u3v;
use cameleon::genapi;

// Enumerates cameras connected to the host.
let mut cameras = u3v::enumerate_cameras().unwrap();

// If no camera is found, return.
if cameras.is_empty() {
    return;
}

let mut camera = cameras.pop().unwrap();
// Opens the camera.
camera.open();

let ctrl = &mut camera.ctrl;
// Get Abrm.
let abrm = ctrl.abrm().unwrap();

// Read serial number from ABRM.
let serial_number = abrm.serial_number(ctrl).unwrap();
println!("{}", serial_number);

// Check user defined name feature is supported.
// If it is suppoted, read from and write to the register.
let device_capability = abrm.device_capability().unwrap();
if device_capability.is_user_defined_name_supported() {
    // Read from user defined name register.
    let user_defined_name = abrm.user_defined_name(ctrl).unwrap().unwrap();
    println!("{}", user_defined_name);

    // Write new name to the register.
    abrm.set_user_defined_name(ctrl, "cameleon").unwrap();
}

Implementations§

source§

impl Abrm

source

pub fn new<Ctrl: DeviceControl + ?Sized>( device: &mut Ctrl ) -> ControlResult<Self>

Constructs new Abrm, consider using super::ControlHandle::abrm instead.

source

pub fn sbrm<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<Sbrm>

Returns Sbrm, consider using super::ControlHandle::sbrm instead.

source

pub fn manifest_table<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<ManifestTable>

Returns ManifestTable, consider using super::ControlHandle::manifest_table instead.

source

pub fn gencp_version<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<Version>

GenCP version of the device.

source

pub fn manufacturer_name<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<String>

Manufacture name of the device.

source

pub fn model_name<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<String>

Model name of the device.

source

pub fn family_name<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<Option<String>>

Family name of the device.

NOTE: Some device doesn’t support this feature. Please refer to DeviceCapability to see whether the feature is available on the device.

source

pub fn device_version<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<String>

Device version, this information represents manufacturer specific information.

source

pub fn manufacturer_info<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<String>

Manufacturer info of the device, this information represents manufacturer specific information.

source

pub fn serial_number<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<String>

Serial number of the device.

source

pub fn user_defined_name<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<Option<String>>

User defined name of the device.

NOTE: Some device doesn’t support this feature. Please refer to DeviceCapability to see whether the feature is available on the device.

source

pub fn set_user_defined_name<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl, name: &str ) -> ControlResult<()>

Set user defined name of the device.

Arguments
  • name - A user defined name. The encoding must be ascii and the length must be less than 64.

NOTE: Some device doesn’t support this feature. Please refer to DeviceCapability to see whether the feature is available on the device.

source

pub fn manifest_table_address<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<u64>

The initial address of manifest table.

To obtain ManifestTable, it is easier to use Self::manifest_table.

source

pub fn sbrm_address<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<u64>

The initial address of Sbrm.

To obtain Sbrm, it is easier to use Self::sbrm.

source

pub fn timestamp<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<u64>

Timestamp that represents device internal clock in ns.

Before calling this method, please make sure to call Self::set_timestamp_latch_bit that updates timestamp register.

source

pub fn set_timestamp_latch_bit<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<()>

Update timestamp register by set 1 to timestamp_latch.

source

pub fn timestamp_increment<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<u64>

Time stamp increment that indicates the ns/tick of the device internal clock.

For example a value of 1000 indicates the device clock runs at 1MHz.

source

pub fn device_software_interface_version<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<Option<String>>

Device software version.

NOTE: Some device doesn’t support this feature. Please refer to DeviceCapability to see whether the feature is available on the device.

source

pub fn maximum_device_response_time<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<Duration>

Maximum device response time.

source

pub fn device_capability(&self) -> ControlResult<DeviceCapability>

Device capability.

source

pub fn device_configuration<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl ) -> ControlResult<DeviceConfiguration>

Current configuration of the device.

source

pub fn write_device_configuration<Ctrl: DeviceControl + ?Sized>( &self, device: &mut Ctrl, config: DeviceConfiguration ) -> ControlResult<()>

Write configuration to the device.

Trait Implementations§

source§

impl Clone for Abrm

source§

fn clone(&self) -> Abrm

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Abrm

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for Abrm

Auto Trait Implementations§

§

impl RefUnwindSafe for Abrm

§

impl Send for Abrm

§

impl Sync for Abrm

§

impl Unpin for Abrm

§

impl UnwindSafe for Abrm

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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.

source§

impl<T> Instrument for T

source§

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

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

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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

impl<T> WithSubscriber for T

source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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