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
Selecting optional components after instance creation & adding placeholder components
June 13, 2018
16:58, EEST
Avatar
ashwin.fernandes
Member
Members
Forum Posts: 7
Member Since:
May 24, 2018
sp_UserOfflineSmall Offline

Hi,

Is there a possibility to select the optional components after the typenode instance has been created? Something like “Select optional components” functionality provided by UaModeler. If yes, could you provide me with an example implementation.
I require this because in my implementation, the optional component should be created on a need basis.
How are placeholder(Mandatory or Optional) components added using the SDK. Could you please provide me with an example.

Thanks in advance,
Ashwin

June 13, 2018
17:42, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

At the moment there is no “automatic” way to do that _after_ the instace is created (i.e. after call to NodeManagerUaNode.createInstance or createNodeBuilder returns). However if you do add correct node manually to the instance node in question, it should work as-if it were configured to be instantiated _before_ those calls (for that see MyNodeManager.createAlarmNode in the SampleConsoleServer example). (There are some exceptions, e.g. if the InstanceDeclaration node did override something from the TypeDefinition or if there is special logic added to the afterCreate method of the Type in question)

As far as I’m aware, placeholder nodes are not that much used. 3.x codegen does create a List getter for the Types that have placeholders, which does return all subnodes of the node that have same TypeDefinition and ReferenceType that the placeholder node had. However there is no “special” support for them otherwise, but the Mandatory/OptionalPlaceholders only define that the node will have 0 or more (or at least one if mandatory) subnodes that have the same TypeDefinition and are added with same Reference than the placeholder node had. Therefore you can create instances of them with NodeManagerUaNode.createInstance and add them to the node with .addReference (of the manager or UaNode).

P.S. these apply to SDK 3.x; The Server Tutorial covers some of the above (but I’m aware that it should be better). Also maybe we can give better support for this in a future version.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
13 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: 737

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6450

Newest Members:

fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley

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

Administrators: admin: 1