diff --git a/src/MTConnect.NET-Common/Devices/DataItem.cs b/src/MTConnect.NET-Common/Devices/DataItem.cs index 00a75a27..bba3fe7b 100644 --- a/src/MTConnect.NET-Common/Devices/DataItem.cs +++ b/src/MTConnect.NET-Common/Devices/DataItem.cs @@ -28,6 +28,9 @@ public class DataItem : IDataItem private static readonly object _lock = new object(); private static Dictionary _types; + private static IEnumerable _conditionTypes; + private static IEnumerable _eventTypes; + private static IEnumerable _sampleTypes; private static Dictionary _typeDescriptions; private static Dictionary> _subtypes; private static Dictionary _subtypeDescriptions; @@ -528,6 +531,10 @@ public static string GetPascalCaseType(string type) { case DataItems.Events.AdapterUriDataItem.TypeId: return "AdapterURI"; case DataItems.Events.MTConnectVersionDataItem.TypeId: return "MTConnectVersion"; + case DataItems.Samples.AmperageACDataItem.TypeId: return "AmperageAC"; + case DataItems.Samples.AmperageDCDataItem.TypeId: return "AmperageDC"; + case DataItems.Samples.VoltageACDataItem.TypeId: return "VoltageAC"; + case DataItems.Samples.VoltageDCDataItem.TypeId: return "VoltageDC"; } lock (_lock) @@ -613,6 +620,84 @@ public static IEnumerable GetTypes() return _types.Keys; } + public static IEnumerable GetConditionTypes() + { + if (_conditionTypes == null) + { + if (_types == null) _types = GetAllTypes(); + + if (!_types.IsNullOrEmpty()) + { + var x = new List(); + + foreach (var type in _types) + { + var instance = Create(type.Value); + if (instance != null) + { + x.Add(instance.Type); + } + } + + _conditionTypes = x.OrderBy(o => o); + } + } + + return _conditionTypes; + } + + public static IEnumerable GetEventTypes() + { + if (_eventTypes == null) + { + if (_types == null) _types = GetAllTypes(); + + if (!_types.IsNullOrEmpty()) + { + var x = new List(); + + foreach (var type in _types) + { + var instance = Create(type.Value); + if (instance != null && instance.Category == DataItemCategory.EVENT) + { + x.Add(instance.Type); + } + } + + _eventTypes = x.OrderBy(o => o); + } + } + + return _eventTypes; + } + + public static IEnumerable GetSampleTypes() + { + if (_sampleTypes == null) + { + if (_types == null) _types = GetAllTypes(); + + if (!_types.IsNullOrEmpty()) + { + var x = new List(); + + foreach (var type in _types) + { + var instance = Create(type.Value); + if (instance != null && instance.Category == DataItemCategory.SAMPLE) + { + x.Add(instance.Type); + } + } + + _sampleTypes = x.OrderBy(o => o); + } + } + + return _sampleTypes; + } + public static IEnumerable> GetTypeDescriptions() { if (_typeDescriptions == null)