/// <summary> /// Converting a single schedule entry of the smartplug to a ScheduledEntry object /// such a single schedule entry consists of 5 characters /// [hour][minute][hour][minute][on/Off] /// [hour] is one single char representing the numbers from 0 to 23/24 /// [minute] is one single char representing the numbers from 0 to 59 /// [on/off] char '1' stands for 'on' char '0' represents 'off' /// </summary> /// <param name="scheduledListPart">string value of a singele scheduled entry, always has a length of 5 chars</param> /// <returns>A ScheduledEntry object representing the given Edimax schedule entry</returns> private static ScheduledEntry EdimaxScheduledEntryPart2ScheduledEntry(string scheduledListPart) { int[] numericValues = { -1, -1, -1, -1 }; for (int pos = 0; pos < 4; pos++) { numericValues[pos] = CharToNumber(scheduledListPart[pos]); } TimePeriod timePeriod = new TimePeriod(new PointInTime(numericValues[0], numericValues[1]), new PointInTime(numericValues[2], numericValues[3])); return new ScheduledEntry(timePeriod, (scheduledListPart[4] == '1')); }
public ScheduledEntry(TimePeriod period, bool enabled) { Period = period; Enabled = enabled; }