Howto - Driver dyn type transformation

Find and share HowTos to various installations / configurations!
7 posts • Page 1 of 1
CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Howto - Driver dyn type transformation

Post by 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).

I'll apreciate some examples if you have :-)

Many thanks in advance.
Cheers. :)

CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Re: Howto - Driver dyn type transformation

Post by CyaNn »

Anyone can help me ?

adaneau
Posts:310
Joined: Tue Feb 21, 2012 9:49 am

Re: Howto - Driver dyn type transformation

Post by adaneau »

Hi,

What are you exactly trying to do? Input to already existing dyn something from a device? Or just changing some data from string to dyn string?

If first, then driver will not help here: better build a function within dpConnect avoiding you headache.

If second, using functions from xxxTrans.cxx should be enough.

toVar function for converting from HW to WinCCOA. Be careful with itemSize as you are using array.

BR
Alexandre Daneau

CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Re: Howto - Driver dyn type transformation

Post by CyaNn »

Many thanks for your response.

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 ?

adaneau
Posts:310
Joined: Tue Feb 21, 2012 9:49 am

Re: Howto - Driver dyn type transformation

Post by adaneau »

Hi,

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.

BR
Alex

Gertjan van Schijndel
Posts:634
Joined: Mon Aug 02, 2010 10:37 am

Re: Howto - Driver dyn type transformation

Post by Gertjan van Schijndel »

Caron Yann wrote:
size seems to be challenging
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.

CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Re: Howto - Driver dyn type transformation

Post by CyaNn »

Many thanks Gertjan

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 :)

7 posts • Page 1 of 1