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: 321
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: 518

Currently Online:
21 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 681

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1