public void ResetDue <T>(T item) where T : ISensorScanRateItem { if (!LastMeasurement.ContainsKey(item)) { throw new InvalidOperationException("Sensor configuration item has not been registered earlier"); } LastMeasurement[item].Restart(); }
public bool IsDue <T>(T item) where T : ISensorScanRateItem { if (!LastMeasurement.ContainsKey(item)) { throw new InvalidOperationException("Sensor configuration item has not been registered earlier"); } var stopwatch = LastMeasurement[item]; return(stopwatch.Elapsed >= item.ScanRate); }