pub struct MessagingChannels {
pub tx_messaging_to_signal_handler: AquaSender<bool>,
pub rx_messaging_from_signal_handler: AquaReceiver<InternalCommand>,
pub tx_messaging_to_refill: AquaSender<InternalCommand>,
pub tx_messaging_to_ventilation: AquaSender<InternalCommand>,
pub tx_messaging_to_heating: AquaSender<InternalCommand>,
pub tx_messaging_to_feed: AquaSender<InternalCommand>,
pub tx_messaging_to_balling: AquaSender<InternalCommand>,
pub tx_messaging_to_monitors: AquaSender<InternalCommand>,
pub tx_messaging_to_watchdog: AquaSender<InternalCommand>,
}Expand description
Collects all channels used by the Messaging module for IPC.
This struct acts as a central container for all the communication endpoints
that the Messaging module uses to dispatch commands received via a POSIX
message queue to the appropriate application threads (domains). It also
includes channels for communicating with the SignalHandler for graceful shutdown.
This entire struct is conditionally compiled and is only available on Linux systems, as POSIX message queues are a platform-specific feature.
Fields§
§tx_messaging_to_signal_handler: AquaSender<bool>Sender for sending acknowledgments back to the SignalHandler.
rx_messaging_from_signal_handler: AquaReceiver<InternalCommand>Receiver for commands from the SignalHandler (e.g., Quit, Terminate).
tx_messaging_to_refill: AquaSender<InternalCommand>Sender for dispatching commands to the Refill module.
tx_messaging_to_ventilation: AquaSender<InternalCommand>Sender for dispatching commands to the Ventilation module.
tx_messaging_to_heating: AquaSender<InternalCommand>Sender for dispatching commands to the Heating module.
tx_messaging_to_feed: AquaSender<InternalCommand>Sender for dispatching commands to the Feed module.
tx_messaging_to_balling: AquaSender<InternalCommand>Sender for dispatching commands to the Balling module.
tx_messaging_to_monitors: AquaSender<InternalCommand>Sender for dispatching commands to the Monitors module.
tx_messaging_to_watchdog: AquaSender<InternalCommand>Sender for dispatching commands to the Watchdog module.
Implementations§
Source§impl MessagingChannels
impl MessagingChannels
Sourcepub fn send_command_to_domain(
&mut self,
command: InternalCommand,
domain: MessagingDomain,
) -> Result<(), MessagingError>
pub fn send_command_to_domain( &mut self, command: InternalCommand, domain: MessagingDomain, ) -> Result<(), MessagingError>
Dispatches a command to the appropriate application domain (thread).
This function acts as a router, taking a generic InternalCommand and a
MessagingDomain and sending the command to the correct channel based on
the specified domain. It also handles the conditional incrementing of debug
counters when the debug_channels feature is enabled.
§Arguments
command- TheInternalCommand(e.g.,Start,Stop) to be sent.domain- The targetMessagingDomain(e.g.,Refill,Heating) that should receive the command.
§Returns
An empty Result (Ok(())) if the command was successfully sent.
§Errors
Returns a MessagingError if:
- The
domainisMessagingDomain::Unknown. - The target channel is disconnected (i.e., the receiving thread has terminated),
wrapped in
MessagingError::ChannelSendError.
Sourcepub fn send_to_signal_handler(
&mut self,
ack: bool,
) -> Result<(), AquaChannelError>
pub fn send_to_signal_handler( &mut self, ack: bool, ) -> Result<(), AquaChannelError>
Sends an acknowledgment to the signal handler.
Trait Implementations§
Source§impl AcknowledgeSignalHandlerTrait for MessagingChannels
impl AcknowledgeSignalHandlerTrait for MessagingChannels
Source§fn send_true_to_signal_handler(&mut self) -> Result<(), AquaChannelError>
fn send_true_to_signal_handler(&mut self) -> Result<(), AquaChannelError>
Source§fn location(&self) -> String
fn location(&self) -> String
Source§fn acknowledge_signal_handler(&mut self)
fn acknowledge_signal_handler(&mut self)
SignalHandler by sending a confirmation message. Read more