Пример #1
0
        /// <summary>
        /// Creates a new <see cref="PinMasterController"/>
        /// </summary>
        /// <param name="aquaI2CController"></param>
        /// <param name="aquaPinController"></param>
        public PinMasterController(IAquaI2CController aquaI2CController, IAquaPinController aquaPinController, DateTime waterChangeTime)
        {
            _aquaI2CController       = aquaI2CController;
            _aquaPinController       = aquaPinController;
            _waterLevelCheckInterval = TimeSpan.FromMilliseconds(250);
            _waterLevelTimer         = new Timer(CheckTopOff, null, TimeSpan.Zero, _waterLevelCheckInterval);
            _waterChangeTimer        = new Timer(CheckWaterChangeLevel, null, Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan);
            _isChangeDrainDone       = false;
            _waterChangeTime         = waterChangeTime;
            _waterChangeInterval     = TimeSpan.FromSeconds(2);


            _waterChangeCheckTimer = new Timer(CheckWaterChangeTime, null, TimeSpan.Zero, _waterChangeInterval);
        }
Пример #2
0
        /// <summary>
        /// Creates a new <see cref="Startup"/> object
        /// </summary>
        /// <param name="env"></param>
        public Startup(IHostingEnvironment env)
        {
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(env.ContentRootPath)
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                            .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                                            .AddEnvironmentVariables();

            Configuration = builder.Build();

            _formDataService = new FormDataService();

            FeedingTimes feedingTimes = _formDataService.GetFeedingTimes();

            _pinController = new AquaPinController(feedingTimes.Feedings, feedingTimes.Pinches);

            TankSpecs tankSpecs = _formDataService.GetTankSpecs();

            _i2CController       = new AquaI2CController(tankSpecs.Width, tankSpecs.Height, tankSpecs.Depth);
            _pinMasterController = new PinMasterController(_i2CController, _pinController, tankSpecs.WaterChangeTime);
        }
Пример #3
0
 /// <summary>
 /// Constructs a new
 /// </summary>
 /// <param name="formDataService"></param>
 public TankController(IFormDataService formDataService, IAquaI2CController aquaI2CController, IPinMasterController pinMasterController)
 {
     _formDataService     = formDataService;
     _aquaI2CController   = aquaI2CController;
     _pinMasterController = pinMasterController;
 }
Пример #4
0
 public MaintainaceController(IAquaPinController aquaPinController, IAquaI2CController aquaI2CController, IPinMasterController pinMasterController)
 {
     _aquaPinController   = aquaPinController;
     _aquaI2CController   = aquaI2CController;
     _pinMasterController = pinMasterController;
 }