Opc.Ua.Com.Server.ComHdaItemManager.GetAttributeValue C# (CSharp) Method

GetAttributeValue() private method

Converts a UA value to an HDA attribute value.
private GetAttributeValue ( Session session, uint attributeId, DataValueCollection values, int index ) : DaValue
session Opc.Ua.Client.Session The session.
attributeId uint The attribute id.
values DataValueCollection The values.
index int The index.
return DaValue
        private DaValue GetAttributeValue(Session session, uint attributeId, DataValueCollection values, int index)
        {
            switch (attributeId)
            {
                case Constants.OPCHDA_DATA_TYPE:
                {
                    DaValue result = new DaValue();
                    DataValue value = values[index];

                    // check for valid node.
                    if (StatusCode.IsBad(value.StatusCode))
                    {
                        result.Error = ResultIds.E_UNKNOWNITEMID;
                        return result;
                    }

                    // covert to var type.
                    NodeId dataTypeId = value.GetValue<NodeId>(DataTypeIds.BaseDataType);
                    int valueRank = values[index+1].GetValue<int>(ValueRanks.Scalar);

                    BuiltInType builtInType = DataTypes.GetBuiltInType(dataTypeId, session.TypeTree);
                    TypeInfo typeInfo = new TypeInfo(builtInType, valueRank);
                    short varType = (short)ComUtils.GetVarType(typeInfo);

                    result.Value = varType;
                    result.Quality = ComUtils.GetQualityCode(value.StatusCode);
                    result.Timestamp = value.ServerTimestamp;
                    result.Error = ResultIds.S_OK;

                    return result;
                }

                case Constants.OPCHDA_DESCRIPTION:
                {
                    DataValue value = values[index];

                    if (value.StatusCode == StatusCodes.BadAttributeIdInvalid)
                    {
                        DaValue result = new DaValue();
                        result.Error = ResultIds.E_INVALIDATTRID;
                        return result;
                    }

                    return m_mapper.GetLocalDataValue(value);
                }

                default:
                {
                    return ComHdaProxy.GetAttributeValue(session, m_mapper, attributeId, values[index]);
                }
            }
        }