rodecaster_protocol/names/storage.rs
1//! [`StorageVolumeParam`]: per-`STORAGEVOLUME`-node parameter family.
2
3// The eleven properties a real Pro II / Duo fullSync carries on each
4// STORAGEVOLUME node (confirmed from capture, firmware 1.7.3). One volume is
5// the SD card; there may be more if other storage is attached. `storageVolume`
6// nodes address by index: see `Layout::storage_volume_path`.
7wire_param_enum! {
8 /// A storage-volume parameter: one of the flat properties the device
9 /// carries on each `STORAGEVOLUME` node. Read-back state describes the
10 /// volume's capacity, free bytes, mount + format status, and the pipe-
11 /// separated `storageVolumeState` progress string that the device
12 /// updates live during recording (`total|used|f|f|f`). Command channel
13 /// props (`Eject`, `Erase`, `Transfer`) request device-side actions.
14 StorageVolumeParam {
15 // Identity + capacity.
16 Name => "storageVolumeName",
17 Capacity => "storageVolumeCapacity",
18 Free => "storageVolumeFree",
19 // Mount / format lifecycle.
20 Inserted => "storageVolumeInserted",
21 Mounted => "storageVolumeMounted",
22 Formatted => "storageVolumeFormatted",
23 // Recording destination flag + live progress.
24 RecDestination => "storageVolumeRecDestination",
25 State => "storageVolumeState",
26 // Command channel.
27 Eject => "storageVolumeEject",
28 Erase => "storageVolumeErase",
29 Transfer => "storageVolumeTransfer",
30 }
31}
32
33#[cfg(test)]
34mod tests {
35 use super::*;
36
37 #[test]
38 fn storage_volume_param_name_round_trips() {
39 let params = [
40 StorageVolumeParam::Name,
41 StorageVolumeParam::Capacity,
42 StorageVolumeParam::Free,
43 StorageVolumeParam::Inserted,
44 StorageVolumeParam::Mounted,
45 StorageVolumeParam::Formatted,
46 StorageVolumeParam::RecDestination,
47 StorageVolumeParam::State,
48 StorageVolumeParam::Eject,
49 StorageVolumeParam::Erase,
50 StorageVolumeParam::Transfer,
51 ];
52 for p in params {
53 assert_eq!(StorageVolumeParam::from_name(p.as_str()), p);
54 assert!(p.is_known());
55 }
56 }
57
58 #[test]
59 fn storage_volume_param_state_pipe_string_is_caller_owned() {
60 // `storageVolumeState` values arrive as pipe-separated strings like
61 // "15927934976|11134074880|1|1|1": the crate types the property name,
62 // parsing the fields is the caller's job.
63 assert_eq!(StorageVolumeParam::State.as_str(), "storageVolumeState");
64 }
65}