Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
How can i read all NodeId´s of a OPC-UA Server
August 11, 2022
15:19, EEST
Avatar
CC
Member
Members
Forum Posts: 8
Member Since:
August 4, 2022
sp_UserOfflineSmall Offline

Is there a example of reading all NodeIds, Values or Attributes of a Server?

August 12, 2022
8:30, EEST
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 346
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

There is no example of reading all NodeIds, Values or Attributes of a Server. This is not a typical thing that a Client application would need to do and it can take a lot of time depending on the number of Nodes on the Server’s AddressSpace. What is your use case for reading all this information from a Server?

To read from all Nodes of a Server, you need to browse its AddressSpace recursively starting from the Root Node. You can get a list of ReferenceDescriptions by calling client.getAddressSpace().browse(ExpandedNodeId nodeId) where client is an instance of UaClient class and nodeId is the ExpandedNodeId of the Node you wish to browse for References. You can then get the ExpandedNodeId of the Referenced Node by calling reference.getNodeId() where reference is a ReferenceDescription returned by the browse method previously. You can now use that ExpandedNodeId in readAttribute and readValue methods of UaClient class to read Attributes and Value of the Node and to browse the Node for more ReferenceDescriptions. You can repeat this recursion until browse returns no ReferenceDescriptions.

When implementing a recursion to read an entire AddressSpace, it is important to keep in mind that there can be multiple BrowsePaths leading to same Nodes. The recursion could get stuck in an infinite loop so it is important to keep a list of Nodes that have already been processed to avoid processing them again. Nodes are uniquely identified by their NodeIds so you can keep a list of NodeIds of Nodes that have been processed.

Also note, that only Nodes of Variable and VariableType NodeClasses have Value Attribute. You can check the NodeClass of the Node from a ReferenceDescription by calling reference.getNodeClass().

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
19 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 735

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1523

Posts: 6449

Newest Members:

rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1