private void DispatchEvents(object sender, BinaryStateChangedEventArgs eventArgs)
 {
     // The relay at the motion detector is awlays held to high.
     // The signal is set to false if motion is detected.
     if (eventArgs.NewState == BinaryState.Low)
     {
         MotionDetected?.Invoke(this, EventArgs.Empty);
     }
     else
     {
         DetectionCompleted?.Invoke(this, EventArgs.Empty);
     }
 }
 public void CompleteDetection()
 {
     DetectionCompleted?.Invoke(this, EventArgs.Empty);
 }