using System; using System.Diagnostics; using Aitex.Core.RT.DataCenter; namespace Aitex.Core.RT.IOCore.Interlock.DataProvider; public class BoolDataPollProvider : DataPollProviderBase, IInterlockLimitDataProvider { public BoolDataPollProvider(string dataPath) : base(dataPath) { } /// /// /// /// /// /// protected override object HandleGetValue() { var value = DATA.Poll(DataPath); Debug.Assert(value != null, $"the return value of {DataPath} is null."); Debug.Assert(bool.TryParse(value.ToString(), out _), $"the return value of {DataPath} is not boolean."); if (value == null) throw new NullReferenceException($"the return value of {DataPath} is null."); if (bool.TryParse(value.ToString(), out var bValue)) return bValue; throw new InvalidCastException($"the return value of {DataPath} is not bool."); } }