1#![cfg_attr(not(feature = "std"), no_std)]
2
3extern crate alloc;
12
13mod util;
14
15pub mod commands;
16pub use commands::{Commands, FromMemory};
17
18pub mod packet;
19use device::{probe_kind, DeviceKind};
20pub use packet::ParseError;
21
22pub mod source;
23pub use source::Source;
24
25#[cfg(feature = "devices")]
26pub mod device;
27
28pub mod eeprom;
29
30pub mod fixed_point;
31pub use fixed_point::FixedPoint;
32
33pub mod dialect;
34pub use dialect::{AddrEncoding, Dialect, FloatEncoding};
35
36#[derive(Copy, Clone)]
37#[cfg_attr(feature = "debug", derive(Debug))]
38#[cfg_attr(
39 feature = "use_serde",
40 derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema)
41)]
42pub struct DeviceInfo {
44 pub hw_id: u8,
45 pub dsp_version: u8,
46 pub serial: u32,
47}
48
49impl DeviceInfo {
50 pub fn device_kind(&self) -> DeviceKind {
51 probe_kind(self)
52 }
53
54 pub fn supports_dirac(&self) -> bool {
55 matches!(self.dsp_version, 61 | 94 | 95 | 101 | 105)
56 }
57}
58
59#[derive(Default, Clone, PartialEq)]
60#[cfg_attr(feature = "debug", derive(Debug))]
61#[cfg_attr(
62 feature = "use_serde",
63 derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema)
64)]
65pub struct MasterStatus {
67 pub preset: Option<u8>,
69
70 pub source: Option<Source>,
72
73 pub volume: Option<commands::Gain>,
75
76 pub mute: Option<bool>,
78
79 pub dirac: Option<bool>,
81}