Added toMessage() to DetectionReport
This commit is contained in:
parent
3b88a140cc
commit
d17f455ae1
@ -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());
|
||||||
|
@ -104,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());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user