public void SetState(MotionDetectorState newState) { var oldState = State; State = newState; StateChanged?.Invoke(this, new MotionDetectorStateChangedEventArgs(oldState, newState)); }
private void UpdateState(MotionDetectorState newState) { MotionDetectorState oldState = _state; _state = newState; if (!Settings.IsEnabled.Value) { return; } if (newState == MotionDetectorState.MotionDetected) { Logger.Info(Id + ": Motion detected"); _motionDetectedTrigger.Invoke(); } else { Logger.Verbose(Id + ": Detection completed"); _detectionCompletedTrigger.Invoke(); } StateChanged?.Invoke(this, new MotionDetectorStateChangedEventArgs(oldState, newState)); }
public void FireDetectionCompleted() { State = MotionDetectorState.Idle; _motionDetectedTrigger.Invoke(); }
public void WalkIntoMotionDetector() { State = MotionDetectorState.MotionDetected; _motionDetectedTrigger.Invoke(); }