Read/Write Dyn String in API
Search
-
martin.jelemensky
- Posts: 16
- Joined: Wed Aug 09, 2017 1:20 pm
Read/Write Dyn String in API
Hello, Can somebody please advise me how to read/write a dyn string in API manager ?? Are there some manuals or some examples ??
Re: Read/Write Dyn String in API
You mean you want to send a new value for a DPE of type dyn_string ?
Code: Select all
DynVar dyn(TEXT_VAR);
dyn.append(new TextVar("one"));
dyn.append(new TextVar("two"));
Manager::dpSet(dpid, dyn);
-
martin.jelemensky
- Posts: 16
- Joined: Wed Aug 09, 2017 1:20 pm
Re: Read/Write Dyn String in API
actually the problem i am solving now is that i need to read lines (the content of the dp of type dyn_string) in wincc oa then append new lines to the text and the send it back to the same datapoint.
Re: Read/Write Dyn String in API
So I assume you already have the content as a DynVar instance ?
Code: Select all
for (DynPtrArrayIndex i = 0; i < dyn.getNumberOfItems(); i++)
std::cerr getString()-
martin.jelemensky
- Posts: 16
- Joined: Wed Aug 09, 2017 1:20 pm
Re: Read/Write Dyn String in API
Thank you for the answer (sorry for the delay). However, I would like to continue on this topic a little bit because my API manager (working on WinXP SP3 x86, WinCC OA 3.10 x86, VS2008) crashes. Based on debugging i found out that the problem always appears when i want to write a value of "dyn_string" into a datapoint. I have a for cycle where a fill the DynVar variable : cFunc.mDynVar.append(TextVar(mfDpText)); --> cFunc is a constructor for a class, and mfDpText is of type char [10000]; and then i have the following code
res_id = Manager::getId(dpName, dpId);
res_dp = Manager::dpSet(dpId, cFunc.mDynVar);
I works for a while but the is crashes alwyas when he wants to execute those lines. And also get the following entries in the log :
PVSS00pmon (1), 2017.12.17 21:47:09.161, SYS, WARNING, 36/pmon, Blocking Manager PVSS00MsduR1(5) detected. No heartbeat since 30 seconds.
PVSS00pmon (1), 2017.12.17 21:52:39.623, SYS, WARNING, 39/pmon, Manager PVSS00MsduR1(5) is no longer blocking.
PVSS00data (0), 2017.12.17 22:06:38.215, SYS, WARNING, 39, Connection lost, MAN: (SYS: 1 Api -num 5 CONN: 1), Connection reset by peer (10054)
PVSS00event (0), 2017.12.17 22:06:38.215, SYS, WARNING, 39, Connection lost, MAN: (SYS: 1 Api -num 5 CONN: 1), Connection reset by peer (10054)
is there any connection between wirting into datapoint and those warnings ?
res_id = Manager::getId(dpName, dpId);
res_dp = Manager::dpSet(dpId, cFunc.mDynVar);
I works for a while but the is crashes alwyas when he wants to execute those lines. And also get the following entries in the log :
PVSS00pmon (1), 2017.12.17 21:47:09.161, SYS, WARNING, 36/pmon, Blocking Manager PVSS00MsduR1(5) detected. No heartbeat since 30 seconds.
PVSS00pmon (1), 2017.12.17 21:52:39.623, SYS, WARNING, 39/pmon, Manager PVSS00MsduR1(5) is no longer blocking.
PVSS00data (0), 2017.12.17 22:06:38.215, SYS, WARNING, 39, Connection lost, MAN: (SYS: 1 Api -num 5 CONN: 1), Connection reset by peer (10054)
PVSS00event (0), 2017.12.17 22:06:38.215, SYS, WARNING, 39, Connection lost, MAN: (SYS: 1 Api -num 5 CONN: 1), Connection reset by peer (10054)
is there any connection between wirting into datapoint and those warnings ?
Re: Read/Write Dyn String in API
What you do does seem correct, and I don't think the "blocking" manager is related to the dpSet().
How many elements in the DynVar are you appending ?
And is the array empty before you append new values or can it be that the array is getting longer and longer ?
You could check with a debugger and breaking your manager when it's detected to be blocking to find out where in your code
the execution is doing nasty things.
How many elements in the DynVar are you appending ?
And is the array empty before you append new values or can it be that the array is getting longer and longer ?
You could check with a debugger and breaking your manager when it's detected to be blocking to find out where in your code
the execution is doing nasty things.
-
martin.jelemensky
- Posts: 16
- Joined: Wed Aug 09, 2017 1:20 pm
Re: Read/Write Dyn String in API
1.) How many elements in the DynVar are you appending ?
--> this is also dynamic it always depends on the received message that i have to parse (it is actually a xml i i need to parse the information from it)
2.) And is the array empty before you append new values or can it be that the array is getting longer and longer ?
yes the array is always cleared before i start filling it i use the command : cFunc.mDynVar.clear();
also for example what i tried is that i processed the received xml with the data on a local machine and it did not crashed but on the server the manager crashed.
And if i can also ask, because i did not find it in the manula what is the maximum size, lenght of the dyn_string array ? is this somehow limited ?
--> this is also dynamic it always depends on the received message that i have to parse (it is actually a xml i i need to parse the information from it)
2.) And is the array empty before you append new values or can it be that the array is getting longer and longer ?
yes the array is always cleared before i start filling it i use the command : cFunc.mDynVar.clear();
also for example what i tried is that i processed the received xml with the data on a local machine and it did not crashed but on the server the manager crashed.
And if i can also ask, because i did not find it in the manula what is the maximum size, lenght of the dyn_string array ? is this somehow limited ?
Re: Read/Write Dyn String in API
The real limit is just memory.
-
martin.jelemensky
- Posts: 16
- Joined: Wed Aug 09, 2017 1:20 pm
Re: Read/Write Dyn String in API
so aftera while i found out that it crashes at the following line :
res_dp = Manager::dpSet(dpId, cFunc.mDynVar);
i also looked at the dynVar variable however, this was nice and contained all the informations that should.
Is there any problem with this line of code ?
res_dp = Manager::dpSet(dpId, cFunc.mDynVar);
i also looked at the dynVar variable however, this was nice and contained all the informations that should.
Is there any problem with this line of code ?
Re: Read/Write Dyn String in API
No problem with this line.
There must be some other problem in your code.
On Linux you can use valgrind to check for illegal memory access, on windows probably purify or some other tool
There must be some other problem in your code.
On Linux you can use valgrind to check for illegal memory access, on windows probably purify or some other tool