Example #1
0
        /// <summary>
        /// Loads the historical data according to the defined filter.
        /// </summary>
        /// <param name="measuresFilters">List of filters to be applied.</param>
        /// <returns></returns>
        public override async Task LoadMeasuresAsync(MeasuresFilters measuresFilters)
        {
            _valueIndex = 0;
            MeasureScale measureScale = GetScaleFromDateRange(_dateBegin, _dateEnd);

            _measuresData = await _aPICommands.GetMeasure(BaseId, measureScale, measuresFilters, _dateBegin, _dateEnd, Id).ConfigureAwait(false);

            if (_measuresData == null)
            {
                return;
            }
            // Wind
            if (measuresFilters.HasFlag(MeasuresFilters.WindStrength))
            {
                LoadData(_measuresData, HistoryWindStrength);
            }
            if (measuresFilters.HasFlag(MeasuresFilters.WindAngle))
            {
                LoadData(_measuresData, HistoryWindAngle);
            }
            // Gust
            if (measuresFilters.HasFlag(MeasuresFilters.GustStrength))
            {
                LoadData(_measuresData, HistoryGustStrength);
            }
            if (measuresFilters.HasFlag(MeasuresFilters.GustAngle))
            {
                LoadData(_measuresData, HistoryGustAngle);
            }
            if (measuresFilters.HasFlag(MeasuresFilters.DateMaxGust))
            {
                LoadData(_measuresData, HistoryDateMaxGust);
            }
        }
Example #2
0
        /// <summary>
        /// Loads the historical data according to the defined filter.
        /// </summary>
        /// <param name="measuresFilters">List of filters to be applied.</param>
        /// <returns></returns>
        public override async Task LoadMeasuresAsync(MeasuresFilters measuresFilters)
        {
            _valueIndex = 0;
            MeasureScale measureScale = GetScaleFromDateRange(_dateBegin, _dateEnd);

            _measuresData = await _aPICommands.GetMeasure(BaseId, measureScale, measuresFilters, _dateBegin, _dateEnd, Id).ConfigureAwait(false);

            if (_measuresData == null)
            {
                return;
            }
            // Temperatures
            if (measuresFilters.HasFlag(MeasuresFilters.Temperature))
            {
                LoadData(_measuresData, HistoryTemperatures);
            }
            if (measuresFilters.HasFlag(MeasuresFilters.MinTemperature))
            {
                LoadData(_measuresData, HistoryMinTemperatures);
            }
            if (measuresFilters.HasFlag(MeasuresFilters.MaxTemperature))
            {
                LoadData(_measuresData, HistoryMaxTemperatures);
            }
            // Co2
            if (measuresFilters.HasFlag(MeasuresFilters.Co2))
            {
                LoadData(_measuresData, HistoryCo2);
            }
            if (measuresFilters.HasFlag(MeasuresFilters.DateMinCo2))
            {
                LoadData(_measuresData, HistoryDateMinCo2);
            }
            if (measuresFilters.HasFlag(MeasuresFilters.DateMaxCo2))
            {
                LoadData(_measuresData, HistoryDateMaxCo2);
            }
            // Humidity
            if (measuresFilters.HasFlag(MeasuresFilters.Humidity))
            {
                LoadData(_measuresData, HistoryHumidity);
            }
            if (measuresFilters.HasFlag(MeasuresFilters.MinHumidity))
            {
                LoadData(_measuresData, HistoryMinHumidity);
            }
            if (measuresFilters.HasFlag(MeasuresFilters.MaxHumidity))
            {
                LoadData(_measuresData, HistoryMaxHumidity);
            }
            if (measuresFilters.HasFlag(MeasuresFilters.DateMaxHumidity))
            {
                LoadData(_measuresData, HistoryDateMaxHumidity);
            }
        }
Example #3
0
        /// <summary>
        /// Loads the historical data according to the defined filter.
        /// </summary>
        /// <param name="measuresFilters">List of filters to be applied.</param>
        /// <returns></returns>
        public override async Task LoadMeasuresAsync(MeasuresFilters measuresFilters)
        {
            _valueIndex = 0;
            MeasureScale measureScale = GetScaleFromDateRange(_dateBegin, _dateEnd);

            _measuresData = await _aPICommands.GetMeasure(BaseId, measureScale, measuresFilters, _dateBegin, _dateEnd, Id).ConfigureAwait(false);

            if (_measuresData == null)
            {
                return;
            }
            if (measuresFilters.HasFlag(MeasuresFilters.Rain))
            {
                LoadData(_measuresData, HistoryRain);
            }
            if (measuresFilters.HasFlag(MeasuresFilters.SumRain))
            {
                LoadData(_measuresData, HistorySumRain);
            }
        }
Example #4
0
        internal static string ToJsonString(this MeasuresFilters value)
        {
            List <string> filters = new List <string>();

            if (value.HasFlag(MeasuresFilters.Temperature))
            {
                filters.Add("Temperature");
            }
            if (value.HasFlag(MeasuresFilters.Co2))
            {
                filters.Add("CO2");
            }
            if (value.HasFlag(MeasuresFilters.Humidity))
            {
                filters.Add("Humidity");
            }
            if (value.HasFlag(MeasuresFilters.Pressure))
            {
                filters.Add("Pressure");
            }
            if (value.HasFlag(MeasuresFilters.Noise))
            {
                filters.Add("Noise");
            }
            if (value.HasFlag(MeasuresFilters.Rain))
            {
                filters.Add("Rain");
            }
            if (value.HasFlag(MeasuresFilters.WindStrength))
            {
                filters.Add("WindStrength");
            }
            if (value.HasFlag(MeasuresFilters.WindAngle))
            {
                filters.Add("WindAngle");
            }
            if (value.HasFlag(MeasuresFilters.GustStrength))
            {
                filters.Add("GustStrength");
            }
            if (value.HasFlag(MeasuresFilters.GustAngle))
            {
                filters.Add("GustAngle");
            }
            if (value.HasFlag(MeasuresFilters.MinTemperature))
            {
                filters.Add("min_temp");
            }
            if (value.HasFlag(MeasuresFilters.MaxTemperature))
            {
                filters.Add("max_temp");
            }
            if (value.HasFlag(MeasuresFilters.MinHumidity))
            {
                filters.Add("min_hum");
            }
            if (value.HasFlag(MeasuresFilters.MaxHumidity))
            {
                filters.Add("max_hum");
            }
            if (value.HasFlag(MeasuresFilters.MinPressure))
            {
                filters.Add("min_pressure");
            }
            if (value.HasFlag(MeasuresFilters.MaxPressure))
            {
                filters.Add("max_pressure");
            }
            if (value.HasFlag(MeasuresFilters.MinNoise))
            {
                filters.Add("min_noise");
            }
            if (value.HasFlag(MeasuresFilters.MaxNoise))
            {
                filters.Add("max_noise");
            }
            if (value.HasFlag(MeasuresFilters.SumRain))
            {
                filters.Add("sum_rain");
            }
            if (value.HasFlag(MeasuresFilters.DateMaxHumidity))
            {
                filters.Add("date_max_hum");
            }
            if (value.HasFlag(MeasuresFilters.DateMinPressure))
            {
                filters.Add("date_min_pressure");
            }
            if (value.HasFlag(MeasuresFilters.DateMaxPressure))
            {
                filters.Add("date_max_pressure");
            }
            if (value.HasFlag(MeasuresFilters.DateMaxGust))
            {
                filters.Add("date_max_gust");
            }
            if (value.HasFlag(MeasuresFilters.DateMinNoise))
            {
                filters.Add("date_min_noise");
            }
            if (value.HasFlag(MeasuresFilters.DateMaxNoise))
            {
                filters.Add("date_max_noise");
            }
            if (value.HasFlag(MeasuresFilters.DateMinCo2))
            {
                filters.Add("date_min_co2");
            }
            if (value.HasFlag(MeasuresFilters.DateMaxCo2))
            {
                filters.Add("date_max_co2");
            }
            return(String.Join(",", filters.ToArray()));
        }