123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package com.example.ueberwachungssystem.Detection;
-
- import android.annotation.SuppressLint;
- import android.util.Log;
-
- import java.text.SimpleDateFormat;
- import java.util.Calendar;
- import java.util.Date;
-
- /** Detection Report Class */
- public class DetectionReport {
- public String timeStamp;
- public String detectionType;
- public float detectedValue;
- public boolean detectionState;
-
- public DetectionReport(boolean detectionState, String detectionType, float detectedAmplitude) {
- // 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.detectedValue = detectedAmplitude;
- this.detectionState = detectionState;
-
- //this.detectorID = detectorID;
- }
-
-
- /** Get Detection Report in String format */
- public String toString() {
- String state = "State: " + "[" + this.detectionState + "]";
- String time = "Time: " + "[" + this.timeStamp + "]";
- String type = "Type: " + "[" + this.detectionType + "]";
- String value = "Value: " + "[" + this.detectedValue + "]";
-
- return String.join("\t", state, time, type, value);
- }
-
- /** Debug Report */
- public void log(String tag) {
- Log.d(tag, this.toString());
- }
- }
|