Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browsing ua.BrowseResponse.Results[*].References[*].NodeID.NodeID returns EOF error #744

Open
Tyslan opened this issue Sep 20, 2024 · 0 comments

Comments

@Tyslan
Copy link

Tyslan commented Sep 20, 2024

When browsing using references, I get a EOL unless I recreate the NodeID.

func browseNext(ctx context.Context, client *opcua.Client, parentNode *ua.NodeID, currentDepth int, maxDepth int) error {
	refs, err := fastBrowse(ctx, client, parentNode)
	if err != nil {
		slog.ErrorContext(ctx, "Failed to browse", "error", err)
		return err
	}

	slog.DebugContext(ctx, "Browse result", "node", parentNode, "count", len(refs))
	for _, reference := range refs {
		if reference.TypeDefinition.NodeID.IntID() == id.FolderType {
			fmt.Println(strings.Repeat(" ", int(currentDepth)), reference.BrowseName.Name)

			// id := ua.NewNodeIDFromExpandedNodeID(reference.NodeID)
			id := reference.NodeID.NodeID
			if currentDepth < maxDepth {
				browseNext(ctx, client, id, currentDepth+1, maxDepth)
			}
		} else if reference.TypeDefinition.NodeID.IntID() == id.BaseDataVariableType || reference.TypeDefinition.NodeID.IntID() == id.DataItemType || reference.TypeDefinition.NodeID.IntID() == id.AnalogItemType {
			fmt.Println(strings.Repeat(" ", int(currentDepth)), reference.BrowseName.Name)
		} else {
			slog.DebugContext(ctx, "Ignoring node during browse")
		}
	}

	return nil
}

Full example code here. Please note that a work around is implemented here.
I was testing this with Prosys OPC Simulation Server 5.4.6.

My finding is very similar as on issue #550.

  • The NodeIDs from ua.BrowseResponse.Results[*].References[*].NodeID.NodeID have a NodeIDType of 64, which doesn´t seem like a valid mask in node_id.go
  • The next Browse or Read that uses this NodeId with NodeIDType =64 returns an error EOF.

Since this was supposedly fixed in #683, I'm wondering if I'm doing something wrong or if #550 was closed prematurely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant