pub trait ProcessExternalRequestTrait {
// Provided method
fn process_external_request(
&mut self,
rx_from_signal_handler: &mut AquaReceiver<InternalCommand>,
rx_from_messaging_opt: Option<&mut AquaReceiver<InternalCommand>>,
) -> (bool, bool, bool) { ... }
}Expand description
This trait defines a common interface for processing external requests, such as commands received from a signal handler or a messaging system. It’s designed to be implemented by various control modules in the system.
The default implementation provided here handles basic “Quit,” “Start,” and “Stop” commands, logging warnings for other inapplicable commands and errors for channel disconnection. This default is used by modules like heating control, ventilation control, and monitors.
More specialized modules, including Refill control, Data logger, Balling, Food injection, Water injection, Mineral injection, Schedule check, Controllino, Gpio handler, Feed, Messaging, and TCP communication, provide their own specific implementations of this trait.
Provided Methods§
Sourcefn process_external_request(
&mut self,
rx_from_signal_handler: &mut AquaReceiver<InternalCommand>,
rx_from_messaging_opt: Option<&mut AquaReceiver<InternalCommand>>,
) -> (bool, bool, bool)
fn process_external_request( &mut self, rx_from_signal_handler: &mut AquaReceiver<InternalCommand>, rx_from_messaging_opt: Option<&mut AquaReceiver<InternalCommand>>, ) -> (bool, bool, bool)
Checks for and processes new commands received from the signal handler and an optional messaging channel.
This function attempts to receive InternalCommand messages without blocking from two potential sources:
a required channel from the signal handler and an optional channel from a messaging system.
It specifically looks for Quit commands from the signal handler and Start/Stop commands
from the messaging channel, ignoring other commands and logging warnings for them.
Channel disconnection errors are also logged.
§Arguments
rx_from_signal_handler- A reference to the receiver end of the channel for commands originating from the signal handler.rx_from_messaging_opt- AnOptioncontaining a reference to the receiver end of the channel for commands from the messaging system. This channel is optional.
§Returns
A tuple (bool, bool, bool) indicating the status of specific commands received:
- The first
boolistrueif aQuitcommand was received from the signal handler; otherwisefalse. - The second
boolistrueif aStartcommand was received from messaging; otherwisefalse. - The third
boolistrueif aStopcommand was received from messaging; otherwisefalse.