00001 /****************************************************************************** 00002 * Copyright (C) 2013-2014 by Alexander Rykovanov * 00003 * rykovanov.as@gmail.com * 00004 * * 00005 * This library is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU Lesser General Public License as * 00007 * published by the Free Software Foundation; version 3 of the License. * 00008 * * 00009 * This library is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU Lesser General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU Lesser General Public License * 00015 * along with this library; if not, write to the * 00016 * Free Software Foundation, Inc., * 00017 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00018 ******************************************************************************/ 00019 00020 #include <opc/ua/model.h> 00021 00022 namespace OpcUa 00023 { 00024 namespace Model 00025 { 00026 Node::Node(NodeId id, Services::SharedPtr services) 00027 : Id(id) 00028 , OpcUaServices(services) 00029 { 00030 ReadParameters attrs; 00031 attrs.AttributesToRead.push_back(ToReadValueId(id, AttributeId::DisplayName)); 00032 attrs.AttributesToRead.push_back(ToReadValueId(id, AttributeId::BrowseName)); 00033 std::vector<DataValue> values = services->Attributes()->Read(attrs); 00034 DisplayName = values[0].Value.As<LocalizedText>(); 00035 BrowseName = values[1].Value.As<QualifiedName>(); 00036 } 00037 00038 Node::Node(Services::SharedPtr services) 00039 : OpcUaServices(services) 00040 { 00041 } 00042 00043 NodeId Node::GetId() const 00044 { 00045 return Id; 00046 } 00047 00048 QualifiedName Node::GetBrowseName() const 00049 { 00050 return BrowseName; 00051 } 00052 00053 LocalizedText Node::GetDisplayName() const 00054 { 00055 return DisplayName; 00056 } 00057 00058 std::vector<Reference> Node::GetReferencies() const 00059 { 00060 return std::vector<Reference>(); 00061 } 00062 00063 } 00064 }