Open RoseauBruyant opened 2 years ago
My test code :
/// <summary>
/// Handles a change to the publish status for the subscription.
/// </summary>
void Subscription_PublishStatusChanged(object subscription, EventArgs e)
{
if (InvokeRequired)
{
BeginInvoke(m_PublishStatusChanged, subscription, e);
return;
}
else if (!IsHandleCreated)
{
return;
}
try
{
// ignore notifications for other subscriptions.
if (!Object.ReferenceEquals(m_subscription, subscription))
{
return;
}
// SPY Start ////////////////////////////////
IList<Opc.Ua.MonitoredItemNotification> l_ListOfNotifications = m_subscription.LastNotification.GetDataChanges(false);
foreach (Opc.Ua.MonitoredItemNotification notification in l_ListOfNotifications)
{
Console.WriteLine("---------------------");
Console.WriteLine("n" + notification.Value.Value.ToString());
Console.WriteLine("n" + notification.Value.StatusCode.Code.ToString());
Console.WriteLine("n" + notification.Value.ServerPicoseconds.ToString());
Console.WriteLine("n" + notification.Value.ServerTimestamp.ToString());
Console.WriteLine("n" + notification.Value.SourcePicoseconds.ToString());
Console.WriteLine("n" + notification.Value.SourceTimestamp.ToString());
}
// SPY END //////////////////////////////////
// notify controls of the change.
DataChangesCTRL.PublishStatusChanged();
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
}
}
@RoseauBruyant I think thats a bug... but needs investigation.
thank you for your reply
Type of issue
Current Behavior
Subscription PublishStatusChanged events : There is no change in value, but events occur (at the rate of keep alive)
Expected Behavior
If there is no change in value, there is no event
Steps To Reproduce
I observed a problem in my applications. I have tried different settings without success. I present the problem here using available sources.
With sources "UA-.NETStandard-Samples-master", opening solution "UA Sample Applications.sln". Selecting the "UA Sample Server" project on startup and launching.
Copy of project "UA-.NETStandard-Samples-master", launch of solution "UA Sample Applications.sln". Selecting the "UA Sample Client" project at startup and launching.
In the client, enter the URL of the server "opc.tcp://desktop-XXXX:51210/UA/SampleServer" and select the first choice "SignAndEncrypt" "Basic256Sha256" ... and connect "Anonymous"
in "MySession 1",Select the variable "Objects/Data/Static/Scalar/Byte Value", right click "Subscribe>New".
problem: In project "UA Sample Controls/Subscriptions/SubscriptionsDlg.cs" in the function, void Subscription_PublishStatusChanged(object subscription, EventArgs e) With a spy, we observe that the event occurs without changing the item.
is there a bug? A specific parameter to fill in ? A mistake from me ?
Environment
No response
Anything else?
No response