예제 #1
0
        /// <summary>
        ///     Compare current aggregator config against another config.
        /// </summary>
        /// <param name="config">aggregator config</param>
        /// <returns>true if objects are equal</returns>
        public bool Equals(AggregatorConfig config)
        {
            if (!base.Equals(config))
            {
                return(false);
            }

            if (MaxLevel != config.MaxLevel)
            {
                return(false);
            }

            if (AggregationAlgorithm != config.AggregationAlgorithm)
            {
                return(false);
            }

            if (AggregationPeriod != config.AggregationPeriod)
            {
                return(false);
            }

            if (MaxRequests != config.MaxRequests)
            {
                return(false);
            }

            return(true);
        }
        private void CheckAggregatorConfigChange(Pdu pdu)
        {
            if (AggregatorConfigChanged != null)
            {
                AggregatorConfigResponsePayload configPayload = GetPayload(pdu, Constants.AggregatorConfigResponsePayload.TagType, null) as AggregatorConfigResponsePayload;
                if (configPayload != null)
                {
                    AggregatorConfig aggregatorConfig = new AggregatorConfig(configPayload);

                    if (_currentAggregatorConfig == null || !_currentAggregatorConfig.Equals(aggregatorConfig))
                    {
                        _currentAggregatorConfig = aggregatorConfig;
                        AggregatorConfigChanged?.BeginInvoke(this, new AggregatorConfigChangedEventArgs(_currentAggregatorConfig), EndAggregatorConfigChanged, null);
                    }
                }
            }
        }
 /// <summary>
 /// Create aggregator configuration changed event arguments class instance.
 /// </summary>
 /// <param name="aggregatorConfig">New aggregator configuration</param>
 /// <param name="ksiService">KsiService that made the aggregator configuration request</param>
 public AggregatorConfigChangedEventArgs(AggregatorConfig aggregatorConfig, IKsiService ksiService = null)
 {
     AggregatorConfig = aggregatorConfig;
     KsiService       = ksiService;
 }