Hi,
Is there a way with the SDK to instanciate UDT tags :
I need to be able to create some new equipement from an existing type (defined by an UDT), on the fly from a sql table witch contains the new equipement to add.
Hi,
Is there a way with the SDK to instanciate UDT tags :
I need to be able to create some new equipement from an existing type (defined by an UDT), on the fly from a sql table witch contains the new equipement to add.
It is possible to create new UDT Instance tags, as well as other types of tags, by defining them through the creation of a TagDefinition, and then adding them to the correct provider with GatewayContext.getTagManager().addTags(…). Obviously, this is a bit tricky, and isn’t very well documented for module authors, but possible.
So, a few notes:
Example:
TagDefinition newInst = new TagDefinition("ExampleInstance",TagType.UDT_INST);
newInst.setAttribute(TagProp.UDTParentType, new BasicTagValue("ParentUDTTag"));
context.getTagManager().addTags(TagPathParser.parse("[default]InstanceFolder/"), Arrays.asList((TagNode)newInst),CollisionPolicy.Overwrite);
Now, the problem is, overridding properties is not nearly so simple. You need to get the UUID of the member whose property you want to override, and create various structures. Perhaps the easiest route is for you to tell me which properties you need to modify, and I can try to give you some direction.
Regards,
Thanks a lot for this accurate response.
SDK is a bit complex but so powerfull
My need is just to instanciate in the first time.
Properties are the same for all the equipement and I use a gateway module to change the tags values collected from the equipement through TCP connexion with a non standard-protocol.
I begin with the 7.3 version, no UDT.
I create 1 folder by equipement and acces the tag with the SDK.
With the 7.4, I convert folder to UDT and the module work without any change ! and the HMI as well !
Really impressive !