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
impl Device
Sourcepub fn set_status_cadence(&self, cadence: Cadence)
pub fn set_status_cadence(&self, cadence: Cadence)
Change how often the status poller samples the camera.
Sourcepub fn firmware_version(&self) -> &str
pub fn firmware_version(&self) -> &str
Firmware version string. Returns the build-time minimum until a real camera response can be parsed.
Sourcepub fn product_type(&self) -> ProductType
pub fn product_type(&self) -> ProductType
Model enum value.
Sourcepub fn status(&self) -> Result<Status>
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.
Sourcepub fn firmware_from_camera(&self) -> Result<String>
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".
Sourcepub fn firmware(&self) -> Result<FirmwareVersion>
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.
Sourcepub fn serial_from_camera(&self) -> Result<String>
pub fn serial_from_camera(&self) -> Result<String>
Ask the camera for its serial number via the XU RPC channel.
Sourcepub fn set_pan_tilt(&self, pan: f32, tilt: f32) -> Result<()>
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.
Sourcepub fn set_zoom(&self, zoom: f32) -> Result<()>
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.
Sourcepub fn set_focus(&self, focus: f32) -> Result<()>
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.
Sourcepub fn pan_tilt(&self) -> Result<(f32, f32)>
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.
Sourcepub fn zoom(&self) -> Result<f32>
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.
Sourcepub fn focus(&self) -> Result<f32>
pub fn focus(&self) -> Result<f32>
Read current focus value. Same provisional u16-as-f32 mapping
as set_focus.
Sourcepub fn set_auto_focus(&self, on: bool) -> Result<()>
pub fn set_auto_focus(&self, on: bool) -> Result<()>
Enable or disable autofocus. CT_FOCUS_AUTO_CONTROL, u8.
Sourcepub fn auto_focus(&self) -> Result<bool>
pub fn auto_focus(&self) -> Result<bool>
Whether autofocus is currently enabled.
Sourcepub fn set_ae_mode(&self, mode: AeMode) -> Result<()>
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.
Sourcepub fn set_ae_lock(&self, locked: bool) -> Result<()>
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).
Sourcepub fn set_exposure_time(&self, value_100us: u32) -> Result<()>
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.
Sourcepub fn exposure_time(&self) -> Result<u32>
pub fn exposure_time(&self) -> Result<u32>
Read the current exposure time, in 100 us units.
Sourcepub fn exposure_time_range(&self) -> Result<RangeInclusive<u32>>
pub fn exposure_time_range(&self) -> Result<RangeInclusive<u32>>
Reported exposure-time range, in 100 us units.
Sourcepub fn set_brightness(&self, value: i32) -> Result<()>
pub fn set_brightness(&self, value: i32) -> Result<()>
Set brightness. PU_BRIGHTNESS_CONTROL, i16 LE (UVC 1.5 §4.2.2.3.2).
Sourcepub fn brightness(&self) -> Result<i32>
pub fn brightness(&self) -> Result<i32>
Read current brightness.
Sourcepub fn brightness_range(&self) -> Result<RangeInclusive<i32>>
pub fn brightness_range(&self) -> Result<RangeInclusive<i32>>
Reported brightness range.
Sourcepub fn set_contrast(&self, value: i32) -> Result<()>
pub fn set_contrast(&self, value: i32) -> Result<()>
Set contrast. PU_CONTRAST_CONTROL, u16 LE (UVC 1.5 §4.2.2.3.3).
Sourcepub fn contrast_range(&self) -> Result<RangeInclusive<i32>>
pub fn contrast_range(&self) -> Result<RangeInclusive<i32>>
Reported contrast range.
Sourcepub fn set_saturation(&self, value: i32) -> Result<()>
pub fn set_saturation(&self, value: i32) -> Result<()>
Set saturation. PU_SATURATION_CONTROL, u16 LE (UVC 1.5 §4.2.2.3.7).
Sourcepub fn saturation(&self) -> Result<i32>
pub fn saturation(&self) -> Result<i32>
Read current saturation.
Sourcepub fn saturation_range(&self) -> Result<RangeInclusive<i32>>
pub fn saturation_range(&self) -> Result<RangeInclusive<i32>>
Reported saturation range.
Sourcepub fn set_hue(&self, value: i32) -> Result<()>
pub fn set_hue(&self, value: i32) -> Result<()>
Set image hue. PU_HUE_CONTROL, i16 LE (UVC 1.5 §4.2.2.3.4).
Sourcepub fn hue_range(&self) -> Result<RangeInclusive<i32>>
pub fn hue_range(&self) -> Result<RangeInclusive<i32>>
Reported hue range.
Sourcepub fn set_sharpness(&self, value: i32) -> Result<()>
pub fn set_sharpness(&self, value: i32) -> Result<()>
Set image sharpness. PU_SHARPNESS_CONTROL, u16 LE.
Sourcepub fn sharpness_range(&self) -> Result<RangeInclusive<i32>>
pub fn sharpness_range(&self) -> Result<RangeInclusive<i32>>
Reported sharpness range.
Sourcepub fn gain_range(&self) -> Result<RangeInclusive<i32>>
pub fn gain_range(&self) -> Result<RangeInclusive<i32>>
Reported gain range.
Sourcepub fn set_backlight_compensation(&self, value: i32) -> Result<()>
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.
Sourcepub fn backlight_compensation(&self) -> Result<i32>
pub fn backlight_compensation(&self) -> Result<i32>
Read current backlight-compensation value.
Sourcepub fn set_anti_flicker(&self, mode: AntiFlicker) -> Result<()>
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).
Sourcepub fn anti_flicker(&self) -> Result<AntiFlicker>
pub fn anti_flicker(&self) -> Result<AntiFlicker>
Read current anti-flicker mode.
Sourcepub fn set_white_balance(
&self,
mode: WhiteBalanceMode,
kelvin: Option<u16>,
) -> Result<()>
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.
Sourcepub fn white_balance(&self) -> Result<(WhiteBalanceMode, u16)>
pub fn white_balance(&self) -> Result<(WhiteBalanceMode, u16)>
Read current white-balance mode and Kelvin value.
Sourcepub fn white_balance_range(&self) -> Result<RangeInclusive<u16>>
pub fn white_balance_range(&self) -> Result<RangeInclusive<u16>>
Reported manual Kelvin range.
Sourcepub fn set_wdr(&self, mode: WdrMode) -> Result<()>
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.
Sourcepub fn face_ae(&self) -> Result<bool>
pub fn face_ae(&self) -> Result<bool>
Whether face-based auto-exposure is on (XU status blob offset 7).
Sourcepub fn ai_mode(&self) -> Result<AiMode>
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.
Sourcepub fn set_fov(&self, fov: FovType) -> Result<()>
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.
Sourcepub fn set_face_ae(&self, on: bool) -> Result<()>
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.
Sourcepub fn set_face_focus(&self, on: bool) -> Result<()>
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.
Sourcepub fn set_media_mode(&self, mode: MediaMode) -> Result<()>
pub fn set_media_mode(&self, mode: MediaMode) -> Result<()>
Select media mode. XU mode-register control id 0x00 - see
doc/protocol/meet2/setMediaMode.md.
Sourcepub fn set_auto_framing(&self, mode: AutoFramingMode) -> Result<()>
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.
Sourcepub fn set_ai_mode(&self, mode: AiMode) -> Result<()>
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.
Sourcepub fn set_audio_agc(&self, on: bool) -> Result<()>
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.
Sourcepub fn set_flip_horizontal(&self, on: bool) -> Result<()>
pub fn set_flip_horizontal(&self, on: bool) -> Result<()>
Flip the image horizontally (left/right mirror). XU
mode-register control id 0x14.
Sourcepub fn set_portrait(&self, on: bool) -> Result<()>
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.
Sourcepub fn set_led(&self, on: bool) -> Result<()>
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.
Sourcepub fn set_bg_enable(&self, on: bool) -> Result<()>
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.
Sourcepub fn set_bg_mode(&self, mode: MediaBgMode) -> Result<()>
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.
Sourcepub fn set_bg_color(&self, color: MediaBgColor) -> Result<()>
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.
Sourcepub fn set_mask_level(&self, level: u8) -> Result<()>
pub fn set_mask_level(&self, level: u8) -> Result<()>
Set the background-blur intensity, 0 (no blur) to 100 (max).
Sourcepub fn set_disable_sleep_without_stream(&self, disable: bool) -> Result<()>
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.
Sourcepub fn set_suspend_time(&self, minutes: u16) -> Result<()>
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).
Sourcepub fn set_microphone_during_sleep(&self, on: bool) -> Result<()>
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.
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.