using System; using ArchestrAServices.ASBContract; using ArchestrAServices.ASBIDataContract.V2; namespace ArchestrAServices.ASBIDataV2Contract; public static class IDataASBEnumFactory { public static DataType IntToDataType(ushort iValue) { return ASBEnumFactory.IntToDataType(iValue); } public static ushort DataTypeToInt(DataType eValue) { return ASBEnumFactory.DataTypeToInt(eValue); } public static DataQualityType IntToDataQualityType(ushort iValue) { try { return (DataQualityType)iValue; } catch (Exception) { return DataQualityType.Uncertain; } } public static ushort DataQualityTypeToInt(DataQualityType eValue) { return (ushort)eValue; } public static ItemIdentityType IntToItemIdentityType(ushort iValue) { try { return (ItemIdentityType)iValue; } catch (Exception) { return ItemIdentityType.Id; } } public static ushort ItemIdentityTypeToInt(ItemIdentityType eValue) { return (ushort)eValue; } public static ItemReferenceType IntToItemReferenceType(ushort iValue) { try { return (ItemReferenceType)iValue; } catch (Exception) { return ItemReferenceType.None; } } public static ushort ItemReferenceTypeToInt(ItemReferenceType eValue) { return (ushort)eValue; } public static SubscriptionStateType IntToSubscriptionStateType(ushort iValue) { try { return (SubscriptionStateType)iValue; } catch (Exception) { return SubscriptionStateType.SubsUnknown; } } public static ushort SubscriptionStateTypeToInt(SubscriptionStateType eValue) { return (ushort)eValue; } public static WriteCapabilityType IntToWriteCapabilityType(ushort iValue) { try { return (WriteCapabilityType)iValue; } catch (Exception) { return WriteCapabilityType.WriteUnknown; } } public static ushort WriteCapabilityTypeToInt(WriteCapabilityType eValue) { return (ushort)eValue; } public static OpcQualityMask IntToOpcQualityMask(ushort iValue) { try { return (OpcQualityMask)iValue; } catch (Exception) { return OpcQualityMask.MAGELLAN_QUALITY_INITIALIZING; } } public static ushort OpcQualityMaskToInt(OpcQualityMask eValue) { return (ushort)eValue; } public static MonitoredItem MakeDeleteMonitoredItem(ItemIdentity Item) { return new MonitoredItem { Item = Item, SampleInterval = 0uL, Active = false, TimeDeadband = 0uL, ValueDeadband = new ArchestrAServices.ASBIDataContract.V2.Variant { Type = DataTypeToInt(DataType.TypeUnknown), Length = 0, Payload = null }, UserData = new ArchestrAServices.ASBIDataContract.V2.Variant { Type = DataTypeToInt(DataType.TypeUnknown), Length = 0, Payload = null } }; } }