aquarium_control/permission/
schedule_check_channels.rs1use crate::launch::channels::{AquaChannelError, AquaReceiver, AquaSender};
10use crate::utilities::channel_content::InternalCommand;
11use std::fmt;
12
13pub struct ScheduleCheckChannels {
15 pub tx_schedule_check_to_ventilation: AquaSender<bool>,
17
18 pub rx_schedule_check_from_ventilation: AquaReceiver<InternalCommand>,
20
21 pub tx_schedule_check_to_heating: AquaSender<bool>,
23
24 pub rx_schedule_check_from_heating: AquaReceiver<InternalCommand>,
26
27 pub tx_schedule_check_to_refill: AquaSender<bool>,
29
30 pub rx_schedule_check_from_refill: AquaReceiver<InternalCommand>,
32
33 pub tx_schedule_check_to_balling: AquaSender<bool>,
35
36 pub rx_schedule_check_from_balling: AquaReceiver<InternalCommand>,
38
39 pub tx_schedule_check_to_signal_handler: AquaSender<bool>,
41
42 pub rx_schedule_check_from_signal_handler: AquaReceiver<InternalCommand>,
44}
45
46impl ScheduleCheckChannels {
47 pub fn send_to_signal_handler(&mut self, ack: bool) -> Result<(), AquaChannelError> {
49 self.tx_schedule_check_to_signal_handler.send(ack)
50 }
51}
52
53#[cfg(feature = "debug_channels")]
54impl fmt::Display for ScheduleCheckChannels {
55 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
56 writeln!(f, "=== ScheduleCheckChannels ===")?;
57 writeln!(
58 f,
59 "tx_schedule_check_to_ventilation: {}",
60 self.tx_schedule_check_to_ventilation.count
61 )?;
62 writeln!(
63 f,
64 "rx_schedule_check_from_ventilation: {}",
65 self.rx_schedule_check_from_ventilation.count
66 )?;
67 writeln!(
68 f,
69 "tx_schedule_check_to_heating: {}",
70 self.tx_schedule_check_to_heating.count
71 )?;
72 writeln!(
73 f,
74 "rx_schedule_check_from_heating: {}",
75 self.rx_schedule_check_from_heating.count
76 )?;
77 writeln!(
78 f,
79 "tx_schedule_check_to_refill: {}",
80 self.tx_schedule_check_to_refill.count
81 )?;
82 writeln!(
83 f,
84 "rx_schedule_check_from_refill: {}",
85 self.rx_schedule_check_from_refill.count
86 )?;
87 writeln!(
88 f,
89 "tx_schedule_check_to_balling: {}",
90 self.tx_schedule_check_to_balling.count
91 )?;
92 writeln!(
93 f,
94 "rx_schedule_check_from_balling: {}",
95 self.rx_schedule_check_from_balling.count
96 )?;
97 writeln!(
98 f,
99 "tx_schedule_check_to_signal_handler: {}",
100 self.tx_schedule_check_to_signal_handler.count
101 )?;
102 write!(
103 f,
104 "rx_schedule_check_from_signal_handler: {}",
105 self.rx_schedule_check_from_signal_handler.count
106 )
107 }
108}
109
110#[cfg(not(feature = "debug_channels"))]
111impl fmt::Display for ScheduleCheckChannels {
112 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
113 write!(
114 f,
115 "Channel counters are not active. Use --features \"debug_channels\" to enable them."
116 )
117 }
118}