Contrequarte.SmartPlug.Core.SmartPlug.PreparePowerSchedule C# (CSharp) Method

PreparePowerSchedule() private method

private PreparePowerSchedule ( IEnumerable entriesToSchedule ) : string
entriesToSchedule IEnumerable
return string
        private string PreparePowerSchedule(IEnumerable<ScheduledEntry> entriesToSchedule)
        {
            int[] minuteSchedule = InitMinuteSchedule(); // an array containing one element for each minute of a day

            
            foreach (ScheduledEntry entry in entriesToSchedule)
            {
                // filling in scheduled minutes for each scheduled entry
                FillMinuteSchedule(entry, ref minuteSchedule);
            }

            //Transfer it to a 360 elements based hex schedule

            char[] hexSchedule = InitHexSchedule();

            int schedulePosition = 0;
            for (int quadrupletStart = 0; quadrupletStart < MinutesOfADay; quadrupletStart += 4)
            {
                hexSchedule[schedulePosition] = QuadrupletToHex(minuteSchedule, quadrupletStart);
                schedulePosition++;
            }

            return new string(hexSchedule); // string with length 360, each position contains a value between '0' and 'F'
        }