using System; using Aitex.Core.RT.DataCenter; using Aitex.Core.RT.IOCore.Interlock.Base; namespace Aitex.Core.RT.IOCore.Interlock.DataProvider; public class BoolDataPollProvider : DataPollProvider, IInterlockLimitDataProvider { public BoolDataPollProvider(string dataPath) : base(dataPath) { } protected override object HandleGetValue() { var value = DATA.Poll(DataPath); if (value == null) throw new NullReferenceException("unable to poll data, null is returned."); if (bool.TryParse(value.ToString(), out var bValue)) return bValue; throw new InvalidCastException($"the return value {value} is not bool."); } }