diff --git a/app/src/main/java/com/example/ueberwachungssystem/Detector.java b/app/src/main/java/com/example/ueberwachungssystem/Detector.java index 2d83cfe..d09fe1f 100644 --- a/app/src/main/java/com/example/ueberwachungssystem/Detector.java +++ b/app/src/main/java/com/example/ueberwachungssystem/Detector.java @@ -1,14 +1,17 @@ package com.example.ueberwachungssystem; import android.content.Context; - import androidx.annotation.NonNull; + abstract public class Detector { private OnDetectionListener listener; + /** Constructor - takes context of current activity */ public Detector(Context context) {}; + + /** On Detection Listener - runs when violation is reported */ public interface OnDetectionListener { void onDetection(@NonNull DetectionReport detectionReport); } @@ -16,6 +19,8 @@ abstract public class Detector { this.listener = listener; } + + /** Triggers onDetectionListener - call this to trigger violation/alarm */ private void reportViolation(String detectorID, String detectionType, float amplitude) { if (listener != null) { DetectionReport detectionReport = new DetectionReport(detectorID, detectionType, amplitude); @@ -25,6 +30,10 @@ abstract public class Detector { } } + + /** Starts Detection (abstract method: needs to be overridden in child class) */ public abstract void startDetection(); + + /** Stops Detection (abstract method: needs to be overridden in child class) */ public abstract void stopDetection(); } \ No newline at end of file