settings/input/
input_device_configuration.rs1use crate::config::default_settings::DefaultSetting;
6use crate::input::types::{DeviceStateSource, InputDeviceType};
7use crate::inspect::config_logger::InspectConfigLogger;
8use serde::Deserialize;
9use std::rc::Rc;
10use std::sync::Mutex;
11
12#[derive(PartialEq, Debug, Default, Clone, Deserialize)]
13pub struct InputConfiguration {
14 pub devices: Vec<InputDeviceConfiguration>,
16}
17
18#[derive(PartialEq, Debug, Clone, Deserialize)]
19pub struct InputDeviceConfiguration {
20 pub device_name: String,
25
26 pub device_type: InputDeviceType,
28
29 pub source_states: Vec<SourceState>,
31
32 pub mutable_toggle_state: u64,
35}
36
37#[derive(PartialEq, Debug, Clone, Deserialize)]
38pub struct SourceState {
39 pub source: DeviceStateSource,
41
42 pub state: u64,
45}
46pub fn build_input_default_settings(
47 config_logger: Rc<Mutex<InspectConfigLogger>>,
48) -> DefaultSetting<InputConfiguration, &'static str> {
49 DefaultSetting::new(
50 Some(InputConfiguration::default()),
51 "/config/data/input_device_config.json",
52 config_logger,
53 )
54}