Find and share HowTos to various installations / configurations!
7 posts • Page 1 of 1
7 posts
• Page 1 of 1
CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am
Howto - Driver dyn type transformation
Postby CyaNn »
Hello Wincc team.
I am developping a driver and I neet to know how to deal with dyn types within driver transformation classes.
For example, I need that my driver receive a message and put in a DynString in my database (using standard periphery address like others).
My driver receive a JSon message that containing string array and I want to put it on a DP with DynString type.
The problem I have is that I don't have any example of a xxxTrans.cxx object and I don't know how to address it (and size seems to be challenging)
So my question was : do you have some xxxTrans.cxx example to give me that deal with dynString data ?
So far havent done this. However you should inspire yourself from existing API example like TCP driver. There is conversion from visible to string which could be a good starting point I think.
You can use a TEXTVAR which you will split using some json fct and put elements in a dynVar.
I assume the size is challenging, because it is not fixed and you do not want to limit it at a value that bigger than needed in many cases but not sufficient in some cases.
In that case you could store a pointer to your data in the buffer and make sure to override the HWObject functions 'deleteData', 'updateBufferLlc' and 'compareLlc' to prevent a memory leak and get a working old/new comparison.
Alexandre : Yes I've already done the String, bool, int and float transformations and inspired me from the provided TCPDriver transformation class. But dyn var seems to be quite challenging. That's why I searching some examples / tuto