Object::Object(NodeId objectId, Services::SharedPtr services) : Node(services) { Id = objectId; ReadParameters attrs; attrs.AttributesToRead.push_back(ToReadValueId(objectId, AttributeId::DisplayName)); attrs.AttributesToRead.push_back(ToReadValueId(objectId, AttributeId::BrowseName)); std::vector<DataValue> values = services->Attributes()->Read(attrs); DisplayName = values[0].Value.As<LocalizedText>(); BrowseName = values[1].Value.As<QualifiedName>(); }
Variable::Variable(NodeID variableID, Services::SharedPtr services) : Node(services) { Id = variableID; ReadParameters attrs; attrs.AttributesToRead.push_back(AttributeValueID(variableID, AttributeID::DISPLAY_NAME)); attrs.AttributesToRead.push_back(AttributeValueID(variableID, AttributeID::BROWSE_NAME)); attrs.AttributesToRead.push_back(AttributeValueID(variableID, AttributeID::DATA_TYPE)); std::vector<DataValue> values = services->Attributes()->Read(attrs); DisplayName = values[0].Value.As<LocalizedText>(); BrowseName = values[1].Value.As<QualifiedName>(); DataType = OpcUa::DataTypeToVariantType(values[2].Value.As<NodeID>()); }
Variable::Variable(NodeId variableId, Services::SharedPtr services) : Node(services) { Id = variableId; ReadParameters attrs; attrs.AttributesToRead.push_back(ToReadValueId(variableId, AttributeId::DisplayName)); attrs.AttributesToRead.push_back(ToReadValueId(variableId, AttributeId::BrowseName)); attrs.AttributesToRead.push_back(ToReadValueId(variableId, AttributeId::DataType)); std::vector<DataValue> values = services->Attributes()->Read(attrs); DisplayName = values[0].Value.As<LocalizedText>(); BrowseName = values[1].Value.As<QualifiedName>(); DataType = OpcUa::DataTypeToVariantType(values[2].Value.As<NodeId>()); }