Comments (7)
I'm not sure what you mean by "only the associated identifier" - are you talking about the client handle you assign a monitored item when creating it, or something else?
Side note: the mailing list may be a better place for general questions like this.
from milo.
If I want to read the value of a node I have to provide a NodeId
first. One of the constructors is NodeId(int index, String identifier)
.
In my client code I donβt want to mess with namespace indices. I only want to provide the identifier and the opc ua client should somehow figure out to which namespace the identifier belongs to.
I want the opc ua client to be one of possible client implementations, that could be used. That is why I try to create a client facade/service to possible servers, like opcua or beckhoff ads, bachmann and so on. Not all of them have a concept of namespaces, but alot of them have the concept of identifiers/symbols.
from milo.
You always need the NodeId.
I think the only alternative would be using the TranslateBrowsePathsToNodeIds service, but you still need to be storing the whatever it is in a format that you could turn into a BrowsePath
for the translate service call.
from milo.
I actually stumbled over the same issue. In order to access a variable you also need the NodeId, and therefore the index. However to me it seems (as far as I look into the server side code) that the index is not static as the URI is. So there is some sort of mapping on the server side from URI -> Index.
So assuming in the client that the index never changes seems to be wrong to me, and going with the URI is the better approach. What I did is that I do make a lookup on the server table:
CompletableFuture<DataValue> future = this.client.readValue(0, TimestampsToReturn.Neither,
Identifiers.Server_NamespaceArray);
return future.thenApply(value -> {
final Object rawValue = value.getValue().getValue();
if (rawValue instanceof String[]) {
final String[] namespaces = (String[]) rawValue;
for (int i = 0; i < namespaces.length; i++) {
if (namespaces[i].equals(namespaceUri)) { return Unsigned.ushort(i); }
}
}
return null;
});
I am not sure if this is the proper way and I also could imagine that the lookup result could be cached on the client side.
from milo.
So what @ctron is suggesting is the most correct approach if you're going to be storing NodeIds. In practice I have never actually seen the need for this, as all the servers we deal with tend to have fixed namespaces 0, 1, and 2. (0 will never change. 1 is the namespace URI of the server; it shouldn't change. 2+ may change depending how the server uses namespaces).
from milo.
So what is the correct way to extend the #1 namespace?
from milo.
Right now the SDK registers a pretty sparse Namespace implementation called VendorNamespace
as namespace 1. You could easily register your own Namespace at slot 1 instead if you wish to provide different/additional nodes.
In my experience with OPC-UA servers, such as Kepware etc..., all the nodes for configured devices and whatever else they expose are in namespace 2.
from milo.
Related Issues (20)
- Missing Constraint when using as bundle in OSGi context
- Client stack - Reconnection does not restart subscriptions properly HOT 6
- The server has reached its maximum number of sessions HOT 1
- Error when connect to OPC UA server with long URL? HOT 1
- package not found [org.opcfoundation.opcua.binaryschema] HOT 2
- When subscribed to data changes and then read a value from the OPC-UA server, it will continue to receive subscribed data even if its value has not changed HOT 1
- The connection to S7 1500 gets interrupted while the connection to S7 1200 does not. HOT 1
- Get Bad_ArgumentsMissing instead of Bad_TooManyArguments HOT 1
- cant't write a Long value to opc-ua(the data type is UInt32) HOT 1
- Force TCP reconnect after SessionFsm keep-alive failure HOT 2
- Security upgrade to netty-4.1.105.Final
- CertificateValidationUtil issuer certificate KeyUsage checks
- How to read CustomStructType? HOT 1
- Remove dependency on lombok
- milo version 0.6.11 monitors the approximate limit of the number of PLC points HOT 1
- URI Reading Error HOT 8
- Port forwarding HOT 1
- Milo 0.6.12 Gradle ambiguity error for guava 33 HOT 4
- EndpointDescription is only chosen based on path, not hostname, preventing different certificates per-endpoint HOT 2
- status=Bad_Timeout HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from milo.