1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#[derive(Clone)]
/// Integer control knob
pub struct Integer {
    /// Valid value range (inclusive on both ends)
    pub range: (i64, i64),
    /// Valid range step size
    pub step: u64,
    /// Default value
    pub default: i64,
}

#[derive(Clone)]
/// Device control menu item
pub enum MenuItem {
    /// String representation, use this as fallback
    String(String),
    /// Integer representation
    Integer(i64),
}

#[derive(Clone)]
/// Device control representation
pub enum Representation {
    /* Unknown */
    Unknown,

    /* Stateless controls */
    Button,

    /* Single value controls */
    Boolean,
    Integer(Integer),
    String,

    /* Multi value controls */
    Bitmask,
    Menu(Vec<MenuItem>),
}

#[derive(Clone)]
/// Device control value representation
pub enum Value {
    /* Single value controls */
    String(String),
    Boolean(bool),
    Integer(i64),
}