Ejemplo n.º 1
0
 public bool GetTriggerConfigured(IPlugInAPI.strTrigActInfo actionInfo)
 {
     _triggerSettings = GetSettingsFromTriggerInfo(actionInfo);
     if (_triggerSettings.DeviceIdChosen.HasValue && _triggerSettings.DeviceIdChosen.Value > -1)
     {
         OnDeviceIdSet(_triggerSettings.DeviceIdChosen.Value);
     }
     return(_triggerSettings.GetTriggerConfigured());
 }
Ejemplo n.º 2
0
        public bool TriggerTrue(IPlugInAPI.strTrigActInfo actionInfo, IStorageHandler storageHandler)
        {
            _triggerSettings = GetSettingsFromTriggerInfo(actionInfo);
            if (_triggerSettings != null && _triggerSettings.GetTriggerConfigured())
            {
                var fromDate   = SystemDateTime.Now().AddHours(_triggerSettings.TimeSpanChosen.Value.TotalHours * -1);
                var dataPoints = storageHandler.GetValuesForDevice(_triggerSettings.DeviceIdChosen.Value, fromDate,
                                                                   SystemDateTime.Now());

                //_logging.LogDebug($"calling trigger for computation _dataCurveComputationHandler==null={_dataCurveComputationHandler==null}");

                if (_triggerSettings.UseFutureComputation && _triggerSettings.GetTriggerConfigured())
                {
                    return(_dataCurveComputationHandler.TriggerTrue(dataPoints, _triggerSettings.AscendingOrDescending, _triggerSettings.FutureThresholdValue, _triggerSettings.FutureComputationTimeSpan));
                }

                return(_dataCurveComputationHandler.TriggerTrue(dataPoints, _triggerSettings.AscendingOrDescending));
            }
            return(false);
        }