Login  •  Register


Client is not getting notification from server on update

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Client is not getting notification from server on update

Postby sudhapc » 04 Jun 2019, 09:18

Hi Team,

I am trying to update a node from my opcua client.
I have subscribed to data change event in client but am not getting any notification from server,please help.
I have written a test case and below is the client code

public UnifiedAutomation.UaClient.Subscription CreateSubscriptionsAndMonitoredItems(Session session)
{
CreateSubscription(session);
m_Subscription.Create();
CreateMonitoredItemOnServerNodeForModelChangeEvents(session);
return m_Subscription;
}

private void CreateSubscription(Session session)
{
m_Subscription = new UnifiedAutomation.UaClient.Subscription(session)
{
PublishingEnabled = true,
PublishingInterval = 500,
MaxKeepAliveTime = 10000
};

}

public void CreateMonitoredItemOnServerNodeForModelChangeEvents(Session session)
{
LocalizedText displayName = new LocalizedText("xyz");
var monitoredItems = new List<UnifiedAutomation.UaClient.MonitoredItem>();
monitoredItems.Add(new DataMonitoredItem(m_Id)
{
UserData = displayName
});
m_Subscription.CreateMonitoredItems(monitoredItems);

}

private void SubscribeToNecessaryEvents(UnifiedAutomation.UaClient.Subscription subscription)
{
subscription.DataChanged += new DataChangedEventHandler(Subscription_DataChanged);
}
void Subscription_DataChanged(UnifiedAutomation.UaClient.Subscription subscription, DataChangedEventArgs e)
{
LocalizedText displayName = new LocalizedText("xyz");
foreach (DataChange dataChange in e.DataChanges)
{
if (dataChange.MonitoredItem.UserData.Equals(displayName) && dataChange.Value.Value != null)
{
DataValue value = dataChange.Value;
}
}
m_NewEventDataClass.IsOperationCompleted = true;
}

Should i do anything in server code ?
my write service statuscode is good.
sudhapc
Sr. Member
Sr. Member
 
Posts: 16
Joined: 16 Oct 2018, 12:47

Re: Client is not getting notification from server on update

Postby sudhapc » 05 Jun 2019, 08:03

On updating variable node i am able to monitor the changes ,but when i am trying to update object node(like updaing display name) event is not getting captured in client.

Is SDK Handles data change event only for variable nodes ?
if yes then what about object nodes ,should we handle anything in server side ? please help.
sudhapc
Sr. Member
Sr. Member
 
Posts: 16
Joined: 16 Oct 2018, 12:47


Return to .NET based OPC UA SDK

Who is online

Users browsing this forum: MSN [Bot] and 0 guests