Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d9e6b7a3e | ||
|
|
61cad34931 | ||
|
|
e54322e3e2 | ||
|
|
edcf555b5b | ||
|
|
e571373fbb | ||
|
|
8e002107b5 | ||
|
|
1eba8e0f7c | ||
|
|
d17f455ae1 | ||
|
|
94970885cf | ||
|
|
3b88a140cc | ||
|
|
c730eec9f9 | ||
|
|
1aea88d08f | ||
|
|
43eac872ed | ||
|
|
39295f9780 | ||
|
|
54ba3b4862 | ||
|
|
2087edd3e6 | ||
|
|
4222ebef83 |
No files matched your search
@@ -1,8 +1,13 @@
|
|||||||
package com.example.ueberwachungssystem.Detection;
|
package com.example.ueberwachungssystem.Detection;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.example.ueberwachungssystem.WifiCommunication;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/** Detection Report Class */
|
/** Detection Report Class */
|
||||||
public class DetectionReport {
|
public class DetectionReport {
|
||||||
@@ -12,7 +17,11 @@ public class DetectionReport {
|
|||||||
public boolean detectionState;
|
public boolean detectionState;
|
||||||
|
|
||||||
public DetectionReport(boolean detectionState, String detectionType, float detectedAmplitude) {
|
public DetectionReport(boolean detectionState, String detectionType, float detectedAmplitude) {
|
||||||
this.timeStamp = String.valueOf(Calendar.getInstance().getTime());
|
// New Date Format
|
||||||
|
@SuppressLint("SimpleDateFormat") SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
|
||||||
|
Date curDate = new Date(System.currentTimeMillis());
|
||||||
|
this.timeStamp = formatter.format(curDate);
|
||||||
|
//Old Date Format: this.timeStamp = String.valueOf(Calendar.getInstance().getTime());
|
||||||
this.detectionType = detectionType;
|
this.detectionType = detectionType;
|
||||||
this.detectedValue = detectedAmplitude;
|
this.detectedValue = detectedAmplitude;
|
||||||
this.detectionState = detectionState;
|
this.detectionState = detectionState;
|
||||||
@@ -31,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());
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.os.Binder;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -22,45 +21,87 @@ public class DetectorService extends LifecycleService {
|
|||||||
private DetectorService.OnDetectionListener listener;
|
private DetectorService.OnDetectionListener listener;
|
||||||
private boolean isServiceRunning = false;
|
private boolean isServiceRunning = false;
|
||||||
|
|
||||||
VideoDetector videoDetector = null;
|
// Used Objects:
|
||||||
AudioRecorder audioRecorder = null;
|
public VideoDetector videoDetector = null;
|
||||||
|
public AudioRecorder audioRecorder = null;
|
||||||
|
public Accelerometer motionDetector = null;
|
||||||
|
public MicrophoneDetector audioDetector = null;
|
||||||
|
|
||||||
/** Communication **/
|
public WifiCommunication wifiCommunication;
|
||||||
|
|
||||||
WifiCommunication wifiCommunication;
|
String wifiData;
|
||||||
|
StringBuffer stringBufferWifi = new StringBuffer();
|
||||||
|
|
||||||
|
String typOfAlarm;
|
||||||
|
|
||||||
StringBuffer dataFromWifi;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
if (isServiceRunning)
|
if (isServiceRunning)
|
||||||
return START_NOT_STICKY;
|
return START_NOT_STICKY;
|
||||||
|
|
||||||
|
/** Wifi Instanz **/
|
||||||
|
wifiCommunication = new WifiCommunication(1234);
|
||||||
|
wifiCommunication.sendTrue("TEst");
|
||||||
|
|
||||||
// Setup Service classes:
|
wifiCommunication.setOnConnectionListener(new WifiCommunication.OnConnectionListener() {
|
||||||
|
@Override
|
||||||
|
public void onConnection(String data) {
|
||||||
|
Log.d("Listener", data);
|
||||||
|
wifiData = data;
|
||||||
|
stringToStringbuffer(data);
|
||||||
|
Log.d("buffer",stringBufferWifi.toString());
|
||||||
|
passToServiceListener(stringBufferWifi);
|
||||||
|
checkState(data);
|
||||||
|
checkTyp(data);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Video Detection/Recorder **/
|
||||||
videoDetector = new VideoDetector(this);
|
videoDetector = new VideoDetector(this);
|
||||||
videoDetector.setOnDetectionListener(new Detector.OnDetectionListener() {
|
videoDetector.setOnDetectionListener(new Detector.OnDetectionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onDetection(@NonNull DetectionReport detectionReport) {
|
public void onDetection(@NonNull DetectionReport detectionReport) {
|
||||||
passToServiceListener(detectionReport);
|
//passToServiceListener(detectionReport);
|
||||||
|
wifiCommunication.sendTrue(detectionReport.toMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
/** Motion Detection**/
|
||||||
|
motionDetector = new Accelerometer(this);
|
||||||
|
motionDetector.getSensor();
|
||||||
|
motionDetector.setOnDetectionListener(new Detector.OnDetectionListener() {
|
||||||
|
@Override
|
||||||
|
public void onDetection(@NonNull DetectionReport detectionReport) {
|
||||||
|
//passToServiceListener(detectionReport);
|
||||||
|
wifiCommunication.sendTrue(detectionReport.toMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/** Audio Detection **/
|
||||||
|
audioDetector = new MicrophoneDetector(this);
|
||||||
|
audioDetector.setOnDetectionListener(new Detector.OnDetectionListener() {
|
||||||
|
@Override
|
||||||
|
public void onDetection(@NonNull DetectionReport detectionReport) {
|
||||||
|
//passToServiceListener(detectionReport);
|
||||||
|
wifiCommunication.sendTrue(detectionReport.toMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/** Audio Recorder**/
|
||||||
audioRecorder = new AudioRecorder(this);
|
audioRecorder = new AudioRecorder(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
isServiceRunning = true;
|
|
||||||
|
|
||||||
wifiCommunication = new WifiCommunication (1234);
|
|
||||||
wifiCommunication.setOnConnectionListener(new WifiCommunication.OnConnectionListener() {
|
|
||||||
@Override
|
isServiceRunning = true;
|
||||||
public void onConnection(StringBuffer data) {
|
|
||||||
dataFromWifi = data;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return super.onStartCommand(intent, flags, startId);
|
return super.onStartCommand(intent, flags, startId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@@ -82,93 +123,45 @@ public class DetectorService extends LifecycleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Video Detection */
|
/** Pass Detection Report to Service Detection Listener and trigger it */
|
||||||
public void startVideoDetection() {
|
public void passToServiceListener(StringBuffer stringBuffer) {
|
||||||
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() {
|
|
||||||
|
|
||||||
}
|
|
||||||
public void stopAudioDetection() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Motion Detection */
|
|
||||||
public void startMotionDetection() {
|
|
||||||
|
|
||||||
}
|
|
||||||
public void stopMotionDetection() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 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 */
|
|
||||||
public void passToServiceListener(DetectionReport detectionReport) {
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onDetection(detectionReport);
|
listener.onDetection(stringBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** On Detection Listener - runs when violation is reported */
|
/** On Detection Listener - runs when violation is reported */
|
||||||
public interface OnDetectionListener {
|
public interface OnDetectionListener {
|
||||||
void onDetection(@NonNull DetectionReport detectionReport);
|
void onDetection(@NonNull StringBuffer stringBuffer);
|
||||||
}
|
}
|
||||||
public void setOnDetectionListener(@NonNull DetectorService.OnDetectionListener listener) {
|
public void setOnDetectionListener(@NonNull DetectorService.OnDetectionListener listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stringToStringbuffer(String string){
|
||||||
|
if(string != null) {
|
||||||
|
stringBufferWifi.insert(0,string + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] splitString(String string){
|
||||||
|
String[] splitrxString = string.split(",");
|
||||||
|
return splitrxString; //splitrxString[0] = "1",splitrxString[1] = "HH:MM:SS", splitrxString[0].equals("1")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean checkState(String string){
|
||||||
|
Log.d("state", String.valueOf(splitString(string)[4].equals("An")));
|
||||||
|
return splitString(string)[4].equals("An");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String checkTyp(String string){
|
||||||
|
if (splitString(string)[5] != null) {
|
||||||
|
typOfAlarm = splitString(string)[5];
|
||||||
|
Log.d("Type", typOfAlarm);
|
||||||
|
}
|
||||||
|
return typOfAlarm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+13
-30
@@ -2,24 +2,16 @@ package com.example.ueberwachungssystem.Detection;
|
|||||||
|
|
||||||
import static java.lang.Math.*;
|
import static java.lang.Math.*;
|
||||||
|
|
||||||
import android.Manifest;
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.media.AudioFormat;
|
import android.media.AudioFormat;
|
||||||
import android.media.AudioRecord;
|
import android.media.AudioRecord;
|
||||||
import android.media.MediaRecorder;
|
import android.media.MediaRecorder;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.core.app.ActivityCompat;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
|
|
||||||
import com.example.ueberwachungssystem.Detection.Signalverarbeitung.Complex;
|
import com.example.ueberwachungssystem.Detection.Signalverarbeitung.Complex;
|
||||||
import com.example.ueberwachungssystem.Detection.Signalverarbeitung.FFT;
|
import com.example.ueberwachungssystem.Detection.Signalverarbeitung.FFT;
|
||||||
import com.example.ueberwachungssystem.Detection.DetectionReport;
|
|
||||||
import com.example.ueberwachungssystem.Detection.Detector;
|
|
||||||
|
|
||||||
public class MicrophoneDetector extends Detector {
|
public class MicrophoneDetector extends Detector {
|
||||||
/**
|
/**
|
||||||
@@ -28,11 +20,9 @@ public class MicrophoneDetector extends Detector {
|
|||||||
* @param context
|
* @param context
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static final int RECHTEANFORDERUNG_MIKROFON = 1;
|
|
||||||
|
|
||||||
private AufnahmeTask aufnahmeTask;
|
private AufnahmeTask aufnahmeTask;
|
||||||
public boolean armed = false;
|
public boolean armed = false;
|
||||||
public int Schwellwert_Alarm = 100;
|
public int schwellwertAlarm = 100;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
public MicrophoneDetector(Context context) {
|
public MicrophoneDetector(Context context) {
|
||||||
@@ -58,12 +48,17 @@ public class MicrophoneDetector extends Detector {
|
|||||||
private final int sampleRateInHz = 44100;
|
private final int sampleRateInHz = 44100;
|
||||||
private final int channelConfig = AudioFormat.CHANNEL_IN_MONO;
|
private final int channelConfig = AudioFormat.CHANNEL_IN_MONO;
|
||||||
private final int audioFormat = AudioFormat.ENCODING_PCM_16BIT;
|
private final int audioFormat = AudioFormat.ENCODING_PCM_16BIT;
|
||||||
|
|
||||||
|
private final int startDelay = 20000;
|
||||||
|
private final int threadSleeptime = 10;
|
||||||
private int minPufferGroesseInBytes;
|
private int minPufferGroesseInBytes;
|
||||||
private int pufferGroesseInBytes;
|
private int pufferGroesseInBytes;
|
||||||
private RingPuffer ringPuffer = new RingPuffer(10);
|
private RingPuffer ringPuffer = new RingPuffer(10);
|
||||||
private float kalibierWert;
|
private float kalibierWert;
|
||||||
private com.example.ueberwachungssystem.Detection.DetectionReport detectionReport;
|
private com.example.ueberwachungssystem.Detection.DetectionReport detectionReport;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
AufnahmeTask() {
|
AufnahmeTask() {
|
||||||
minPufferGroesseInBytes = AudioRecord.getMinBufferSize(sampleRateInHz, channelConfig, audioFormat);
|
minPufferGroesseInBytes = AudioRecord.getMinBufferSize(sampleRateInHz, channelConfig, audioFormat);
|
||||||
@@ -112,8 +107,6 @@ public class MicrophoneDetector extends Detector {
|
|||||||
|
|
||||||
Log.d("0","Konfiguration: "+ s);
|
Log.d("0","Konfiguration: "+ s);
|
||||||
|
|
||||||
int pufferGroesseInAnzahlAbtastwerten = pufferGroesseInBytes / anzahlBytesProAbtastwert;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -129,7 +122,7 @@ public class MicrophoneDetector extends Detector {
|
|||||||
|
|
||||||
//Kalibrierung
|
//Kalibrierung
|
||||||
try {
|
try {
|
||||||
Thread.sleep(3000); // Time to lay down the phone
|
Thread.sleep(startDelay); // Time to lay down the phone
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -139,7 +132,7 @@ public class MicrophoneDetector extends Detector {
|
|||||||
Verarbeitungsergebnis kalibrierErgebnis = verarbeiten(puffer, n);
|
Verarbeitungsergebnis kalibrierErgebnis = verarbeiten(puffer, n);
|
||||||
kalibierWert += kalibrierErgebnis.maxAmp;
|
kalibierWert += kalibrierErgebnis.maxAmp;
|
||||||
try {
|
try {
|
||||||
Thread.sleep(50);
|
Thread.sleep(threadSleeptime);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -193,7 +186,7 @@ public class MicrophoneDetector extends Detector {
|
|||||||
publishProgress(ergebnis);
|
publishProgress(ergebnis);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(10);
|
Thread.sleep(threadSleeptime);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -221,7 +214,7 @@ public class MicrophoneDetector extends Detector {
|
|||||||
|
|
||||||
ringPuffer.hinzufuegen(max);
|
ringPuffer.hinzufuegen(max);
|
||||||
maxAmp = ringPuffer.maximum();
|
maxAmp = ringPuffer.maximum();
|
||||||
if (maxAmp <= Schwellwert_Alarm+kalibierWert) {
|
if (maxAmp <= schwellwertAlarm + kalibierWert) {
|
||||||
armed = true;
|
armed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,10 +227,10 @@ public class MicrophoneDetector extends Detector {
|
|||||||
super.onProgressUpdate(progress);
|
super.onProgressUpdate(progress);
|
||||||
float maxAmpPrint = round(20*log10(abs(progress[0].maxAmp/1.0)));
|
float maxAmpPrint = round(20*log10(abs(progress[0].maxAmp/1.0)));
|
||||||
float kalibierWertPrint = round(20*log10(abs(kalibierWert)));
|
float kalibierWertPrint = round(20*log10(abs(kalibierWert)));
|
||||||
Log.d("0","VR, Max, Kal:" + progress[0].verarbeitungsrate + ", " + maxAmpPrint
|
Log.d("alarmAudio","VR: " + progress[0].verarbeitungsrate + ", Amp: " + maxAmpPrint
|
||||||
+ " dB, " + kalibierWertPrint + " dB");
|
+ " dB, Kal: " + kalibierWertPrint + " dB");
|
||||||
|
|
||||||
if (progress[0].maxAmp >= Schwellwert_Alarm+kalibierWert && armed == true) {
|
if (progress[0].maxAmp >= schwellwertAlarm + kalibierWert && armed == true) {
|
||||||
armed = false;
|
armed = false;
|
||||||
detectionReport = new DetectionReport(true, "Audio", maxAmpPrint);
|
detectionReport = new DetectionReport(true, "Audio", maxAmpPrint);
|
||||||
reportViolation("Audio", maxAmpPrint);
|
reportViolation("Audio", maxAmpPrint);
|
||||||
@@ -359,16 +352,6 @@ public class MicrophoneDetector extends Detector {
|
|||||||
this.wichtungAlterWert = 1 - this.wichtungNeuerWert;
|
this.wichtungAlterWert = 1 - this.wichtungNeuerWert;
|
||||||
}
|
}
|
||||||
|
|
||||||
float MittelwertPuffer(short[] puffer) {
|
|
||||||
|
|
||||||
for (int i = 0; i < puffer.length; i++) {
|
|
||||||
mittelwert = Math.abs(puffer[i]);
|
|
||||||
}
|
|
||||||
mittelwert = mittelwert/puffer.length;
|
|
||||||
|
|
||||||
return mittelwert;
|
|
||||||
}
|
|
||||||
|
|
||||||
float mittel(float wert) {
|
float mittel(float wert) {
|
||||||
if (istMittelwertGesetzt) {
|
if (istMittelwertGesetzt) {
|
||||||
mittelwert = wert * wichtungNeuerWert + mittelwert * wichtungAlterWert;
|
mittelwert = wert * wichtungNeuerWert + mittelwert * wichtungAlterWert;
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ import java.util.concurrent.ExecutionException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Video Detector inherits some methods from abstract Detector class (more info there)
|
* Video Detector inherits some methods from abstract Detector class (more info there)
|
||||||
* USE FROM MAIN ACTIVITY:
|
|
||||||
* VideoDetector vd = new VideoDetector(this);
|
|
||||||
* */
|
* */
|
||||||
|
|
||||||
|
|
||||||
@@ -175,7 +173,10 @@ public class VideoDetector extends Detector {
|
|||||||
public void stopDetection() {
|
public void stopDetection() {
|
||||||
if (!isDetecting || imageAnalysis == null)
|
if (!isDetecting || imageAnalysis == null)
|
||||||
return;
|
return;
|
||||||
cameraProvider.unbind(imageAnalysis);
|
if (!isRecording)
|
||||||
|
cameraProvider.unbindAll();
|
||||||
|
else
|
||||||
|
cameraProvider.unbind(imageAnalysis);
|
||||||
isDetecting = false;
|
isDetecting = false;
|
||||||
allowReportViolation = false;
|
allowReportViolation = false;
|
||||||
}
|
}
|
||||||
@@ -187,7 +188,11 @@ public class VideoDetector extends Detector {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
videoCapture.stopRecording();
|
videoCapture.stopRecording();
|
||||||
cameraProvider.unbind(videoCapture);
|
|
||||||
|
if (!isDetecting())
|
||||||
|
cameraProvider.unbindAll();
|
||||||
|
else
|
||||||
|
cameraProvider.unbind(videoCapture);
|
||||||
isRecording = false;
|
isRecording = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,10 +224,10 @@ public class VideoDetector extends Detector {
|
|||||||
|
|
||||||
int n = OpenCVHelper.countNonZeroPixels(processed);
|
int n = OpenCVHelper.countNonZeroPixels(processed);
|
||||||
int pixelCount = image.getWidth() * image.getHeight();
|
int pixelCount = image.getWidth() * image.getHeight();
|
||||||
float percentChanged = (float) n / pixelCount;
|
float percentChanged = ((float) n / pixelCount) * 100;
|
||||||
|
|
||||||
// Violation Condition
|
// Violation Condition
|
||||||
if (percentChanged * 100 > ALARM_THRESHOLD) {
|
if (percentChanged> ALARM_THRESHOLD) {
|
||||||
if (allowReportViolation)
|
if (allowReportViolation)
|
||||||
reportViolation("Video", percentChanged);
|
reportViolation("Video", percentChanged);
|
||||||
}
|
}
|
||||||
@@ -310,7 +315,7 @@ public class VideoDetector extends Detector {
|
|||||||
|
|
||||||
/** Start delay until Violation Report is allowed */
|
/** Start delay until Violation Report is allowed */
|
||||||
private void startViolationTimer(float setupTime) {
|
private void startViolationTimer(float setupTime) {
|
||||||
new CountDownTimer((long) (START_DELAY), 100) {
|
new CountDownTimer((long) (setupTime), 100) {
|
||||||
@Override
|
@Override
|
||||||
public void onTick(long millisUntilFinished) {
|
public void onTick(long millisUntilFinished) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,126 +1,151 @@
|
|||||||
package com.example.ueberwachungssystem;
|
package com.example.ueberwachungssystem;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.camera.core.ExperimentalGetImage;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.camera.core.ExperimentalGetImage;
|
||||||
|
import androidx.camera.view.PreviewView;
|
||||||
|
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.ServiceConnection;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.IBinder;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.widget.ImageView;
|
||||||
import android.widget.Button;
|
import android.widget.Toast;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ScrollView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.ToggleButton;
|
import android.widget.ToggleButton;
|
||||||
|
|
||||||
|
import com.example.ueberwachungssystem.Detection.Accelerometer;
|
||||||
|
import com.example.ueberwachungssystem.Detection.AudioRecorder;
|
||||||
import com.example.ueberwachungssystem.Detection.DetectionReport;
|
import com.example.ueberwachungssystem.Detection.DetectionReport;
|
||||||
import com.example.ueberwachungssystem.Detection.Detector;
|
import com.example.ueberwachungssystem.Detection.Detector;
|
||||||
|
import com.example.ueberwachungssystem.Detection.DetectorService;
|
||||||
|
import com.example.ueberwachungssystem.Detection.MicrophoneDetector;
|
||||||
import com.example.ueberwachungssystem.Detection.VideoDetector;
|
import com.example.ueberwachungssystem.Detection.VideoDetector;
|
||||||
import com.example.ueberwachungssystem.Fragments.Fragment1;
|
|
||||||
import com.example.ueberwachungssystem.Fragments.Fragment2;
|
|
||||||
import com.example.ueberwachungssystem.Fragments.Fragment3;
|
|
||||||
|
|
||||||
import org.w3c.dom.Text;
|
|
||||||
|
|
||||||
@ExperimentalGetImage
|
@ExperimentalGetImage
|
||||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
|
public class MainActivity extends AppCompatActivity {
|
||||||
private Fragment aktuellesFragment;
|
|
||||||
private Fragment1 fragment1;
|
|
||||||
private Fragment2 fragment2;
|
|
||||||
private Fragment3 fragment3;
|
|
||||||
|
|
||||||
WifiCommunication communication;
|
private DetectorService detectorService = new DetectorService();
|
||||||
private TextView alarm;
|
ImageView inputImageView;
|
||||||
private String text = "Das ist ein Alarm des Sensors";
|
ImageView outputImageView;
|
||||||
//Buttons
|
ToggleButton toggleButton;
|
||||||
private ToggleButton toggleKamera;
|
int num=0;
|
||||||
private ToggleButton btnAudio;
|
|
||||||
private ToggleButton btnBewegung;
|
|
||||||
//Detektoren
|
|
||||||
VideoDetector vd = new VideoDetector(this);
|
|
||||||
private void log(String nachricht) {
|
|
||||||
Log.d(this.getClass().getSimpleName(), nachricht);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setTitle(this.getClass().getSimpleName());
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
alarm = findViewById(R.id.Alarm);
|
|
||||||
alarm.setText(text);
|
|
||||||
toggleKamera = findViewById(R.id.toggleKamera);
|
|
||||||
toggleKamera.setOnClickListener(this);
|
|
||||||
vd.setOnDetectionListener(new Detector.OnDetectionListener() {
|
|
||||||
@Override
|
|
||||||
public void onDetection(@NonNull DetectionReport detectionReport) {
|
|
||||||
DetectionReport dr = detectionReport;
|
|
||||||
String drString = dr.toString();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//boolean isRunning = vd.isRunning();
|
inputImageView = findViewById(R.id.inputImageView);
|
||||||
|
outputImageView = findViewById(R.id.outputImageView);
|
||||||
|
toggleButton = findViewById(R.id.toggleButton);
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (v == toggleKamera) {
|
|
||||||
if (toggleKamera.isChecked()) {
|
|
||||||
vd.startDetection();
|
|
||||||
} else {
|
|
||||||
vd.stopDetection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
communication.stopCommunication();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
communication = new WifiCommunication(MainActivity.this, 1234);
|
|
||||||
|
PermissionHandler permissionHandler = new PermissionHandler(this);
|
||||||
|
//permissionHandler.getPermissions();
|
||||||
|
if (permissionHandler.hasPermissions()) {
|
||||||
|
|
||||||
|
Intent serviceIntent = new Intent(this, DetectorService.class);
|
||||||
|
bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE);
|
||||||
|
startService(serviceIntent);
|
||||||
|
|
||||||
|
toggleButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (toggleButton.isChecked())
|
||||||
|
{
|
||||||
|
if (detectorService != null){
|
||||||
|
|
||||||
|
detectorService.videoDetector.startDetection();
|
||||||
|
|
||||||
|
detectorService.audioDetector.startDetection();
|
||||||
|
|
||||||
|
detectorService.motionDetector.startDetection();
|
||||||
|
|
||||||
|
detectorService.audioRecorder.stopRecording();
|
||||||
|
|
||||||
|
detectorService.videoDetector.startRecording();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
detectorService.videoDetector.stopDetection();
|
||||||
|
|
||||||
|
detectorService.audioDetector.stopDetection();
|
||||||
|
|
||||||
|
detectorService.motionDetector.stopDetection();
|
||||||
|
|
||||||
|
detectorService.audioRecorder.stopRecording();
|
||||||
|
|
||||||
|
detectorService.videoDetector.stopRecording();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
Toast.makeText(this,"Bitte Rechte geben", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClickZeigeFragment1(View view) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
Button button = (Button) view;
|
getMenuInflater().inflate(R.menu.options_menu, menu);
|
||||||
log(button.getText() + " ausgewählt");
|
return true;
|
||||||
zeigeFragment(fragment1.erstellen("Fragment 1 wurde angeklickt"));
|
|
||||||
}
|
}
|
||||||
public void onClickZeigeFragment2(View view) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
Button button = (Button) view;
|
Toast.makeText(this, "Selected Item: " + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||||
log(button.getText() + " ausgewählt");
|
PopUpClass popUpClass;
|
||||||
zeigeFragment(fragment2.erstellen("Fragment 2 wurde angeklickt"));
|
switch (item.getItemId()) {
|
||||||
}
|
case R.id.Rechteverwaltung:
|
||||||
|
popUpClass = new PopUpClass(MainActivity.this);
|
||||||
public void onClickZeigeFragment3(View view) {
|
popUpClass.showPopupWindow(inputImageView);
|
||||||
Button button = (Button) view;
|
popUpClass.RechtePrüfen();
|
||||||
log(button.getText() + " ausgewählt");
|
return true;
|
||||||
zeigeFragment(fragment3.erstellen("Fragment 3 wurde angeklickt"));
|
case R.id.Sensoren:
|
||||||
}
|
popUpClass = new PopUpClass(MainActivity.this);
|
||||||
|
popUpClass.showPopupWindow(inputImageView);
|
||||||
public void onClickEntferneFragment(View view) {
|
popUpClass.Sensoren();
|
||||||
entferneFragment();
|
return true;
|
||||||
}
|
case R.id.Impressum:
|
||||||
private void zeigeFragment(Fragment fragment) {
|
popUpClass = new PopUpClass(MainActivity.this);
|
||||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
popUpClass.showPopupWindow(inputImageView);
|
||||||
ft.replace(R.id.frame, fragment);
|
popUpClass.Impressum();
|
||||||
ft.commit();
|
return true;
|
||||||
aktuellesFragment = fragment;
|
case R.id.Detection:
|
||||||
}
|
popUpClass = new PopUpClass(MainActivity.this);
|
||||||
private void entferneFragment() {
|
popUpClass.showPopupWindow(inputImageView);
|
||||||
if (aktuellesFragment != null) {
|
popUpClass.DetectionTotal(num);
|
||||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
return true;
|
||||||
ft.remove(aktuellesFragment);
|
default:
|
||||||
ft.commit();
|
return super.onOptionsItemSelected(item);
|
||||||
aktuellesFragment = null ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ServiceConnection serviceConnection = new ServiceConnection() {
|
||||||
|
@Override
|
||||||
|
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||||
|
DetectorService.ServiceBinder binder = (DetectorService.ServiceBinder) service;
|
||||||
|
detectorService = binder.getBoundService();
|
||||||
|
detectorService.videoDetector.debugProcessing(null, outputImageView); //inputImageView
|
||||||
|
|
||||||
|
detectorService.setOnDetectionListener(new DetectorService.OnDetectionListener() {
|
||||||
|
@Override
|
||||||
|
public void onDetection(@NonNull StringBuffer stringBuffer) {
|
||||||
|
Log.d("onDetection", stringBuffer.toString()); //Für oli hier Textview einbauen
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onServiceDisconnected(ComponentName name) {
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ public class PermissionRequest extends AppCompatActivity{
|
|||||||
handler.post(new Runnable() {
|
handler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(mainActivity.getApplicationContext(),"Es werden Rechte benötigt", Toast.LENGTH_LONG).show();
|
Toast.makeText(mainActivity.getApplicationContext(),"Es werden Rechte benötigt", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,5 +82,7 @@ public class PopUpClass {
|
|||||||
public void Impressum(){
|
public void Impressum(){
|
||||||
PopUpText.setText("Die Ueberwachungsapp wurde im Rahmen eines Praktikums der TH-Nürnberg programmiert");
|
PopUpText.setText("Die Ueberwachungsapp wurde im Rahmen eines Praktikums der TH-Nürnberg programmiert");
|
||||||
}
|
}
|
||||||
|
public void DetectionTotal(int num) {
|
||||||
|
PopUpText.setText("Total Detektions:" +num);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.example.ueberwachungssystem;
|
package com.example.ueberwachungssystem;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -30,6 +31,11 @@ public class WifiCommunication {
|
|||||||
private final DatagramSocket socket;
|
private final DatagramSocket socket;
|
||||||
volatile private boolean running;
|
volatile private boolean running;
|
||||||
|
|
||||||
|
private boolean Gruppe =true;
|
||||||
|
private boolean showMessage = true;
|
||||||
|
|
||||||
|
StringBuffer rxStringBuffer = new StringBuffer();
|
||||||
|
|
||||||
private OnConnectionListener listener;
|
private OnConnectionListener listener;
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
public WifiCommunication(int port) {
|
public WifiCommunication(int port) {
|
||||||
@@ -51,20 +57,20 @@ public class WifiCommunication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface OnConnectionListener {
|
public interface OnConnectionListener {
|
||||||
void onConnection(StringBuffer data);
|
void onConnection(String data);
|
||||||
}
|
}
|
||||||
public void setOnConnectionListener(@NonNull OnConnectionListener listener) {
|
public void setOnConnectionListener(@NonNull OnConnectionListener listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendWifiData(StringBuffer wifiMessage) {
|
public void sendWifiData(String wifiMessage) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onConnection(wifiMessage);
|
listener.onConnection(wifiMessage);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ReceiveThread extends Thread {
|
private class ReceiveThread extends Thread {
|
||||||
private StringBuffer rxStringBuffer = new StringBuffer();
|
|
||||||
private String rxString="";
|
private String rxString="";
|
||||||
private String previousRxString = "";
|
private String previousRxString = "";
|
||||||
|
|
||||||
@@ -77,11 +83,30 @@ public class WifiCommunication {
|
|||||||
socket.receive(rxPacket);
|
socket.receive(rxPacket);
|
||||||
rxString = new String(receiveData, 0, rxPacket.getLength());
|
rxString = new String(receiveData, 0, rxPacket.getLength());
|
||||||
String[] splitrxString = rxString.split(",");
|
String[] splitrxString = rxString.split(",");
|
||||||
if(!previousRxString.equals(rxString) && splitrxString[0].equals("1") && splitrxString.length==7) {
|
String[] splitrxStringBuffer = splitBufferIntoStrings(rxStringBuffer);
|
||||||
rxStringBuffer.append(rxString).append("\n");
|
for(String elem: splitrxStringBuffer){
|
||||||
sendWifiData(rxStringBuffer);
|
if(elem.equals(rxString)){
|
||||||
//mainActivity.runOnUiThread(() -> mainActivity.tvMessages.setText(rxStringBuffer));
|
showMessage = false;
|
||||||
previousRxString = rxString;
|
}else{
|
||||||
|
showMessage = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(Gruppe){
|
||||||
|
if(!previousRxString.equals(rxString) && splitrxString[0].equals("1") && splitrxString.length==7 && showMessage) {
|
||||||
|
rxStringBuffer.append(rxString).append("\n");
|
||||||
|
Log.d("empfangen", rxString);
|
||||||
|
sendWifiData(rxString);
|
||||||
|
//mainActivity.runOnUiThread(() -> mainActivity.tvMessages.setText(rxStringBuffer));
|
||||||
|
previousRxString = rxString;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(!previousRxString.equals(rxString) && splitrxString[0].equals("1") && splitrxString.length==7 && showMessage) {
|
||||||
|
rxStringBuffer.append(rxString).append("\n");
|
||||||
|
Log.d("empfangen", rxString);
|
||||||
|
sendWifiData(rxString);
|
||||||
|
//mainActivity.runOnUiThread(() -> mainActivity.tvMessages.setText(rxStringBuffer));
|
||||||
|
previousRxString = rxString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (running);
|
} while (running);
|
||||||
}
|
}
|
||||||
@@ -99,16 +124,17 @@ public class WifiCommunication {
|
|||||||
if(send)
|
if(send)
|
||||||
{
|
{
|
||||||
send = false;
|
send = false;
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
|
/*SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
|
||||||
Date curDate = new Date(System.currentTimeMillis());
|
Date curDate = new Date(System.currentTimeMillis());
|
||||||
String str = formatter.format(curDate);
|
String str = formatter.format(curDate);*/
|
||||||
byte[] send_Data = new byte[512];
|
byte[] send_Data = new byte[512];
|
||||||
String txString = ("1," +str+ ",Gruppe2," + getLocalIpAddress() + ",An,Video," +messageToSend);
|
String txString = (messageToSend); //"1," +str+ ",Gruppe2," + getLocalIpAddress() + ",An,Video,"
|
||||||
|
Log.d("send", txString);
|
||||||
send_Data = txString.getBytes();
|
send_Data = txString.getBytes();
|
||||||
|
|
||||||
DatagramPacket txPacket = new DatagramPacket(send_Data, txString.length(), address, port);
|
DatagramPacket txPacket = new DatagramPacket(send_Data, txString.length(), address, port);
|
||||||
|
|
||||||
for(int i = 0; i < 300; i++) {
|
for(int i = 0; i < 500; i++) {
|
||||||
socket.send(txPacket);
|
socket.send(txPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,4 +169,8 @@ public class WifiCommunication {
|
|||||||
running = false;
|
running = false;
|
||||||
socket.close();
|
socket.close();
|
||||||
}
|
}
|
||||||
|
public String[] splitBufferIntoStrings(StringBuffer string){
|
||||||
|
String[] splitrxString2 = string.toString().split("\n");
|
||||||
|
return splitrxString2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,123 +1,41 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/holo_green_dark"
|
android:layout_gravity="center"
|
||||||
android:visibility="visible"
|
android:gravity="top"
|
||||||
tools:context="com.example.ueberwachungssystem.MainActivity"
|
android:orientation="vertical"
|
||||||
tools:visibility="visible">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<ToggleButton
|
|
||||||
android:id="@+id/toggleKamera"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignBottom="@id/toggleAudio"
|
|
||||||
android:layout_marginRight="15dp"
|
|
||||||
android:layout_toStartOf="@+id/toggleAudio"
|
|
||||||
android:layout_toLeftOf="@id/toggleAudio"
|
|
||||||
android:text="Kamera" />
|
|
||||||
|
|
||||||
<ToggleButton
|
<androidx.camera.view.PreviewView
|
||||||
android:id="@+id/toggleAudio"
|
android:id="@+id/previewView"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:text="Audio" />
|
|
||||||
|
|
||||||
<ToggleButton
|
|
||||||
android:id="@+id/toggleBewegung"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignBottom="@id/toggleAudio"
|
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:layout_toEndOf="@+id/toggleAudio"
|
|
||||||
android:layout_toRightOf="@id/toggleAudio"
|
|
||||||
android:text="Bewegung" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnAudio"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignBottom="@id/btnKamera"
|
|
||||||
android:layout_marginRight="15dp"
|
|
||||||
android:layout_toStartOf="@+id/btnKamera"
|
|
||||||
android:onClick="onClickZeigeFragment1"
|
|
||||||
android:text="Audio" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnKamera"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/toggleAudio"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:onClick="onClickZeigeFragment2"
|
|
||||||
android:text="Kamera" />
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnSensorWeg"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_below="@+id/btn1"
|
|
||||||
android:text="Entferne Sensordarstellung"
|
|
||||||
android:onClick="onClickEntferneFragment"/>
|
|
||||||
-->
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnBewegung"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignBottom="@id/btnKamera"
|
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:layout_toEndOf="@+id/btnKamera"
|
|
||||||
android:layout_toRightOf="@id/btnKamera"
|
|
||||||
android:onClick="onClickZeigeFragment3"
|
|
||||||
android:text="Bewegung" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnAufnahme"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/btnKamera"
|
|
||||||
android:layout_toLeftOf="@id/btnKamera"
|
|
||||||
android:layout_marginRight="15dp"
|
|
||||||
android:onClick="onClickEntferneFragment"
|
|
||||||
android:text="Aufnahme" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnWiedergabe"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/btnKamera"
|
|
||||||
android:layout_toRightOf="@id/btnKamera"
|
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:onClick="onClickEntferneFragment"
|
|
||||||
android:text="Wiedergabe" />
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/frame"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="200dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/btnAufnahme"
|
android:backgroundTint="@android:color/black"/>
|
||||||
android:layout_alignParentStart="true">
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<ScrollView
|
<ToggleButton
|
||||||
android:id= "@+id/scrollView1"
|
android:id="@+id/toggleButton"
|
||||||
android:layout_width= "wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height= "wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below= "@id/frame">
|
android:text="ToggleButton" />
|
||||||
<LinearLayout
|
|
||||||
android:layout_width= "match_parent"
|
|
||||||
android:layout_height= "match_parent"
|
|
||||||
android:orientation= "vertical" >
|
|
||||||
<TextView
|
|
||||||
android:id= "@+id/Alarm"
|
|
||||||
android:layout_width= "wrap_content"
|
|
||||||
android:layout_height= "wrap_content" />
|
|
||||||
</LinearLayout>
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
<ImageView
|
||||||
|
android:id="@+id/inputImageView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:srcCompat="@tools:sample/avatars" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/outputImageView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:srcCompat="@tools:sample/avatars" />
|
||||||
|
|
||||||
|
<androidx.camera.view.PreviewView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
android:title="Rechteverwaltung" />
|
android:title="Rechteverwaltung" />
|
||||||
<item android:id="@+id/Sensoren"
|
<item android:id="@+id/Sensoren"
|
||||||
android:title="Sensoren" />
|
android:title="Sensoren" />
|
||||||
|
<item android:id="@+id/Detection"
|
||||||
|
android:title="Detektionen" />
|
||||||
<item android:id="@+id/Impressum"
|
<item android:id="@+id/Impressum"
|
||||||
android:title="Impressum" />
|
android:title="Impressum" />
|
||||||
</menu>
|
</menu>
|
||||||
Reference in new issue
Block a user