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

How can i get every nodeid when use batch list to read? #650

Closed
CHN-STUDENT opened this issue May 10, 2023 · 4 comments
Closed

How can i get every nodeid when use batch list to read? #650

CHN-STUDENT opened this issue May 10, 2023 · 4 comments
Labels
question Further information is requested

Comments

@CHN-STUDENT
Copy link

Hi, now i have i question, i try to read opc data by using batchlist, but when i try to parse datas, i do not know which data from original nodeid, so could you tell me how can i get its original nodeid?

if len(resp.Results) > 0 {
  for _, item := range resp.Results {
    // how can i get every item's original nodeid?
  }
}
@kung-foo
Copy link
Member

The resp.Results slice will be the same length and order as the request. See: https://github.com/gopcua/opcua/blob/v0.3.13/examples/read/read.go#L41-L43. So NodesToRead[0] is returned in resp.Results[0].

@CHN-STUDENT
Copy link
Author

CHN-STUDENT commented May 15, 2023

Thanks! And i have anthoer question, how much nodeIDs List i can get maximum on once get?

And if i want to subscribe a nodeIDs List, how can i do?

@kung-foo kung-foo added the question Further information is requested label May 24, 2023
@kung-foo
Copy link
Member

Depends on the OPC-UA server. I usually just chunk the node list before sending read requests.

Regarding subscriptions, check out:

https://github.com/gopcua/opcua/blob/main/examples/subscribe/subscribe.go
https://github.com/gopcua/opcua/blob/main/examples/monitor/monitor.go

@CHN-STUDENT
Copy link
Author

OK, i try to use page slice to deal with nodeIDs List, thanks for your help!

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

No branches or pull requests

2 participants