11:34, EET
December 20, 2021
12:20, EET
Moderators
February 11, 2020
Hello,
Could you provide some context to this question? What exactly are you doing that requires checking if an instance of UaVariable interface is Mandatory? Can you be more specific in what type of instances of UaVariable interface you require this information for, e.g. Variables that are part of InstanceDeclarationHierarchies or Variables that are part of instances of InstanceDeclarationHierarchies?
12:39, EET
December 20, 2021
Dear Matti,
I created an instance of NodeManagerListener.
In the onBrowseNode method:
I need to know if the target node:
it is a mandatory variable.
Best regards,
Francesco
Best regards,
Francesco
12:48, EET
Moderators
February 11, 2020
Hello,
I would still need some more context on this. Are you browsing instances, types or both? And why do you need to know if the target Node is Mandatory Variable?
In short, checking if a Variable is Mandatory or not can be quite tricky and has to be done differently depending on the circumstances, so it would be important for us to understand exactly what you are doing that requires the information.
13:43, EET
December 20, 2021
Dear Matti,
I no longer need to check if an instance of a node variable is mandatory in the onBrowseNode method.
I was able to run the check on server startup.
I answer your questions:
Are you browsing instances, types or both?
I’m browsing instances
And why do you need to know if the target Node is Mandatory Variable?
Because I have to “link” a node variable of the EUROMAP 82.1 standard to a variable of my custom server.
If the node variable is mandatory but my server is not able to handle it, I raise the exception StatusException(StatusCodes.Bad_NotSupported)
Thank you for your help. From what I understand I have to check the definition of the variable to know if it is mandatory.
Thanks,
Francesco
14:40, EET
April 3, 2012
I’m adding this note here just in case it helps.
There is UaServer.getAddressSpace().getInstanceDeclarationHierarchyCache() (after you have loaded the type models). You can get the InstanceDeclarationHierarchy of the UaType. This is what is used internally when (NodeManagerUaNode) createInstance/NodeBuilder is used to make instances of the types. It uses Codegen classes when available, but technically that is separate from the instantiation algorithm (i.e. it will basically just use more specialized UaNode implementations if generated). However I must note that the API what the InstanceDeclarationHierarchy has is not that suitable for application-level uses (for example things can be overridden in subtypes etc. the full ruleset is quite complex).
IF you use createInstance/NodeBuilder to make your instances (i.e. the instances itself are not part of any NodeSets), you can make the TypeDefinitionBasedNodeBuilderConfiguration (this is used to e.g. configure which Optionals to instantiate) with a default InstantiationStrategy (the TypeDefinitionBasedNodeBuilderConfiguration.builder(default) parameter), possibly delegating to new DefaultInstantiationStrategy(MethodInstantiationLogic.SHARED) (this is the default for the overload that takes none). This should allow you to observe each UaNode instantiation when the instances are made. Then within the InstantiationParameters you will have the InstanceDeclaration and can getModellingRule and check is it ModellingRule.Mandatory.
I guess maybe some day we might have an easier way of doing this, but good if you already found out a way to check that.
Most Users Ever Online: 1919
Currently Online:
29 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: 1525
Posts: 6456
Newest Members:
forrestdilke5, ernestoportus31, martin123, rickie5305, shaylamaggard4, rickyjuarez140, jonathonmcintyre, fannielima, kristiewinkle8, rustModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1028, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1