



02/24/2014

Can anyone explain or provide an example for how to identify the OnDataChange() event that matches a Refresh request? In my tests, each OnDataChange event comes with a null value for the requestHandle parameter.
I’m testing with code slightly modified from the available download “opc-net-api-sample-clients-2.01.107-20180130”. I’ve changed the Refresh request code in SubscriptionsTreeCtrl to this:
private void Refresh(Subscription subscription)
{
refreshRequestId++;
try
{
IRequest requestToken = null;
subscription.Refresh(refreshRequestId, out requestToken);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
… where “refreshRequestId” is an integer.
I can see that the “requestToken” gets values assigned. At this point I’m not concerned about its content so it’s just a local variable.
In UpdatesListViewCtrl, the event handler:
private void OnDataChange(object subscriptionHandle, object requestHandle, ItemValueResult[] values)
gets called with data changes but but ‘requestHandle’ is always null and there doesn’t seem to be any other way to pair the callback with a specific refresh request.
Thanks
1 Guest(s)