Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Code generator: where to find the node ids?
September 19, 2017
15:12, EEST
Avatar
Thomas Reuther
Member
Members
Forum Posts: 33
Member Since:
September 18, 2017
sp_UserOfflineSmall Offline

Hi there,

I am using Prosys SDK 2.3.2-Eval and I am creating my first test server. To handle user access I have to implement my own IoManager. In this case I don’t want to put the node ids into my code rather refer to generated node ids.
I have read that the generator only generates classes from types. When I use UA Modeler to generate classes for .Net it also generates a list of constants for each node ids (e.g. the class VariableIds will contain all node ids of the variables of my node set).
My node set file contains only nodes base on standard types.
Neither in NodeManager nor NodeManagerTable I can find a method which returns all nodes of my address space.

Finally I want implement something like this in MyIoManagerListener:

public EnumSet onGetUserAccessLevel(ServiceContext serviceContext, NodeId nodeId, UaVariable node) {
if (nodeId == “ns=2;i=5013”)
return EnumSet.of(AccessLevel.CurrentRead)
}

But I don’t want to put “ns=2;i=5013” in my code. I rather want to refer to a generated class like VariableIds where there is a constant MyDeviceState which is a node id.
Is there already a way to do something like this?

Best regards,
Thomas

September 19, 2017
15:53, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

The codegen does create an class named “Ids” in the generated package which contains ExpandedNodeIds (as we cannot know the namespace index when generating the model) for the VariableTypes and ObjectTypes. The current best practice has been to create the types in the model and create instances of those types in code. So that wont help in this situation. Hopefully we can improve this in the future.

NodeManager is an abstract base class for NodeManagers. It does not contain nodes as it offers option to implement a manager without UaNodes (e.g. a database or otherwise backed system, see MyBigNodeManager in the samples). The UaNode based implementation is NodeManagerUaNode and it has .getNodes which returns a NodeMap which is used to store the nodes. The NodeMap is an abstract base and the default implementation of NodeManagerUaNode.createNodeMap does create NodeMapUaNode which has a .getMap which can used to obtain a map of NodeId -> UaNode of the manager.

– Bjarne

September 19, 2017
16:58, EEST
Avatar
Thomas Reuther
Member
Members
Forum Posts: 33
Member Since:
September 18, 2017
sp_UserOfflineSmall Offline

Hi Bjarne,

thank you for information, and to understand the difference between NodeManager and NodeManagerUaNode.

In my case the “Ids” file is empty (except an “init” method). I hope in future the code generator will generate ids of instances too.

I took a second look at the generated file for .Net: it contains the identifiers itself (e.g. “5013”) as well as ExpandedNodeIds.

Thomas

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
15 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: 730

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1