rodecaster_protocol/names/radio.rs
1//! Wireless-mic radio parameter families: [`RadioParam`] (pairing / lifecycle),
2//! [`RadioTxParam`] (per-transmitter state), and [`RadioRxParam`]
3//! (per-receiver state).
4
5// RADIO node carries three pairing-lifecycle properties (confirmed from
6// capture, firmware 1.7.3). Pair/Unpair are command channels; Paired is a
7// read-back flag reporting the current pairing state.
8wire_param_enum! {
9 /// A wireless-radio-pairing parameter: the three flat properties on the
10 /// `RADIO` node. `Pair` and `Unpair` are command channels; `Paired`
11 /// reports whether a transmitter is currently paired. These are
12 /// device-side entrypoints for the RODE Wireless GO integration.
13 RadioParam {
14 Pair => "radioPair",
15 Paired => "radioPaired",
16 Unpair => "radioUnpair",
17 }
18}
19
20// RADIOTX nodes carry twelve per-transmitter properties (confirmed from
21// capture, firmware 1.7.3). Battery / connection / signal-quality state
22// (read-back) plus writable settings for gain assist, mute, pad, record.
23wire_param_enum! {
24 /// A per-transmitter wireless-radio parameter: the flat properties on
25 /// each `RADIOTX` node. Read-back state: battery level, charging state,
26 /// connection status + connection id, device serial + type, RSSI, signal
27 /// quality. Writable settings: gain assist, pad, remote mute, record.
28 RadioTxParam {
29 BatteryLevel => "txBatteryLevel",
30 ChargingState => "txChargingState",
31 Connected => "txConnected",
32 ConnectionId => "txConnectionId",
33 DeviceSn => "txDeviceSN",
34 DeviceType => "txDeviceType",
35 GainAssist => "txGainAssist",
36 Pad => "txPad",
37 Record => "txRecord",
38 RemoteMute => "txRemoteMute",
39 Rssi => "txRssi",
40 SignalQuality => "txSignalQuality",
41 }
42}
43
44// RADIORX carries a single per-receiver property (confirmed from capture,
45// firmware 1.7.3): the receiver's radio identifier.
46wire_param_enum! {
47 /// A per-receiver wireless-radio parameter: the one flat property on
48 /// each `RADIORX` node. `RadioId` identifies which receiver this is.
49 RadioRxParam {
50 RadioId => "rxRadioId",
51 }
52}
53
54#[cfg(test)]
55mod tests {
56 use super::*;
57
58 #[test]
59 fn radio_param_round_trips() {
60 for p in [RadioParam::Pair, RadioParam::Paired, RadioParam::Unpair] {
61 assert_eq!(RadioParam::from_name(p.as_str()), p);
62 assert!(p.is_known());
63 }
64 }
65
66 #[test]
67 fn radio_tx_param_round_trips_all_twelve() {
68 let params = [
69 RadioTxParam::BatteryLevel,
70 RadioTxParam::ChargingState,
71 RadioTxParam::Connected,
72 RadioTxParam::ConnectionId,
73 RadioTxParam::DeviceSn,
74 RadioTxParam::DeviceType,
75 RadioTxParam::GainAssist,
76 RadioTxParam::Pad,
77 RadioTxParam::Record,
78 RadioTxParam::RemoteMute,
79 RadioTxParam::Rssi,
80 RadioTxParam::SignalQuality,
81 ];
82 for p in params {
83 assert_eq!(RadioTxParam::from_name(p.as_str()), p);
84 assert!(p.is_known());
85 }
86 }
87
88 #[test]
89 fn radio_tx_param_preserves_capitalized_sn() {
90 assert_eq!(RadioTxParam::DeviceSn.as_str(), "txDeviceSN");
91 }
92
93 #[test]
94 fn radio_rx_param_round_trips() {
95 assert_eq!(RadioRxParam::from_name("rxRadioId"), RadioRxParam::RadioId);
96 assert!(RadioRxParam::RadioId.is_known());
97 }
98}