Page 1 of 1

overwrite subscription / monitored item settings

Posted: 05 Oct 2017, 09:43
by martenbyebye
Hi,

I would like to prevent the client from setting up too high sampling and publishing rates. Where in the framework should the server define the actual subscription settings / monitored item settings?

Re: overwrite subscription / monitored item settings

Posted: 09 Oct 2017, 12:22
by Support Team
Hello martenbyebye,

you can set the limits for the publishing interval in the server configuration.
see here:
http://documentation.unified-automation ... chema.html

The place where you can set the minimum SamplingInterval depends on which level of the SDK you add your implementation (SDK layer or Toolkit layer). See here for overview:
http://documentation.unified-automation ... ction.html

1) On Toolkit level (your NodeManager is a subclass of BaseNodeManager):
override StartDataMonitoring and set the SamplingInterval. e.g.

Code: Select all

    if (settings.RequestedParameters.SamplingInterval < 2000)
    {
        settings.RequestedParameters.SamplingInterval = 2000;
    }
2) On SDK Level (your implementation inherits / implements IIOManager):
You call StartDataMonitoringCompleteEventHandler in your implementatio and set the RevidedSamplingInterval there.

Re: overwrite subscription / monitored item settings

Posted: 23 Oct 2017, 17:12
by martenbyebye
Thank you Support Team,

I am now successfully changing the properties, i.e. using UaExpert I can see the revised settings :) . But my test code seems to be wrong.

Where is the revised SamplingInterval?

Code: Select all

var monitoredItems = new List<MonitoredItem>
{
    new DataMonitoredItem(nodeId) { SamplingInterval = desiredSamplingInterval }
};

var statusCodes = this.subscription.CreateMonitoredItems(
    monitoredItems,
    new RequestSettings { OperationTimeout = 10000, MaxOperationsPerRequest = ushort.MaxValue, });

foreach (var monitoredItem in this.subscription.MonitoredItems)
{
    monitoredItem.SamplingInterval.ShouldBe(correctRevisedSamplingInterval); // This fails. 
}

Re: overwrite subscription / monitored item settings

Posted: 27 Sep 2019, 12:43
by pkrawal
Can you please give an example for overriding StartDataMonitoring() method in example GettingStarted.Lesson3 ?