pub struct GPIOHeatingControl<G: GPIOManager> {
    gpio_manager: G,
    pins: GPIOPins,
    should_sleep: bool,
    valve_start_open_time: Duration,
    valve_change_time: Duration,
    pump_water_slow_time: Duration,
    extra_heat_pump_water_slow_time: Duration,
    heat_pump_last_changed: DateTime<Utc>,
}

Fields§

§gpio_manager: G§pins: GPIOPins§should_sleep: bool§valve_start_open_time: Duration§valve_change_time: Duration§pump_water_slow_time: Duration§extra_heat_pump_water_slow_time: Duration§heat_pump_last_changed: DateTime<Utc>

Implementations§

source§

impl<G: GPIOManager> GPIOHeatingControl<G>

source

pub fn create( pins: GPIOPins, gpio_manager: G, control_config: &ControlConfig ) -> Result<Self, GPIOError>

source

fn get_valve_pin(&self, valve: &Valve) -> usize

source

fn get_pump_pin(&self, pump: &Pump) -> usize

source

fn set_valve(&mut self, valve: &Valve, open: bool) -> Result<(), BrainFailure>

source

fn get_valve(&self, valve: &Valve) -> Result<bool, BrainFailure>

source

fn set_pump(&mut self, pump: &Pump, on: bool) -> Result<(), BrainFailure>

source

fn get_pump(&self, pump: &Pump) -> Result<bool, BrainFailure>

source

fn wait_for(&self, amount: Duration, why: &str)

source

fn switch_to_configuration( &mut self, config: &ValveAndPumpConfiguration ) -> Result<(), BrainFailure>

source

fn update_pumps_if_needed( &mut self, config: &ValveAndPumpConfiguration, to: bool ) -> Result<bool, BrainFailure>

Change pumps’ state to the given state if they are not already in that state. To turn on pumps that need turning on, call with to: true To turn off pumps that need turning off, call with to: false

source

fn update_valves_if_needed( &mut self, config: &ValveAndPumpConfiguration, to: bool ) -> Result<bool, BrainFailure>

Change valves’ state to the given state if they are not already in that state. To open valves that need opening, call with to: true To turn off pumps that need closing, call with to: false

source

fn change_valve_if_needed( &mut self, valve: &Valve, open: bool ) -> Result<bool, BrainFailure>

Change the valve to the given state if needed. Returns whether the valve was changed.

source

fn change_pump_if_needed( &mut self, pump: &Pump, open: bool ) -> Result<bool, BrainFailure>

Change the pump to the given state if needed. Returns whether the pump was changed.

Trait Implementations§

Auto Trait Implementations§

§

impl<G> RefUnwindSafe for GPIOHeatingControl<G>
where G: RefUnwindSafe,

§

impl<G> Send for GPIOHeatingControl<G>

§

impl<G> Sync for GPIOHeatingControl<G>
where G: Sync,

§

impl<G> Unpin for GPIOHeatingControl<G>
where G: Unpin,

§

impl<G> UnwindSafe for GPIOHeatingControl<G>
where G: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more