Пример #1
0
 public void Stop()
 {
     if (!this.disposed && fanControl != null)
     {
         SettingsService.Settings.Autostart = false;
         SaveSettings();
         fanControl.Stop();
     }
 }
Пример #2
0
        public void Stop()
        {
            if (!this.disposed && fanControl != null)
            {
                try
                {
                    ServiceSettings.Default.Autostart = false;
                    ServiceSettings.Save();
                }
                catch
                {
                }

                fanControl.Stop();
            }
        }
Пример #3
0
        public void Stop()
        {
            if (!this.disposed && fanControl != null)
            {
                try
                {
                    ServiceSettings.Default.Autostart       = false;
                    ServiceSettings.Default.TargetFanSpeeds = GetTargetFanSpeeds(this.fanControl.FanInformation);
                    ServiceSettings.Save();
                }
                catch
                {
                }

                fanControl.Stop();
            }
        }
Пример #4
0
        public void Stop()
        {
            if (!this.disposed && fanControl != null)
            {
                try
                {
                    SettingsService.Settings.Autostart = false;
                    SettingsService.Save();
                }
                catch (Exception e)
                {
                    logger.Error(e, "Failed to save settings");
                }

                fanControl.Stop();
            }
        }
Пример #5
0
            public void ResetsRegisterWriteConfigurations()
            {
                var fanCfg      = new FanConfiguration();
                var regWriteCfg = new RegisterWriteConfiguration()
                {
                    Register      = 123,
                    Value         = 12,
                    ResetRequired = true,
                    ResetValue    = 24
                };

                var cfg = new FanControlConfigV2()
                {
                    EcPollInterval              = 100,
                    FanConfigurations           = { fanCfg },
                    RegisterWriteConfigurations = { regWriteCfg }
                };

                var filter = A.Fake <ITemperatureFilter>();

                A.CallTo(() => filter.FilterTemperature(A <double> .Ignored)).ReturnsLazily((double x) => x);

                var ec = A.Fake <IEmbeddedController>();

                A.CallTo(() => ec.IsInitialized).Returns(true);
                A.CallTo(() => ec.AcquireLock(A <int> .Ignored)).Returns(true);
                A.CallTo(() => ec.ReadByte(A <byte> .Ignored)).Returns((byte)0);

                var tempMon = A.Fake <ITemperatureMonitor>();

                A.CallTo(() => tempMon.IsInitialized).Returns(true);

                using (var fanControl = new FanControl(cfg, filter, ec, tempMon))
                {
                    fanControl.Start(false);
                    fanControl.Stop();

                    A.CallTo(() => ec.WriteByte((byte)regWriteCfg.Register, (byte)regWriteCfg.ResetValue))
                    .MustHaveHappened();
                }
            }
Пример #6
0
            public void CallsResetOnFans()
            {
                var fanCfg = new FanConfiguration()
                {
                    ResetRequired = true
                };

                var cfg = new FanControlConfigV2()
                {
                    EcPollInterval    = 100,
                    FanConfigurations = { fanCfg }
                };

                var filter = A.Fake <ITemperatureFilter>();

                A.CallTo(() => filter.FilterTemperature(A <double> .Ignored)).ReturnsLazily((double x) => x);

                var ec = A.Fake <IEmbeddedController>();

                A.CallTo(() => ec.IsInitialized).Returns(true);
                A.CallTo(() => ec.AcquireLock(A <int> .Ignored)).Returns(true);

                var tempMon = A.Fake <ITemperatureMonitor>();

                A.CallTo(() => tempMon.IsInitialized).Returns(true);

                var fan = A.Fake <Fan>(opt => opt.WithArgumentsForConstructor(
                                           new object[] { ec, fanCfg, 70, false }));

                A.CallTo(() => fan.GetCurrentSpeed()).Returns(0);

                using (var fanControl = new FanControl(cfg, filter, ec, tempMon, new[] { fan }))
                {
                    fanControl.Start(false);
                    fanControl.Stop();

                    A.CallTo(() => fan.Reset()).MustHaveHappened();
                }
            }