本文整理汇总了C#中DataValue.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# DataValue.GetValue方法的具体用法?C# DataValue.GetValue怎么用?C# DataValue.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataValue
的用法示例。
在下文中一共展示了DataValue.GetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAttributeValue
/// <summary>
/// Converts a UA value to an HDA attribute value.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="mapper">The mapper.</param>
/// <param name="attributeId">The attribute id.</param>
/// <param name="value">The value.</param>
/// <returns></returns>
internal static DaValue GetAttributeValue(Session session, ComNamespaceMapper mapper, uint attributeId, DataValue value)
{
switch (attributeId)
{
case INTERNAL_ATTRIBUTE_ANNOTATION:
{
DaValue result = new DaValue();
Annotation annotation = value.GetValue<Annotation>(null);
if (annotation == null)
{
result.Error = ResultIds.E_BADTYPE;
return result;
}
result.Value = annotation;
result.HdaQuality = ComUtils.GetHdaQualityCode(value.StatusCode);
result.Timestamp = value.SourceTimestamp;
result.Error = ResultIds.S_OK;
return result;
}
case Constants.OPCHDA_ENG_UNITS:
{
DaValue result = new DaValue();
EUInformation engineeringUnits = value.GetValue<EUInformation>(null);
if (engineeringUnits == null)
{
result.Error = ResultIds.E_INVALIDATTRID;
return result;
}
if (engineeringUnits.DisplayName != null)
{
result.Value = engineeringUnits.DisplayName.Text;
}
result.HdaQuality = ComUtils.GetHdaQualityCode(value.StatusCode);
result.Timestamp = value.SourceTimestamp;
result.Error = ResultIds.S_OK;
return result;
}
case Constants.OPCHDA_HIGH_ENTRY_LIMIT:
case Constants.OPCHDA_NORMAL_MAXIMUM:
{
DaValue result = new DaValue();
Range range = value.GetValue<Range>(null);
if (range == null)
{
result.Error = ResultIds.E_INVALIDATTRID;
return result;
}
result.Value = range.High;
result.HdaQuality = ComUtils.GetHdaQualityCode(value.StatusCode);
result.Timestamp = value.SourceTimestamp;
result.Error = ResultIds.S_OK;
return result;
}
case Constants.OPCHDA_LOW_ENTRY_LIMIT:
case Constants.OPCHDA_NORMAL_MINIMUM:
{
DaValue result = new DaValue();
Range range = value.GetValue<Range>(null);
if (range == null)
{
result.Error = ResultIds.E_INVALIDATTRID;
return result;
}
result.Value = range.Low;
result.HdaQuality = ComUtils.GetHdaQualityCode(value.StatusCode);
result.Timestamp = value.SourceTimestamp;
result.Error = ResultIds.S_OK;
return result;
}
case Constants.OPCHDA_MAX_TIME_INT:
case Constants.OPCHDA_MIN_TIME_INT:
//.........这里部分代码省略.........