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: 349
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:
8 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: 726

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7, franciscagrimwad, adult_gallery

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

Administrators: admin: 1