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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
mod util;
pub mod commands;
pub use commands::{Commands, FromMemory};
pub mod packet;
use device::{probe_kind, DeviceKind};
pub use packet::ParseError;
pub mod source;
pub use source::Source;
#[cfg(feature = "devices")]
pub mod device;
pub mod eeprom;
pub mod fixed_point;
pub use fixed_point::FixedPoint;
pub mod dialect;
pub use dialect::{AddrEncoding, Dialect, FloatEncoding};
#[derive(Copy, Clone)]
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(
feature = "use_serde",
derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema)
)]
pub struct DeviceInfo {
pub hw_id: u8,
pub dsp_version: u8,
pub serial: u32,
}
impl DeviceInfo {
pub fn device_kind(&self) -> DeviceKind {
probe_kind(self)
}
pub fn supports_dirac(&self) -> bool {
matches!(self.dsp_version, 61 | 94 | 95 | 101 | 105)
}
}
#[derive(Default, Clone, PartialEq)]
#[cfg_attr(feature = "debug", derive(Debug))]
#[cfg_attr(
feature = "use_serde",
derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema)
)]
pub struct MasterStatus {
pub preset: Option<u8>,
pub source: Option<Source>,
pub volume: Option<commands::Gain>,
pub mute: Option<bool>,
pub dirac: Option<bool>,
}