public ComparingTimer(IClockSource clockSource, long frequency, IPeripheral owner, string localName, ulong limit = ulong.MaxValue, Direction direction = Direction.Ascending, bool enabled = false, WorkMode workMode = WorkMode.OneShot, bool eventEnabled = false, ulong compare = ulong.MaxValue, uint divider = 1) { if (compare > limit) { throw new ConstructionException(string.Format(CompareHigherThanLimitMessage, compare, limit)); } if (divider == 0) { throw new ArgumentException("Divider cannot be zero."); } if (frequency == 0) { throw new ArgumentException("Frequency cannot be zero."); } if (limit == 0) { throw new ArgumentException("Limit cannot be zero."); } this.clockSource = clockSource; initialDirection = direction; initialFrequency = frequency; initialLimit = limit; initialCompare = compare; initialEnabled = enabled; initialWorkMode = workMode; initialEventEnabled = eventEnabled; initialDivider = divider; this.owner = this is IPeripheral && owner == null ? this : owner; this.localName = localName; InternalReset(); }
public LimitTimer(IClockSource clockSource, long frequency, IPeripheral owner, string localName, ulong limit = ulong.MaxValue, Direction direction = Direction.Descending, bool enabled = false, WorkMode workMode = WorkMode.Periodic, bool eventEnabled = false, bool autoUpdate = false, int divider = 1) { if (limit == 0) { throw new ArgumentException("Limit cannot be zero."); } if (divider == 0) { throw new ArgumentException("Divider cannot be zero."); } if (frequency == 0) { throw new ArgumentException("Frequency cannot be zero."); } irqSync = new object(); this.clockSource = clockSource; initialFrequency = frequency; initialLimit = limit; initialDirection = direction; initialEnabled = enabled; initialWorkMode = workMode; initialEventEnabled = eventEnabled; initialAutoUpdate = autoUpdate; initialDivider = divider; this.owner = this is IPeripheral && owner == null ? this : owner; this.localName = localName; InternalReset(); }
internal ConfiguredTask Create(IClockSource clockSource, PeriodicityType periodicity, int hourOffset, int minuteOffset, Uri url) { Uri absoluteUrl; if (url.IsAbsoluteUri) { absoluteUrl = url; } else { if (_CallbackBaseUri == null) { throw new InvalidOperationException(string.Format("The recurring task targeting \"{0}\" is not an absolute URL and no callbackBaseUri attribute was supplied.", url)); } if (!Uri.TryCreate(_CallbackBaseUri, url, out absoluteUrl)) { throw new InvalidOperationException(string.Format("The recurring task targeting \"{0}\" is not an absolute URL and it cannot be combined with the callbackBaseUri attribute of \"{1}\".", url, _CallbackBaseUri)); } } string identifier = this.CreateTaskIdentifier(periodicity, hourOffset, minuteOffset, absoluteUrl); return(new ConfiguredTask(identifier, clockSource, periodicity, hourOffset, minuteOffset, absoluteUrl)); }
void InitVariables() { _id = Guid.NewGuid(); _currentState = new ActivationState(false); _clockSource = SystemClock.Instance; _recurringTaskHandlerAbsolutePath = GetHandlerAbsolutePath(); _heartbeatCount = 0; }
internal ConfiguredTask(string identifier, IClockSource clockSource, PeriodicityType periodicity, int hourOffset, int minuteOffset, Uri url) { this.Identifier = identifier; this._ClockSource = clockSource; this.Periodicity = periodicity; this.HourOffset = hourOffset; this.MinuteOffset = minuteOffset; this.Url = url; }
public LPITTimer(IClockSource clockSource, long frequency, S32K_LPIT owner, string name) : base(clockSource, frequency, owner, name, limit: uint.MaxValue, direction: Direction.Descending, enabled: false, workMode: WorkMode.Periodic, eventEnabled: false, autoUpdate: true) { lpit = owner; this.name = name; LimitReached += LimitReachedHandle; Reset(); }
internal ConfiguredTask(string identifier, IClockSource clockSource, PeriodicityType periodicity, int hourOffset, int minuteOffset, Uri url) { this.Identifier = identifier; this._ClockSource = clockSource; this.Periodicity = periodicity; this.HourOffset = hourOffset; this.MinuteOffset = minuteOffset; this.Url = url; }
private void InitTimer(IClockSource clockSource, long frequency, ulong limit) { var timer = new LimitTimer(clockSource, frequency, this, LimitTimerName, limit, enabled: true, eventEnabled: true, autoUpdate: true); timer.LimitReached += () => { Send(ActionType.TickClock, 0, limit); }; }
internal ConfiguredTask(string identifier, IClockSource clockSource, PeriodicityType periodicity, int dayOffset, int hourOffset, int minuteOffset, Uri url) { Identifier = identifier; _ClockSource = clockSource; Periodicity = periodicity; DayOffset = dayOffset; HourOffset = hourOffset; MinuteOffset = minuteOffset; Url = url; }
public ComparingTimer(IClockSource clockSource, long frequency, ulong limit = ulong.MaxValue, Direction direction = Direction.Ascending, bool enabled = false, WorkMode workMode = WorkMode.OneShot, bool eventEnabled = false, ulong compare = ulong.MaxValue) { if (compare > limit) { throw new ConstructionException(string.Format(CompareHigherThanLimitMessage, compare, limit)); } this.clockSource = clockSource; initialDirection = direction; initialFrequency = frequency; initialLimit = limit; initialCompare = compare; initialEnabled = enabled; initialWorkMode = workMode; initialEventEnabled = eventEnabled; InternalReset(); }
async Task AddTaskAsync(IClockSource clockSource, PeriodicityType periodicity, int day, int hour, int minute, Uri url) { using (var taskBuilder = new TaskBuilder(CallbackBaseUri)) { ConfiguredTask taskConfig = taskBuilder.Create(clockSource, periodicity, day, hour, minute, url); if (await _taskCollection.AddAsync(taskConfig)) { if (CallbackBaseUri == null) { ScavengeForCallbackBaseUri(taskConfig.Url); } await Schedule(PrepareNextCallback(taskConfig)); if (!_currentState.IsActive) { await Start(); } } } }
private void AddTask(IClockSource clockSource, PeriodicityType periodicity, int hour, int minute, Uri url) { using (var taskBuilder = new TaskBuilder(this.CallbackBaseUri)) { ConfiguredTask taskConfig = taskBuilder.Create(clockSource, periodicity, hour, minute, url); if (_TaskCollection.Add(taskConfig)) { if (this.CallbackBaseUri == null) { this.ScavengeForCallbackBaseUri(taskConfig.Url); } this.Schedule(this.PrepareNextCallback(taskConfig)); if (!_CurrentState.IsActive) { Start(); } } } }
internal ConfiguredTask Create(IClockSource clockSource, PeriodicityType periodicity, int hourOffset, int minuteOffset, Uri url) { Uri absoluteUrl; if (url.IsAbsoluteUri) { absoluteUrl = url; } else { if (_CallbackBaseUri == null) { throw new InvalidOperationException(string.Format("The recurring task targeting \"{0}\" is not an absolute URL and no callbackBaseUri attribute was supplied.", url)); } if (!Uri.TryCreate(_CallbackBaseUri, url, out absoluteUrl)) { throw new InvalidOperationException(string.Format("The recurring task targeting \"{0}\" is not an absolute URL and it cannot be combined with the callbackBaseUri attribute of \"{1}\".", url, _CallbackBaseUri)); } } string identifier = this.CreateTaskIdentifier(periodicity, hourOffset, minuteOffset, absoluteUrl); return new ConfiguredTask(identifier, clockSource, periodicity, hourOffset, minuteOffset, absoluteUrl); }
protected ComparingTimer(IClockSource clockSource, long frequency, ulong limit = ulong.MaxValue, Direction direction = Direction.Ascending, bool enabled = false, WorkMode workMode = WorkMode.OneShot, bool eventEnabled = false, ulong compare = ulong.MaxValue, uint divider = 1) : this(clockSource, frequency, null, null, limit, direction, enabled, workMode, eventEnabled, compare, divider) { }
protected LimitTimer(IClockSource clockSource, long frequency, ulong limit = ulong.MaxValue, Direction direction = Direction.Descending, bool enabled = false, WorkMode workMode = WorkMode.Periodic, bool eventEnabled = false, bool autoUpdate = false, int divider = 1) : this(clockSource, frequency, null, null, limit, direction, enabled, workMode, eventEnabled, autoUpdate, divider) { }
public ManagedThreadWrappingClockEntry(IClockSource cs, Action action) { clockSource = cs; this.action = action; }
private void AddTask(IClockSource clockSource, PeriodicityType periodicity, int hour, int minute, Uri url) { using (var taskBuilder = new TaskBuilder(this.CallbackBaseUri)) { ConfiguredTask taskConfig = taskBuilder.Create(clockSource, periodicity, hour, minute, url); if (_TaskCollection.Add(taskConfig)) { if (this.CallbackBaseUri == null) { this.ScavengeForCallbackBaseUri(taskConfig.Url); } this.Schedule(this.PrepareNextCallback(taskConfig)); if (!_CurrentState.IsActive) { Start(); } } } }