Skip to main content

Device

Struct Device 

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

Opened OBSBOT camera.

Obtain via crate::Devices::open. Dropping the handle stops the per-device status poller (joining its thread) and releases the transport’s /dev/videoN handle.

Implementations§

Source§

impl Device

Source

pub fn set_status_cadence(&self, cadence: Cadence)

Change how often the status poller samples the camera.

Source

pub fn name(&self) -> &str

Human-readable model name.

Source

pub fn serial(&self) -> &str

Device serial number as reported by the OS at enumeration time.

Source

pub fn firmware_version(&self) -> &str

Firmware version string. Returns the build-time minimum until a real camera response can be parsed.

Source

pub fn product_type(&self) -> ProductType

Model enum value.

Source

pub fn status(&self) -> Result<Status>

Read a fresh status snapshot synchronously.

The current-state fields (HDR / face-AE / AI mode / focus bits) come from a selector-0x02 RPC reply whose request frame hasn’t been captured yet, so they remain Default::default() for now. Firmware / serial fields come from firmware_from_camera / serial_from_camera and are filled in best-effort - they’re left blank on read failure rather than failing the whole status call.

Source

pub fn firmware_from_camera(&self) -> Result<String>

Ask the camera for its firmware version via the XU RPC channel. Synthesises the request frame at runtime via meet2::build_rpc_frame using the CRC-16/USB algorithm recovered from libdev.so. Returns a dotted-decimal string like "4.4.6.1".

Source

pub fn firmware(&self) -> Result<FirmwareVersion>

Parsed firmware version, freshly read from the camera. Convenience over firmware_from_camera for callers that want to do version comparisons. Returns Error::BadResponse if the string isn’t four dotted decimals.

Source

pub fn serial_from_camera(&self) -> Result<String>

Ask the camera for its serial number via the XU RPC channel.

Source

pub fn set_pan_tilt(&self, pan: f32, tilt: f32) -> Result<()>

Set pan and tilt in normalised camera coordinates (-1.0 ..= 1.0).

Encodes as CT_PANTILT_ABSOLUTE_CONTROL: i32 LE pan + i32 LE tilt in arc-seconds (UVC 1.5 §4.2.2.1.14). The normalised-to-arc-second scale is provisional until the camera’s GET_MIN/GET_MAX are queried at open time.

Source

pub fn set_zoom(&self, zoom: f32) -> Result<()>

Set zoom as a ratio of the camera’s optical range (1.0 ..= max).

Encodes as CT_ZOOM_ABSOLUTE_CONTROL: u16 LE objective focal length (UVC 1.5 §4.2.2.1.10). Mapping is provisional until GET_MIN/GET_MAX are queried.

Source

pub fn set_focus(&self, focus: f32) -> Result<()>

Set focus distance.

Encodes as CT_FOCUS_ABSOLUTE_CONTROL: u16 LE (UVC 1.5 §4.2.2.1.6). Mapping is provisional until GET_MIN/GET_MAX are queried.

Source

pub fn pan_tilt(&self) -> Result<(f32, f32)>

Read current pan + tilt in normalised camera coordinates (-1.0 ..= 1.0). Inverse of set_pan_tilt; uses the same provisional arc-second scale.

Source

pub fn zoom(&self) -> Result<f32>

Read current zoom value. Returns the raw u16 as f32 until GET_MIN/GET_MAX are wired up to give a meaningful ratio.

Source

pub fn focus(&self) -> Result<f32>

Read current focus value. Same provisional u16-as-f32 mapping as set_focus.

Source

pub fn set_auto_focus(&self, on: bool) -> Result<()>

Enable or disable autofocus. CT_FOCUS_AUTO_CONTROL, u8.

Source

pub fn auto_focus(&self) -> Result<bool>

Whether autofocus is currently enabled.

Source

pub fn set_ae_mode(&self, mode: AeMode) -> Result<()>

Set the auto-exposure mode. CT_AE_MODE_CONTROL, u8 bitmap (UVC 1.5 §4.2.2.1.2). The Meet 2 supports Manual + Auto; Shutter Priority and Aperture Priority are accepted by the enum for SDK parity and silently no-op on cameras that don’t support them.

Source

pub fn ae_mode(&self) -> Result<AeMode>

Read the current auto-exposure mode.

Source

pub fn set_ae_lock(&self, locked: bool) -> Result<()>

Lock or unlock exposure + gain. Convenience over set_ae_mode: true selects AeMode::Manual (both locked), false selects AeMode::Auto. Matches the SDK’s cameraSetAELockR(bool).

Source

pub fn ae_lock(&self) -> Result<bool>

Whether exposure is currently locked.

Source

pub fn set_exposure_time(&self, value_100us: u32) -> Result<()>

Set manual exposure time. CT_EXPOSURE_TIME_ABSOLUTE_CONTROL, u32 LE in 100 us units (UVC 1.5 §4.2.2.1.4). Setting this when the AE mode allows auto exposure (Auto or Aperture Priority) has no effect; pair with set_ae_lock(true) for full manual control.

Source

pub fn exposure_time(&self) -> Result<u32>

Read the current exposure time, in 100 us units.

Source

pub fn exposure_time_range(&self) -> Result<RangeInclusive<u32>>

Reported exposure-time range, in 100 us units.

Source

pub fn set_brightness(&self, value: i32) -> Result<()>

Set brightness. PU_BRIGHTNESS_CONTROL, i16 LE (UVC 1.5 §4.2.2.3.2).

Source

pub fn brightness(&self) -> Result<i32>

Read current brightness.

Source

pub fn brightness_range(&self) -> Result<RangeInclusive<i32>>

Reported brightness range.

Source

pub fn set_contrast(&self, value: i32) -> Result<()>

Set contrast. PU_CONTRAST_CONTROL, u16 LE (UVC 1.5 §4.2.2.3.3).

Source

pub fn contrast(&self) -> Result<i32>

Read current contrast.

Source

pub fn contrast_range(&self) -> Result<RangeInclusive<i32>>

Reported contrast range.

Source

pub fn set_saturation(&self, value: i32) -> Result<()>

Set saturation. PU_SATURATION_CONTROL, u16 LE (UVC 1.5 §4.2.2.3.7).

Source

pub fn saturation(&self) -> Result<i32>

Read current saturation.

Source

pub fn saturation_range(&self) -> Result<RangeInclusive<i32>>

Reported saturation range.

Source

pub fn set_hue(&self, value: i32) -> Result<()>

Set image hue. PU_HUE_CONTROL, i16 LE (UVC 1.5 §4.2.2.3.4).

Source

pub fn hue(&self) -> Result<i32>

Read current hue.

Source

pub fn hue_range(&self) -> Result<RangeInclusive<i32>>

Reported hue range.

Source

pub fn set_sharpness(&self, value: i32) -> Result<()>

Set image sharpness. PU_SHARPNESS_CONTROL, u16 LE.

Source

pub fn sharpness(&self) -> Result<i32>

Read current sharpness.

Source

pub fn sharpness_range(&self) -> Result<RangeInclusive<i32>>

Reported sharpness range.

Source

pub fn set_gain(&self, value: i32) -> Result<()>

Set sensor gain. PU_GAIN_CONTROL, u16 LE.

Source

pub fn gain(&self) -> Result<i32>

Read current gain.

Source

pub fn gain_range(&self) -> Result<RangeInclusive<i32>>

Reported gain range.

Source

pub fn set_backlight_compensation(&self, value: i32) -> Result<()>

Set backlight-compensation. PU_BACKLIGHT_COMPENSATION_CONTROL, u16 LE (UVC 1.5 §4.2.2.3.16). 0 disables it.

Source

pub fn backlight_compensation(&self) -> Result<i32>

Read current backlight-compensation value.

Source

pub fn set_anti_flicker(&self, mode: AntiFlicker) -> Result<()>

Set anti-flicker (mains-frequency rejection). PU_POWER_LINE_FREQUENCY_CONTROL, u8 (UVC 1.5 §4.2.2.3.6).

Source

pub fn anti_flicker(&self) -> Result<AntiFlicker>

Read current anti-flicker mode.

Source

pub fn set_white_balance( &self, mode: WhiteBalanceMode, kelvin: Option<u16>, ) -> Result<()>

Set white balance mode; the kelvin value is meaningful only when mode is WhiteBalanceMode::Manual. The Meet 2 only supports Auto and Manual (per the SDK header) so this routes entirely through standard UVC Processing Unit selectors 0x0a / 0x0b.

Source

pub fn white_balance(&self) -> Result<(WhiteBalanceMode, u16)>

Read current white-balance mode and Kelvin value.

Source

pub fn white_balance_range(&self) -> Result<RangeInclusive<u16>>

Reported manual Kelvin range.

Source

pub fn set_wdr(&self, mode: WdrMode) -> Result<()>

Set HDR mode. Writes to the OBSBOT XU mode-register selector 0x06 with the WDR control id; see doc/protocol/meet2/setWdr.md for the wire format.

Source

pub fn wdr(&self) -> Result<WdrMode>

Read current HDR mode from the XU status blob (offset 6).

Source

pub fn face_ae(&self) -> Result<bool>

Whether face-based auto-exposure is on (XU status blob offset 7).

Source

pub fn ai_mode(&self) -> Result<AiMode>

Current AI master mode (XU status blob offset 24).

The Meet 2 collapses AI mode, auto-framing, and media-mode into a single “AI work mode” enum at runtime - setting auto-framing or MediaMode::AutoFrame changes this byte just as setting an AI mode does. The value at offset 24 always reflects the most recently selected mode, so ai_mode(), auto_framing(), and media_mode() all read it but interpret it differently.

Source

pub fn set_fov(&self, fov: FovType) -> Result<()>

Set field-of-view preset. XU mode-register control id meet2::MODE_FOV - see doc/protocol/meet2/setFov.md.

Source

pub fn set_face_ae(&self, on: bool) -> Result<()>

Toggle face-based auto-exposure. XU mode-register control id 0x03 - see doc/protocol/meet2/setFaceAE.md.

Source

pub fn set_face_focus(&self, on: bool) -> Result<()>

Toggle face-based auto-focus.

Face-focus rides the XU selector-0x02 RPC channel (cmd_set 0x02, cmd_id 0x36). The frame is synthesised at runtime via meet2::build_rpc_frame; the CRCs at [6,7] and [14,15] are computed by the recovered CRC-16/USB routine.

Source

pub fn set_media_mode(&self, mode: MediaMode) -> Result<()>

Select media mode. XU mode-register control id 0x00 - see doc/protocol/meet2/setMediaMode.md.

Source

pub fn set_auto_framing(&self, mode: AutoFramingMode) -> Result<()>

Set the auto-framing sub-mode. XU mode-register control id 0x0d with a 2-byte value [group_single, close_upper]; see doc/protocol/meet2/setAutoFraming.md.

Source

pub fn set_ai_mode(&self, mode: AiMode) -> Result<()>

Set the AI master mode. XU mode-register control id 0x16 with a u16 LE value; see doc/protocol/meet2/setAiMode.md.

Source

pub fn set_audio_agc(&self, on: bool) -> Result<()>

Toggle the microphone Automatic Gain Control. XU mode-register control id 0x17. The Meet 2’s standard USB Audio Class Feature Unit only exposes Mute + Volume; AGC is an OBSBOT-proprietary control routed through the video XU rather than the audio surface.

Source

pub fn set_flip_horizontal(&self, on: bool) -> Result<()>

Flip the image horizontally (left/right mirror). XU mode-register control id 0x14.

Source

pub fn set_portrait(&self, on: bool) -> Result<()>

Switch between landscape (false) and portrait (true) orientation. XU mode-register control id 0x0c. The SDK calls this “vertical mode”; in portrait mode the camera rotates the pixel stream 90° so streaming apps see a tall frame natively.

Source

pub fn set_led(&self, on: bool) -> Result<()>

Turn the camera’s front-facing status LED on or off. XU mode-register control id 0x18.

Source

pub fn set_bg_enable(&self, on: bool) -> Result<()>

Master enable for the virtual-background system. Disabling this returns the camera to a passthrough live image regardless of the current MediaBgMode.

Source

pub fn set_bg_mode(&self, mode: MediaBgMode) -> Result<()>

Set the virtual-background mode (colour key / replace / blur). Setting this to anything other than MediaBgMode::Disable also requires set_bg_enable to be on.

Source

pub fn set_bg_color(&self, color: MediaBgColor) -> Result<()>

Pick which colour the camera removes when MediaBgMode::Color is active. The SDK enum has two negative sentinels (Disable = -2, Null = -1) and five positive colour values; the wire byte is the SDK value cast to i8.

Source

pub fn set_mask_level(&self, level: u8) -> Result<()>

Set the background-blur intensity, 0 (no blur) to 100 (max).

Source

pub fn set_disable_sleep_without_stream(&self, disable: bool) -> Result<()>

Control whether the camera is allowed to auto-suspend when no host application is streaming from it. true keeps it awake.

Source

pub fn set_suspend_time(&self, minutes: u16) -> Result<()>

Set the auto-suspend timer, in minutes. 0 keeps the camera awake indefinitely (subject to host-side power management).

Source

pub fn set_microphone_during_sleep(&self, on: bool) -> Result<()>

Whether the microphone stays hot while the camera is asleep. Maps to the SDK’s cameraSetMicrophoneDuringSleepU.

Source

pub fn set_button_mode(&self, mode: u8) -> Result<()>

Set the physical-button behaviour. Values are firmware-defined; per CameraStatus.meet.key_mode in the SDK header. The raw byte is sent as-is so callers can pick the encoding the device firmware uses.

Trait Implementations§

Source§

impl Drop for Device

Source§

fn drop(&mut self)

Executes the destructor for this 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