Skip to content

How to write "Display Name" and "Description" to Node #514

Answered by Aposeltof
Aposeltof asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, it works now.

On the Client side in Go :
I read and modify the display name attribute which is a "Localized.Text".
I convert it to a Variant then I can write it via the WriteRequest.

Server side:
I have to configure the "Write Mask" of the node so that the Display Name can be modified (Code 64).

The code

func WriteDisplayNameByID(c *opcua.Client, displayName string, ns uint16, id uint32) error {
	// Get Node id
	nid := ua.NewNumericNodeID(ns, id)

	// Open Node
	node := c.Node(nid)

	// Read current DisplayName
	dName, err := node.DisplayName()
	if err != nil {
		return err
	}

	//Change text
	dName.Text = displayName

	// Create a Variant from dName (Struct LocalizedText)
	value, …

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Aposeltof
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Aposeltof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants