Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d17f455ae1 | ||
|
|
3b88a140cc |
No files matched your search
@@ -3,6 +3,8 @@ package com.example.ueberwachungssystem.Detection;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.example.ueberwachungssystem.WifiCommunication;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -38,6 +40,16 @@ public class DetectionReport {
|
|||||||
return String.join("\t", state, time, type, value);
|
return String.join("\t", state, time, type, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toMessage() {
|
||||||
|
String state;
|
||||||
|
if(detectionState)
|
||||||
|
state = "An";
|
||||||
|
else
|
||||||
|
state = "Aus";
|
||||||
|
|
||||||
|
return String.join(",", "1", timeStamp, "Gruppe2", WifiCommunication.getLocalIpAddress(), state, detectionType, String.valueOf(detectedValue));
|
||||||
|
}
|
||||||
|
|
||||||
/** Debug Report */
|
/** Debug Report */
|
||||||
public void log(String tag) {
|
public void log(String tag) {
|
||||||
Log.d(tag, this.toString());
|
Log.d(tag, this.toString());
|
||||||
|
|||||||
@@ -91,84 +91,6 @@ public class DetectorService extends LifecycleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Video Detection */
|
|
||||||
public void startVideoDetection() {
|
|
||||||
if(videoDetector != null)
|
|
||||||
videoDetector.startDetection();
|
|
||||||
}
|
|
||||||
public void stopVideoDetection() {
|
|
||||||
if(videoDetector != null)
|
|
||||||
videoDetector.stopDetection();
|
|
||||||
}
|
|
||||||
public boolean isVideoDetectionRunning() {
|
|
||||||
if(videoDetector != null)
|
|
||||||
return videoDetector.isDetecting();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public void debugVideoProcessing(ImageView input, ImageView output) {
|
|
||||||
if(videoDetector != null)
|
|
||||||
videoDetector.debugProcessing(input, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Audio Detection */
|
|
||||||
public void startAudioDetection() {
|
|
||||||
if(audioDetector != null)
|
|
||||||
audioDetector.startDetection();
|
|
||||||
}
|
|
||||||
public void stopAudioDetection() {
|
|
||||||
if(audioDetector != null)
|
|
||||||
audioDetector.stopDetection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Motion Detection */
|
|
||||||
public void startMotionDetection() {
|
|
||||||
if(motionDetector != null)
|
|
||||||
motionDetector.startDetection();
|
|
||||||
}
|
|
||||||
public void stopMotionDetection() {
|
|
||||||
if(motionDetector != null)
|
|
||||||
motionDetector.stopDetection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Video Recording */
|
|
||||||
public void startVideoRecording() {
|
|
||||||
if(videoDetector != null)
|
|
||||||
videoDetector.startRecording();
|
|
||||||
}
|
|
||||||
public void stopVideoRecording() {
|
|
||||||
if(videoDetector != null)
|
|
||||||
videoDetector.stopRecording();
|
|
||||||
}
|
|
||||||
public boolean isVideoRecordingRunning() {
|
|
||||||
if(videoDetector != null)
|
|
||||||
return videoDetector.isRecording();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public void setVideoRecordingDir(File outputDir) {
|
|
||||||
if (videoDetector != null)
|
|
||||||
videoDetector.setOutputDir(outputDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Audio Recording */
|
|
||||||
public void startAudioRecording() {
|
|
||||||
if(audioRecorder != null)
|
|
||||||
audioRecorder.startRecording();
|
|
||||||
}
|
|
||||||
public void stopAudioRecording() {
|
|
||||||
if(audioRecorder != null)
|
|
||||||
audioRecorder.stopRecording();
|
|
||||||
}
|
|
||||||
public boolean isAudioRecordingRunning() {
|
|
||||||
if(videoDetector != null)
|
|
||||||
return audioRecorder.isRecording();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public void setAudioRecordingDir(File outputDir) {
|
|
||||||
if (audioRecorder != null)
|
|
||||||
audioRecorder.setOutputDir(outputDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Pass Detection Report to Service Detection Listener and trigger it */
|
/** Pass Detection Report to Service Detection Listener and trigger it */
|
||||||
public void passToServiceListener(DetectionReport detectionReport) {
|
public void passToServiceListener(DetectionReport detectionReport) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
|
|||||||
@@ -60,21 +60,28 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
{
|
{
|
||||||
if (detectorService != null){
|
if (detectorService != null){
|
||||||
|
|
||||||
detectorService.debugVideoProcessing(inputImageView, outputImageView);
|
detectorService.videoDetector.debugProcessing(inputImageView, outputImageView);
|
||||||
detectorService.startVideoDetection();
|
detectorService.videoDetector.startDetection();
|
||||||
detectorService.startAudioDetection();
|
|
||||||
detectorService.startMotionDetection();
|
|
||||||
detectorService.startVideoRecording();
|
|
||||||
detectorService.startAudioRecording();
|
|
||||||
|
|
||||||
|
detectorService.audioDetector.startDetection();
|
||||||
|
|
||||||
|
detectorService.motionDetector.startDetection();
|
||||||
|
|
||||||
|
detectorService.audioRecorder.stopRecording();
|
||||||
|
|
||||||
|
detectorService.videoDetector.startRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
detectorService.stopVideoDetection();
|
detectorService.videoDetector.stopDetection();
|
||||||
detectorService.stopAudioDetection();
|
|
||||||
detectorService.stopMotionDetection();
|
detectorService.audioDetector.stopDetection();
|
||||||
detectorService.stopVideoRecording();
|
|
||||||
detectorService.stopAudioRecording();
|
detectorService.motionDetector.stopDetection();
|
||||||
|
|
||||||
|
detectorService.audioRecorder.stopRecording();
|
||||||
|
|
||||||
|
detectorService.videoDetector.stopRecording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -97,7 +104,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
detectorService.setOnDetectionListener(new DetectorService.OnDetectionListener() {
|
detectorService.setOnDetectionListener(new DetectorService.OnDetectionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onDetection(@NonNull DetectionReport detectionReport) {
|
public void onDetection(@NonNull DetectionReport detectionReport) {
|
||||||
Log.d("onDetection", detectionReport.toString());
|
Log.d("onDetection", detectionReport.toMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user