当前位置: 首页>>代码示例>>C#>>正文


C# DataValue.GetValue方法代码示例

本文整理汇总了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:
//.........这里部分代码省略.........
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:101,代码来源:ComHdaProxy.cs


注:本文中的DataValue.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。