private void LogState() { IBoiler boiler = _repo.Retrieve(); BoilerStatus bs = new BoilerStatus(boiler); bs.LoggedDate = DateTime.Now; _logger.Save(bs); }
public IBoiler Save(IBoiler boiler) { elementPin.State = boiler.IsElementOn.AsGPIOState(); pumpPin.State = boiler.IsPumpOn.AsGPIOState(); _boiler.TargetTemp = boiler.TargetTemp; _boiler.TempOffset = boiler.TempOffset; return(this.Retrieve()); }
public MockRepository() { _boiler = new Boiler(); _boiler.ActualTemp = 10; _boiler.TargetTemp = 20; _saveCalledCount = 0; _retrieveCalledCount = 0; _lastRecorded = DateTime.Now; }
public BoilerStatus(IBoiler boiler) { IsElementOn= boiler.IsElementOn; IsPumpOn = boiler.IsPumpOn; IsBurstOn = boiler.IsBurstOn; IsAuto = boiler.IsAuto; TargetTemp = boiler.TargetTemp; TempOffset = boiler.TempOffset; ActualTemp = boiler.ActualTemp; BurstTime = boiler.BurstTime; BurstInterval = boiler.BurstInterval; }
public BoilerStatus(IBoiler boiler) { IsElementOn = boiler.IsElementOn; IsPumpOn = boiler.IsPumpOn; IsBurstOn = boiler.IsBurstOn; IsAuto = boiler.IsAuto; TargetTemp = boiler.TargetTemp; TempOffset = boiler.TempOffset; ActualTemp = boiler.ActualTemp; BurstTime = boiler.BurstTime; BurstInterval = boiler.BurstInterval; }
public BoilerMonitor(IBoilerRepository repo, ITimerAdapter timer, IBoilerStatusRepository logger) { _repo = repo; _logger = logger; lastOff = DateTime.Now.AddHours(-1); IBoiler b = logger.Retrieve().ToBoiler(); _repo.Save(b); timer.Initialize(MonitorState); }
private void MonitorState(object source) { IBoiler boiler = _repo.Retrieve(); DateTime n = DateTime.Now; boiler.DisableOnHighTemp(); boiler.EnableOnLowTemp(n); boiler.BurstCycleOff(n); boiler.BurstCycleOn(n); _repo.Save(boiler); LogState(); }
public IBoiler Save(IBoiler boiler) { _saveCalledCount++; _boiler = boiler; // fudge to make the gauge move tick. decimal diffInSeconds = (decimal)((DateTime.Now - _lastRecorded).TotalSeconds); boiler.ActualTemp = Math.Round(boiler.ActualTemp + (diffInSeconds * (boiler.IsElementOn == false ? -1 : 1)),2); if (boiler.ActualTemp > 100) boiler.ActualTemp = 100; if (boiler.ActualTemp < 0) boiler.ActualTemp = 0; _lastRecorded = DateTime.Now; return this.Retrieve(); }
public IBoiler Save(IBoiler boiler) { _saveCalledCount++; _boiler = boiler; // fudge to make the gauge move tick. decimal diffInSeconds = (decimal)((DateTime.Now - _lastRecorded).TotalSeconds); boiler.ActualTemp = Math.Round(boiler.ActualTemp + (diffInSeconds * (boiler.IsElementOn == false ? -1 : 1)), 2); if (boiler.ActualTemp > 100) { boiler.ActualTemp = 100; } if (boiler.ActualTemp < 0) { boiler.ActualTemp = 0; } _lastRecorded = DateTime.Now; return(this.Retrieve()); }
public Boiler(IBoiler hardware) { this._hardware = hardware; }
public EspressoMaker(IBeanGrinder beanGrinder, IBoiler waterBoiler, IPortaFilter portaFilter) { _beanGrinder = beanGrinder; _waterBoiler = waterBoiler; _portaFilter = portaFilter; }