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 ...

Moderator: uasdknet

Post Reply
sudhapc
Hero Member
Hero Member
Posts: 28
Joined: 16 Oct 2018, 12:47

Client is not getting notification from server on update

Post by sudhapc »

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
Hero Member
Hero Member
Posts: 28
Joined: 16 Oct 2018, 12:47

Re: Client is not getting notification from server on update

Post by sudhapc »

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.

Post Reply