dpSetTimed() is used often and also drivers are using it when the timestamp given by the PLC is used.
Therefore using a check for _stime is not a guarantee that you get the correct result.
Best Regards
Leopold Knipp
Senior Support Specialist
How to know which data point trigger the call back function in dpConnect logic
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: How to know which data point trigger the call back function in dpConnect logic
- maoyi8212
- Posts:9
- Joined: Tue Feb 21, 2017 3:47 am
Re: How to know which data point trigger the call back function in dpConnect logic
@Leo @Frenk @Nuno. Thank you for your kindly help.
So now I tried to update my script using dpQueryConnectSingle and I was doing my test like following:
main()
{
int rc;
anytype userData =getUserName();
rc = dpQueryConnectSingle("workCB", true, userData, "SELECT '_original.._value' FROM 'ExampleDP_SumAlert*.' WHERE _DPT=\\"ExampleDP_Text\\"");
DebugN("After the QueryConnectSingle", rc);
}
void workCB(anytype userData, dyn_dyn_anytype val)
{
int i;
DebugN("Callback:",dynlen(val));
for (i = 2; i
So now I tried to update my script using dpQueryConnectSingle and I was doing my test like following:
main()
{
int rc;
anytype userData =getUserName();
rc = dpQueryConnectSingle("workCB", true, userData, "SELECT '_original.._value' FROM 'ExampleDP_SumAlert*.' WHERE _DPT=\\"ExampleDP_Text\\"");
DebugN("After the QueryConnectSingle", rc);
}
void workCB(anytype userData, dyn_dyn_anytype val)
{
int i;
DebugN("Callback:",dynlen(val));
for (i = 2; i
- fmulder
- Posts:330
- Joined: Wed Feb 03, 2010 9:46 am
Re: How to know which data point trigger the call back function in dpConnect logic
Your code seems ok and it should trigger only when the datapoint elements.
Please use the para to look at the datapoints that you monitor. Look at the timestamp of these datapoint elements. They should not change all the time.
I'm pretty sure that a dpQieryConnectSingle() will only fire when the related datapoints actually change.
Good luck
Frenk Mulder
Please use the para to look at the datapoints that you monitor. Look at the timestamp of these datapoint elements. They should not change all the time.
I'm pretty sure that a dpQieryConnectSingle() will only fire when the related datapoints actually change.
Good luck
Frenk Mulder
- maoyi8212
- Posts:9
- Joined: Tue Feb 21, 2017 3:47 am
Re: How to know which data point trigger the call back function in dpConnect logic
@Frenk, thanks!
I have checked the the timestamp of these datapoint elements and it actually changes. So the original value means not only the value it self but also the timestamp. right? So maybe I need to check the configuraion of data point itself.
I have checked the the timestamp of these datapoint elements and it actually changes. So the original value means not only the value it self but also the timestamp. right? So maybe I need to check the configuraion of data point itself.
- nmnogueira
- Posts:125
- Joined: Thu May 05, 2011 12:59 pm
Re: How to know which data point trigger the call back function in dpConnect logic
Yes, if the timestamp changes, the callback will be triggered. If you are reading the values from a PLC, make sure that the option "Low Level Comparison" is enabled.
- maoyi8212
- Posts:9
- Joined: Tue Feb 21, 2017 3:47 am
Re: How to know which data point trigger the call back function in dpConnect logic
@Nuno, Thank for for your suggestion. It's due to my wrong configuration of "Low level Comparison"