kinect/
device_configuration.rs

1use k4a_sys_temp as k4a_sys;
2
3/// Copied from k4a-sys
4pub struct DeviceConfiguration (pub k4a_sys::k4a_device_configuration_t);
5
6/// Copied from k4a-sys
7impl DeviceConfiguration {
8    pub fn new() -> Self {
9        Self (k4a_sys::k4a_device_configuration_t {
10            color_format: k4a_sys::k4a_image_format_t_K4A_IMAGE_FORMAT_COLOR_MJPG,
11            color_resolution: k4a_sys::k4a_color_resolution_t_K4A_COLOR_RESOLUTION_720P,
12            depth_mode: k4a_sys::k4a_depth_mode_t_K4A_DEPTH_MODE_WFOV_2X2BINNED,
13            camera_fps: 0,
14            synchronized_images_only: false,
15            depth_delay_off_color_usec: 0,
16            wired_sync_mode: 0,
17            subordinate_delay_off_master_usec: 0,
18            disable_streaming_indicator: false,
19        })
20    }
21
22    /// Returns a default configuration with everything disabled, mimicking the constant
23    /// K4A_DEVICE_CONFIG_INIT_DISABLE_ALL.
24    ///
25    /// K4A docs: "Initial configuration setting for disabling all sensors."
26    /// "    Use this setting to initialize a k4a_device_configuration_t to a disabled state."
27    pub fn init_disable_all() -> Self {
28        // This is the same as K4A_DEVICE_CONFIG_INIT_DISABLE_ALL, which I can't seem to reference.
29        Self (k4a_sys::k4a_device_configuration_t {
30            color_format: k4a_sys::k4a_image_format_t_K4A_IMAGE_FORMAT_COLOR_MJPG,
31            color_resolution: k4a_sys::k4a_color_resolution_t_K4A_COLOR_RESOLUTION_OFF,
32            depth_mode: k4a_sys::k4a_depth_mode_t_K4A_DEPTH_MODE_OFF,
33            camera_fps: k4a_sys::k4a_fps_t_K4A_FRAMES_PER_SECOND_30,
34            synchronized_images_only: false,
35            depth_delay_off_color_usec: 0,
36            wired_sync_mode: k4a_sys::k4a_wired_sync_mode_t_K4A_WIRED_SYNC_MODE_STANDALONE,
37            subordinate_delay_off_master_usec: 0,
38            disable_streaming_indicator: false,
39        })
40    }
41}
42