示例#1
0
        static void Main(string[] args)
        {
            var schedule  = new Schedule();
            var timeClock = new TimeClock(schedule);

            timeClock.Start();
        }
示例#2
0
        public void SetHeatingMode(TimeClock context)
        {
            Console.WriteLine(nameof(OnState));



            context.SetState(new Offstate());
        }
示例#3
0
        public void SetHeatingMode(TimeClock context)
        {
            Console.WriteLine(nameof(Offstate));

            // loop here

            // Check for boost mode. Cancellation token?
            // context.SetState(Boost);

            // check for if it is time for boiler to switch on
            context.SetState(new OnState());
        }
示例#4
0
        public void SetHeatingMode(TimeClock context)
        {
            Console.WriteLine(nameof(BoostState));
            BoostIsOn = true;
            var boostDurationTimeSpan = new TimeSpan(0, context.Schedule.BoostDurationMinutes, 0);
            var boostTimer            = new System.Timers.Timer(boostDurationTimeSpan.TotalMilliseconds);

            boostTimer.Enabled  = true;
            boostTimer.Elapsed += OnBoostTimerElapsed;

            boostTimer.Start();

            while (BoostIsOn)
            {
                Console.WriteLine("Checking if Boost is On (Should be every second)");
                Thread.Sleep(1000);
                break;
            }

            // Set GPIO Pins here

            context.SetStateFromSchedule();
        }