GSF.TimeSeries.Alarm.Test C# (CSharp) Method

Test() public method

Tests the value of the given measurement to determine whether the alarm should be raised or cleared.
public Test ( IMeasurement measurement ) : bool
measurement IMeasurement The measurement whose value is to be tested.
return bool
        public bool Test(IMeasurement measurement)
        {
            if (m_state == AlarmState.Raised && m_clearTest(measurement))
            {
                m_state = AlarmState.Cleared;
                return true;
            }

            if (m_state == AlarmState.Cleared && m_raiseTest(measurement))
            {
                m_state = AlarmState.Raised;
                Cause = measurement;
                return true;
            }

            return false;
        }