Page 1 of 1

C++ dpSet API

Posted: Mon Sep 09, 2019 10:35 am
by Nikolay
Dear colleagues. There was a need to transfer the value from a program written in the C ++ programming language to the WinCC environment, namely to Para. Tell me, please, is there a simple solution when using the API functions? I found this design in the documentation:

dpSet (const DpIdentifier & dpId, const Variable & value, const ManagerIdentifier & target = eventId);

Maybe there is an example of using this function? Thank you in advance.

Re: C++ dpSet API

Posted: Tue Sep 10, 2019 6:56 am
by leoknipp
If you want to write information which shall be accessible by other WinCC OA processes you have to make a dpSet() to a datapoint element.
When are using an own API manager based on the WinCC OA API toolkit you can use the function dpSet().

Best Regards
Leopold Knipp
Senior Support Specialist

Re: C++ dpSet API

Posted: Tue Sep 10, 2019 9:47 am
by Nikolay
You understood me wrong. I am writing a program in pure c ++. What libraries do I need to connect and what parameters should I pass to the dpSet function to write to Para?

#include "stdio.h"
#include "wincc_lib" // ?????

int main () {
int a = 5;
dpSet("dataPoint", a); // ?????
return 0;
}

Please show an example. We already studied at an advanced course, but still did not understand how to do it.

Re: C++ dpSet API

Posted: Tue Sep 10, 2019 10:53 am
by leoknipp
If you want to implement functionality in C++ you can write an own API manager or a C++ extension.
Both possibilities are based on the API toolkit.
For details please have a look at the WinCC OA Documentation, e.g. Special functions --> Control Extensions.

Best Regards
Leopold Knipp
Senior Support Specialist

Re: C++ dpSet API

Posted: Tue Sep 10, 2019 11:30 am
by Nikolay
I don't need c ++ functionality inside wincc shell. Quite the contrary. I need to pass a value from a c ++ program (developed in visual studio or borland builder) to wincc.

Re: C++ dpSet API

Posted: Wed Sep 11, 2019 7:37 am
by gschijndel
To write a value to WinCC OA you will need a WinCC OA manager, which has a connection to the data & event managers. This can be an existing manager like ascii, control, driver or your own special API manager (Documentation -> Add-ons -> API).

Depending on your requirements you can choose what is the best option for your situation.
If only a few values need to be written you could start the ascii manager for each value you want to write and use the direct set mode (-set option).
If a high performance is required an API manager or a northbound 'driver' (like OPC UA server) as interface would be the best choice. An API manager has to be recompiled for newer WinCC OA versions (3.17), which would not be needed when using a standard interface.