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: 982
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: 518

Currently Online:
19 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 75

ibrahim: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 707

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1465

Posts: 6252

Newest Members:

christi10l, ahamad1, Flores Frederick, ellenmoss, harriettscherer, shanonhumphreys, KupimotoblokfuB, tamhollander5, paulinafcf, bridgette18l

Moderators: Jouni Aro: 1009, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 982, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 319, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1