67 std::vector<DataValue> vec =
Server->Attributes()->Read(params);
82 std::vector<NodeId> vec_methodId;
83 vec_methodId.push_back(methodId);
85 std::vector<std::vector<Variant>> vec_inputArguments;
86 vec_inputArguments.push_back(inputArguments);
88 std::vector<std::vector<Variant>> results =
CallMethods(vec_methodId, vec_inputArguments);
90 return results.front();
93 std::vector<std::vector<Variant>>
Node::CallMethods(
const std::vector<NodeId> methodIds,
const std::vector<std::vector<Variant>> inputArguments)
const 95 std::vector<CallMethodRequest> methodsToCall;
97 std::vector<NodeId>::const_iterator it1;
98 std::vector<std::vector<Variant>>::const_iterator it2;
100 for (it1 = methodIds.begin(), it2 = inputArguments.begin();
101 it1 != methodIds.end() && it2 != inputArguments.end();
109 methodsToCall.push_back(callMethod);
112 std::vector<CallMethodResult> results =
Server->Method()->Call(methodsToCall);
114 std::vector<std::vector<Variant>> ret;
116 for (std::vector<CallMethodResult>::iterator it = results.begin(); it != results.end(); ++it)
119 ret.push_back(it->OutputArguments);
130 attribute.
Value = dval;
131 std::vector<StatusCode> codes =
Server->Attributes()->Write(std::vector<WriteValue>(1, attribute));
159 std::vector<BrowseResult> results =
Server->Views()->Browse(query);
166 while (!results[0].Referencies.empty())
168 for (
auto refIt : results[0].Referencies)
171 nodes.push_back(node);
174 results =
Server->Views()->BrowseNext();
199 std::vector<BrowseResult> results =
Server->Views()->Browse(query);
205 if (!results[0].Referencies.empty())
207 for (
auto refIt : results[0].Referencies)
217 std::vector<Node> nodes;
233 throw std::runtime_error(
"Could not retrieve browse name.");
239 std::vector<AddNodesResult>
Node::AddNodes(std::vector<AddNodesItem> items)
const 241 return Server->NodeManagement()->AddNodes(items);
246 return Server->NodeManagement()->AddReferences(items);
251 return GetChild(std::vector<std::string>({browsename}));
256 std::vector<QualifiedName> vec;
263 vec.push_back(qname);
272 std::vector<RelativePathElement> rpath;
284 std::vector<BrowsePath> bpaths;
285 bpaths.push_back(bpath);
289 std::vector<BrowsePathResult> result =
Server->Views()->TranslateBrowsePathsToNodeIds(params);
292 NodeId node = result.front().Targets.front().Node ;
298 std::vector<Node> result;
318 std::ostringstream os;
319 os <<
"Node(" <<
Id <<
")";
355 std::vector<AddNodesResult> addnodesresults =
Server->NodeManagement()->AddNodes(std::vector<AddNodesItem>({item}));
394 std::vector<AddNodesResult> addnodesresults =
Server->NodeManagement()->AddNodes(std::vector<AddNodesItem>({item}));
422 item.ParentNodeId = this->
Id;
423 item.RequestedNewNodeId = nodeid;
437 attr.
Type = datatype;
444 item.Attributes = attr;
446 std::vector<AddNodesResult> addnodesresults =
Server->NodeManagement()->AddNodes(std::vector<AddNodesItem>({item}));
476 item.ParentNodeId = this->
Id;
477 item.RequestedNewNodeId = nodeid;
487 attr.
Type = datatype;
494 item.Attributes = attr;
496 std::vector<AddNodesResult> addnodesresults =
Server->NodeManagement()->AddNodes(std::vector<AddNodesItem>({item}));
537 std::vector<AddNodesResult> addnodesresults =
Server->NodeManagement()->AddNodes(std::vector<AddNodesItem>({item}));
std::string ToString() const
std::vector< OpcUa::ReadValueId > AttributesToRead
std::vector< Node > GetChildren() const
Get ghildren by hierarchal referencies.
uint32_t GetNamespaceIndex() const
void CheckStatusCode(StatusCode code)
OpcUa Error codes. GNU LGPL.
QualifiedName GetBrowseName() const
DataValue GetDataValue() const
Variant GetDataType() const
Node AddVariable(const NodeId &variableId, const QualifiedName &browsename, const Variant &val) const
Node AddMethod(const NodeId &variableId, const QualifiedName &browsename, std::function< std::vector< OpcUa::Variant >(NodeId context, std::vector< OpcUa::Variant > arguments)> method) const
std::vector< BrowseDescription > NodesToBrowse
std::vector< StatusCode > AddReferences(std::vector< AddReferencesItem > items) const
Node AddFolder(const NodeId &folderId, const QualifiedName &browseName) const
std::vector< BrowsePath > BrowsePaths
std::vector< OpcUa::Variant > InputArguments
OpcUa::Services::SharedPtr Server
LocalizedText Description
std::vector< AddNodesResult > AddNodes(std::vector< AddNodesItem > items) const
std::vector< Node > GetProperties() const
NodeId RequestedNewNodeId
void SetAttribute(AttributeId attr, const DataValue &dval) const
LocalizedText Description
LocalizedText DisplayName
VariableAccessLevel UserAccessLevel
Duration MinimumSamplingInterval
ObjectId VariantTypeToDataType(VariantType vt)
LocalizedText Description
std::vector< RelativePathElement > Elements
LocalizedText DisplayName
OPC UA Address space part. GNU LGPL.
DataValue GetAttribute(const AttributeId attr) const
Node AddObject(const NodeId &folderId, const QualifiedName &browseName) const
std::vector< uint32_t > Dimensions
void _GetChildren(const OpcUa::ReferenceId &refid, std::vector< Node > &nodes) const
Node GetChild(const std::vector< OpcUa::QualifiedName > &path) const
std::vector< std::vector< Variant > > CallMethods(std::vector< NodeId > methodIds, std::vector< std::vector< Variant >> inputArguments) const
QualifiedName ToQualifiedName(const std::string &str, uint32_t default_ns=0)
std::vector< Variant > CallMethod(NodeId methodId, std::vector< Variant > inputArguments) const
VariableAccessLevel AccessLevel
BrowseResultMask ResultMask
A Node object represent an OPC-UA node. It is high level object intended for developper who want to e...
NodeId ToNodeId(const std::string &str, uint32_t defaultNamespace=0)
uint32_t MaxReferenciesPerNode
BrowseDirection Direction
void SetValue(const Variant &val) const
NodeAttributes Attributes
std::ostream & operator<<(std::ostream &os, const Node &node)
OpcUa::AttributeId AttributeId
NodeClass GetNodeClass() const
NodeId NumericNodeId(uint32_t value, uint16_t namespaceIndex=0)
std::vector< uint32_t > Dimensions
Node AddProperty(const NodeId &propertyId, const QualifiedName &browsename, const Variant &val) const
OpcUa::AttributeId AttributeId
LocalizedText DisplayName