Skip to main content

rodecaster_protocol/names/
recording.rs

1//! [`RecordingsParam`] + [`RecordingParam`]: the recordings container + per-
2//! recording parameter families.
3
4// The three properties a real Pro II / Duo fullSync carries on the singleton
5// RECORDINGS container node (confirmed from capture, firmware 1.7.3): summary
6// counts + a request-to-delete command channel.
7wire_param_enum! {
8    /// A recordings-container parameter: one of the flat properties the device
9    /// carries on the singleton `RECORDINGS` node (the parent of individual
10    /// `RECORDING` child nodes). Read-back state summarizes the collection
11    /// (total count + total duration seconds). `RequestDeleteUid` is the write
12    /// channel that removes a recording by its `RecordingParam::Uid`.
13    RecordingsParam {
14    TotalCount => "recordingTotalCount",
15    TotalDuration => "recordingTotalDuration",
16    RequestDeleteUid => "requestDeleteUID",
17    }
18}
19
20// The two properties a real Pro II / Duo fullSync carries on each RECORDING
21// child node (confirmed from capture, firmware 1.7.3). `Content` is a pipe-
22// separated metadata string: `name|hash|path|timestampMs|durationSec|flags...`.
23// `Uid` is a stable integer identifier used by `RecordingsParam::RequestDeleteUid`.
24wire_param_enum! {
25    /// A per-recording parameter: one of the two flat properties the device
26    /// carries on each `RECORDING` child node under the `RECORDINGS`
27    /// container. `Content` arrives as a pipe-separated field string
28    /// (`name|hash|path|timestampMs|durationSec|flags...`); the crate types
29    /// the property name and leaves field parsing to the caller.
30    RecordingParam {
31    Content => "recordingContent",
32    Uid => "recordingUID",
33    }
34}
35
36#[cfg(test)]
37mod tests {
38    use super::*;
39
40    #[test]
41    fn recordings_param_name_round_trips() {
42        let params = [
43            RecordingsParam::TotalCount,
44            RecordingsParam::TotalDuration,
45            RecordingsParam::RequestDeleteUid,
46        ];
47        for p in params {
48            assert_eq!(RecordingsParam::from_name(p.as_str()), p);
49            assert!(p.is_known());
50        }
51    }
52
53    #[test]
54    fn recording_param_name_round_trips() {
55        let params = [RecordingParam::Content, RecordingParam::Uid];
56        for p in params {
57            assert_eq!(RecordingParam::from_name(p.as_str()), p);
58            assert!(p.is_known());
59        }
60    }
61
62    #[test]
63    fn recording_param_preserves_firmware_casing() {
64        assert_eq!(RecordingParam::Uid.as_str(), "recordingUID");
65        assert_eq!(
66            RecordingsParam::RequestDeleteUid.as_str(),
67            "requestDeleteUID"
68        );
69    }
70}