public ServiceResult ModifyAttributes(
DiagnosticsMasks diagnosticsMasks,
TimestampsToReturn timestampsToReturn,
uint clientHandle,
MonitoringFilter originalFilter,
MonitoringFilter filterToUse,
Range range,
double samplingInterval,
uint queueSize,
bool discardOldest)
{
lock (m_lock)
{
m_diagnosticsMasks = diagnosticsMasks;
m_timestampsToReturn = timestampsToReturn;
m_clientHandle = clientHandle;
m_discardOldest = discardOldest;
m_originalFilter = originalFilter;
m_filterToUse = filterToUse;
if (range != null)
{
m_range = range.High - range.Low;
}
SetSamplingInterval(samplingInterval);
m_queueSize = queueSize;
// check if aggregate filter has been updated.
ServerAggregateFilter aggregateFilter = filterToUse as ServerAggregateFilter;
if (filterToUse is ServerAggregateFilter)
{
ServerAggregateFilter existingFilter = filterToUse as ServerAggregateFilter;
bool match = existingFilter != null;
if (match) if (existingFilter.AggregateType != aggregateFilter.AggregateType) match = false;
if (match) if (existingFilter.ProcessingInterval != aggregateFilter.ProcessingInterval) match = false;
if (match) if (existingFilter.StartTime != aggregateFilter.StartTime) match = false;
if (match) if (!existingFilter.AggregateConfiguration.IsEqual(aggregateFilter.AggregateConfiguration)) match = false;
if (!match)
{
m_calculator = m_server.AggregateManager.CreateCalculator(
aggregateFilter.AggregateType,
aggregateFilter.StartTime,
DateTime.MaxValue,
aggregateFilter.ProcessingInterval,
aggregateFilter.Stepped,
aggregateFilter.AggregateConfiguration);
}
}
// report change to item state.
ServerUtils.ReportModifyMonitoredItem(
m_nodeId,
m_id,
m_samplingInterval,
m_queueSize,
m_discardOldest,
m_filterToUse,
m_monitoringMode);
InitializeQueue();
return null;
}
}