Gruppe 1
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DetectionReport.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.example.ueberwachungssystem.Detection;
  2. import android.annotation.SuppressLint;
  3. import android.util.Log;
  4. import java.text.SimpleDateFormat;
  5. import java.util.Calendar;
  6. import java.util.Date;
  7. /** Detection Report Class */
  8. public class DetectionReport {
  9. public String timeStamp;
  10. public String detectionType;
  11. public float detectedValue;
  12. public boolean detectionState;
  13. public DetectionReport(boolean detectionState, String detectionType, float detectedAmplitude) {
  14. // New Date Format
  15. @SuppressLint("SimpleDateFormat") SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
  16. Date curDate = new Date(System.currentTimeMillis());
  17. this.timeStamp = formatter.format(curDate);
  18. //Old Date Format: this.timeStamp = String.valueOf(Calendar.getInstance().getTime());
  19. this.detectionType = detectionType;
  20. this.detectedValue = detectedAmplitude;
  21. this.detectionState = detectionState;
  22. //this.detectorID = detectorID;
  23. }
  24. /** Get Detection Report in String format */
  25. public String toString() {
  26. String state = "State: " + "[" + this.detectionState + "]";
  27. String time = "Time: " + "[" + this.timeStamp + "]";
  28. String type = "Type: " + "[" + this.detectionType + "]";
  29. String value = "Value: " + "[" + this.detectedValue + "]";
  30. return String.join("\t", state, time, type, value);
  31. }
  32. /** Debug Report */
  33. public void log(String tag) {
  34. Log.d(tag, this.toString());
  35. }
  36. }