Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
559a95b1c2 | ||
|
|
9f253b655c | ||
|
|
d38e05a4b6 | ||
|
|
595d97ef57 | ||
|
|
1c360e8604 | ||
|
|
bd2927ed64 | ||
|
|
30f9c6c3f4 | ||
|
|
9e3652e275 |
No files matched your search
@@ -10,7 +10,22 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.GreenWatch">
|
||||
<activity
|
||||
android:name=".Beschleunigungssensor"
|
||||
android:name=".ConnectionActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".VideodetectionAndAccelerometerActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".AudiodetectionAndAccelerometerActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".VideodetectionActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".AudiodetectionActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".AccelerometerActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.greenwatch;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
public class AccelerometerActivity extends AppCompatActivity {
|
||||
|
||||
private Button backToMainActivityButton;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_accelerometer);
|
||||
|
||||
backToMainActivityButton = (Button) findViewById(R.id.accelerometerBackToMainActivity);
|
||||
|
||||
backToMainActivityButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.example.greenwatch;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
public class AudiodetectionActivity extends AppCompatActivity {
|
||||
|
||||
private Button backToMainActivityButton;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_audiodetection);
|
||||
|
||||
backToMainActivityButton = (Button) findViewById(R.id.audiodetectorBackToMainActivity);
|
||||
|
||||
backToMainActivityButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.example.greenwatch;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
public class AudiodetectionAndAccelerometerActivity extends AppCompatActivity {
|
||||
|
||||
private Button backToMainActivity;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_audiodetection_and_accelerometer);
|
||||
|
||||
backToMainActivity = (Button) findViewById(R.id.audiodetectionAndAccelerometerBackToMainActivity);
|
||||
|
||||
backToMainActivity.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,188 +1,4 @@
|
||||
package com.example.greenwatch;
|
||||
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
public class Beschleunigungssensor extends AppCompatActivity implements SensorEventListener{
|
||||
|
||||
private SensorManager bsmanager;
|
||||
private ArrayList<Float> Gesamt_be;
|
||||
private int sensorType = Sensor.TYPE_GYROSCOPE, zaehler_runde =0, listen_groesse = 500, kalibrieren, Offset_shared = 0, shared_merk, mittelwertsumme_shared;
|
||||
private Sensor sens, sensor_l;
|
||||
private float x_value = 0, y_value, z_value, Vorbesetzung = 0, gesamt_runde =0;
|
||||
private double Schwellwert = 0.15, mittelwertsumme = 0.0, Offset = 0.1;
|
||||
String Daten, Warnung, Zeitstempel, Array_shared;
|
||||
private final static String KEY_kalibirieren = "KEY_KALIBRIEREN_"+Beschleunigungssensor.class.getSimpleName();
|
||||
private final static String KEY_Gesamt_be = "KEY_GESAMT_BE_"+Beschleunigungssensor.class.getSimpleName();
|
||||
private final static String KEY_Offset = "KEY_OFFSET_"+Beschleunigungssensor.class.getSimpleName();
|
||||
private final static String KEY_Mittelwertsumme = "KEY_MITTELWERTSUMME_"+Beschleunigungssensor.class.getSimpleName();
|
||||
TextView Daten_Bsensor, Warnung_Bsensor, test;
|
||||
private boolean toggle = true, ts_setzen = true, start_messen;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_beschleunigungssensor);
|
||||
|
||||
Daten_Bsensor = (TextView) findViewById(R.id.DatenBsensor);
|
||||
Warnung_Bsensor = (TextView) findViewById(R.id.WarnungBsensor);
|
||||
test = (TextView) findViewById(R.id.test);
|
||||
|
||||
bsmanager = (SensorManager) getSystemService(SENSOR_SERVICE);
|
||||
if (bsmanager.getSensorList(Sensor.TYPE_GYROSCOPE).size() == 0) {
|
||||
sens = null;
|
||||
Daten = "kein B Sensor voranden";
|
||||
} else {
|
||||
sens = bsmanager.getSensorList(sensorType).get(0);
|
||||
}
|
||||
Gesamt_be = new ArrayList<Float>();
|
||||
for (int i = 0; i < listen_groesse ; i++){
|
||||
Gesamt_be.add(Vorbesetzung);
|
||||
}
|
||||
kalibrieren = 0;
|
||||
start_messen = false;
|
||||
}
|
||||
|
||||
public static String getTimestamp(){
|
||||
Long tslong = System.currentTimeMillis();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||
Date date = new Date(tslong);
|
||||
String result = sdf.format(date);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("x=").append(event.values[0])//.append(event.timestamp)
|
||||
.append("\ny=").append(event.values[1])
|
||||
.append("\nz=").append(event.values[2]);
|
||||
Daten = sb.toString();
|
||||
Daten_Bsensor.setText(Daten);
|
||||
gesamt_runde = event.values[0] + event.values[1] + event.values[2];
|
||||
Gesamt_be.remove(zaehler_runde);
|
||||
Gesamt_be.add(zaehler_runde, gesamt_runde);
|
||||
mittelwertsumme = 0.0;
|
||||
|
||||
//Mittelwert des Arrays berechnen
|
||||
for (int i = 0; i < listen_groesse; i++){
|
||||
if (Gesamt_be.get(i) < 0){
|
||||
mittelwertsumme += (Gesamt_be.get(i) * (-1));
|
||||
}else {
|
||||
mittelwertsumme += Gesamt_be.get(i);
|
||||
}
|
||||
}
|
||||
mittelwertsumme = mittelwertsumme/listen_groesse;
|
||||
if (kalibrieren < listen_groesse){
|
||||
Offset = mittelwertsumme;
|
||||
kalibrieren++;
|
||||
}else {
|
||||
start_messen = true;
|
||||
}
|
||||
StringBuilder testsb = new StringBuilder();
|
||||
testsb.append(mittelwertsumme);
|
||||
String tests = testsb.toString();
|
||||
test.setText(tests);
|
||||
|
||||
if((mittelwertsumme > (Schwellwert+Offset) ) & (ts_setzen == true) &(start_messen == true)){
|
||||
Zeitstempel = getTimestamp();
|
||||
StringBuilder ts = new StringBuilder();
|
||||
ts.append(Zeitstempel)
|
||||
.append(", Gruppe3")
|
||||
.append(", An")
|
||||
.append(", Bewegung, ")
|
||||
.append(mittelwertsumme);
|
||||
Warnung = ts.toString();
|
||||
Warnung_Bsensor.setText(Warnung);
|
||||
ts_setzen = false;
|
||||
}else if((mittelwertsumme > (Schwellwert+Offset)) & (ts_setzen == false)){
|
||||
} else if ((mittelwertsumme < (Schwellwert+Offset)) & (ts_setzen == false)) {
|
||||
Warnung_Bsensor.setText("");
|
||||
ts_setzen = true;
|
||||
}
|
||||
|
||||
if (zaehler_runde < (listen_groesse -1)){
|
||||
zaehler_runde++;
|
||||
}else {
|
||||
zaehler_runde = 0;
|
||||
}
|
||||
}
|
||||
//mittelwertsumme ist kein int in diesem programm
|
||||
//shared prefenrences: bei Kippen speichern -> nochmal neu klalibrieren? -> eig ja, weil neuer Standort
|
||||
//Vorbelegung nicht nochmal neu vornehmen -> aus onCreate Funktion raus -> hilfsvariablen auch in shared preferences speichern
|
||||
@Override
|
||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (sens != null) {
|
||||
if (bsmanager.registerListener(this, sens, SensorManager.SENSOR_DELAY_GAME)) {
|
||||
Daten = "Wir haben uns beim Sensor angemeldet";
|
||||
} else {
|
||||
Daten = "Das anmelden hat nicht geklappt";
|
||||
}
|
||||
}
|
||||
//SharedPreferences p = getPreferences(Context.MODE_PRIVATE);
|
||||
//mittelwertsumme_shared = p.getInt(KEY_Mittelwertsumme, 0);
|
||||
//kalibrieren = p.getInt(KEY_kalibirieren, 0);
|
||||
//Offset_shared = p.getInt(KEY_Offset, 0 );
|
||||
//Array_shared = p.getString(KEY_Gesamt_be, "");
|
||||
|
||||
//mittelwertsumme = (double) mittelwertsumme_shared;
|
||||
//mittelwertsumme /= 1000000.0;
|
||||
|
||||
//Offset = (double) Offset_shared;
|
||||
//Offset /= 1000000.0;
|
||||
|
||||
//String zw[] = Array_shared.split(";", listen_groesse);
|
||||
|
||||
//if(shared_merk == 2){
|
||||
//for (int i=0; i<listen_groesse; i++){
|
||||
//float wert = Float.valueOf(zw[i]);
|
||||
//Gesamt_be.add(i, wert);
|
||||
//}}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause () {
|
||||
super.onPause();
|
||||
if (sens != null) {
|
||||
bsmanager.unregisterListener(this, sens);
|
||||
}
|
||||
//shared_merk = 2;
|
||||
// Offset_shared = (int) (Offset * 1000000.0);
|
||||
//mittelwertsumme_shared = (int) (mittelwertsumme * 1000000.0);
|
||||
|
||||
//StringBuilder ar = new StringBuilder();
|
||||
//for (int z=0; z < listen_groesse; z++){
|
||||
//ar.append(Gesamt_be.get(z)).append(";");
|
||||
//}
|
||||
//Array_shared = ar.toString();
|
||||
|
||||
//SharedPreferences p = getPreferences(Context.MODE_PRIVATE);
|
||||
//SharedPreferences.Editor editor = p.edit();
|
||||
//editor.putInt(KEY_Mittelwertsumme, mittelwertsumme_shared);
|
||||
//editor.putInt(KEY_kalibirieren, kalibrieren);
|
||||
//editor.putInt(KEY_Offset, Offset_shared);
|
||||
//editor.putString(KEY_Gesamt_be, Array_shared);
|
||||
//editor.commit();
|
||||
}
|
||||
}
|
||||
public class Beschleunigungssensor {
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.example.greenwatch;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
public class ConnectionActivity extends AppCompatActivity {
|
||||
|
||||
private Button backToMainActivity;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_connection);
|
||||
|
||||
backToMainActivity = (Button) findViewById(R.id.connectionBackToMainActivity);
|
||||
|
||||
backToMainActivity.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2,40 +2,91 @@ package com.example.greenwatch;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private Button Beschleunigungssensor;
|
||||
private Button audiodetectionButton;
|
||||
private Button videodetectionButton;
|
||||
private Button accelerometerButton;
|
||||
private Button audiodetectionAndAccelerometerButton;
|
||||
private Button videodetectionAndAccelerometerButton;
|
||||
private Button connectionButton;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
final Button Beschleunigungssensor = (Button) findViewById(R.id.beschleunigungssensor);
|
||||
Beschleunigungssensor.setOnClickListener(new View.OnClickListener() {
|
||||
audiodetectionButton = (Button) findViewById(R.id.audiodetectionButton);
|
||||
videodetectionButton = (Button) findViewById(R.id.videodetectionButton);
|
||||
accelerometerButton = (Button) findViewById(R.id.accelerometerButton);
|
||||
audiodetectionAndAccelerometerButton = (Button) findViewById(R.id.audiodetectionAndAccelerometerButton);
|
||||
videodetectionAndAccelerometerButton = (Button) findViewById(R.id.videodetectionAndAccelerometerButton);
|
||||
connectionButton = (Button) findViewById(R.id.connectionButton);
|
||||
audiodetectionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(MainActivity.this, Beschleunigungssensor.class);
|
||||
startActivity(intent);
|
||||
openAudiodetectionActivity();
|
||||
}
|
||||
});
|
||||
videodetectionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openVideodetectionActivity();
|
||||
}
|
||||
});
|
||||
accelerometerButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openAccelerometerActivity();
|
||||
}
|
||||
});
|
||||
audiodetectionAndAccelerometerButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openAudiodetectionAndAccelerometerActivity();
|
||||
}
|
||||
});
|
||||
videodetectionAndAccelerometerButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openVideodetectionAndAccelerometerActivity();
|
||||
}
|
||||
});
|
||||
connectionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openConnectionActivity();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
public void openAudiodetectionActivity(){
|
||||
Intent intent = new Intent(this, AudiodetectionActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
public void openVideodetectionActivity(){
|
||||
Intent intent = new Intent(this, VideodetectionActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
public void openAccelerometerActivity(){
|
||||
Intent intent = new Intent(this, AccelerometerActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
public void openAudiodetectionAndAccelerometerActivity(){
|
||||
Intent intent = new Intent(this, AudiodetectionAndAccelerometerActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
public void openVideodetectionAndAccelerometerActivity(){
|
||||
Intent intent = new Intent(this, VideodetectionAndAccelerometerActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
public void openConnectionActivity(){
|
||||
Intent intent = new Intent(this, ConnectionActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.example.greenwatch;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
public class VideodetectionActivity extends AppCompatActivity {
|
||||
|
||||
private Button backToMainActivity;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_videodetection);
|
||||
|
||||
backToMainActivity = (Button) findViewById(R.id.videodetectorBackToMainActivity);
|
||||
|
||||
backToMainActivity.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.example.greenwatch;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
public class VideodetectionAndAccelerometerActivity extends AppCompatActivity {
|
||||
|
||||
private Button backToMainActivity;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_videodetection_and_accelerometer);
|
||||
|
||||
backToMainActivity = (Button) findViewById(R.id.videodetectionAndAccelerometerBackToMainActivity);
|
||||
|
||||
backToMainActivity.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.example.greenwatch.mvc;
|
||||
|
||||
|
||||
public class Device {
|
||||
|
||||
private String sensor;
|
||||
private Boolean isActive;
|
||||
|
||||
public Device(String Sensor, Boolean Status) {
|
||||
this.sensor = Sensor;
|
||||
this.isActive = Status;
|
||||
}
|
||||
|
||||
public void setSensor(String Sensor) {
|
||||
this.sensor = Sensor;
|
||||
}
|
||||
|
||||
public String getSensor() {
|
||||
return sensor;
|
||||
}
|
||||
|
||||
public void setIsActive(Boolean Status) {
|
||||
this.isActive = Status;
|
||||
}
|
||||
|
||||
public Boolean getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.example.greenwatch.mvc;
|
||||
|
||||
public class DeviceController {
|
||||
|
||||
private DeviceModel deviceModel;
|
||||
private DeviceView deviceView;
|
||||
|
||||
public DeviceController(DeviceView view) {
|
||||
this.deviceModel = DeviceModel.getInstance();
|
||||
this.deviceView = view;
|
||||
}
|
||||
|
||||
public void createDevice(String Sensor, Boolean Status) {
|
||||
Device device = new Device(Sensor, Status);
|
||||
deviceModel.addDevice(device);
|
||||
// todo: Inform view and sender about changes
|
||||
}
|
||||
public void setDeviceSensor(String UUID, String Sensor) {
|
||||
deviceModel.setDeviceSensor(UUID, Sensor);
|
||||
}
|
||||
|
||||
public String getDeviceSensor(String UUID) {
|
||||
return deviceModel.getDeviceSensor(UUID);
|
||||
}
|
||||
|
||||
public void setDeviceStatus(String UUID, Boolean Status) {
|
||||
deviceModel.setDeviceStatus(UUID, Status);
|
||||
}
|
||||
|
||||
public Boolean getDeviceStatus(String UUID) {
|
||||
return deviceModel.getDeviceStatus(UUID);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.example.greenwatch.mvc;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class DeviceModel {
|
||||
private static DeviceModel itemModelInstance;
|
||||
// todo: should be a hashmap with UUID Keys
|
||||
private Vector<Device> connectetDevicesList;
|
||||
|
||||
private DeviceModel() {
|
||||
connectetDevicesList = new Vector<Device>();
|
||||
}
|
||||
|
||||
public static synchronized DeviceModel getInstance() {
|
||||
if (itemModelInstance == null){
|
||||
itemModelInstance = new DeviceModel();
|
||||
}
|
||||
return itemModelInstance;
|
||||
}
|
||||
|
||||
public void addDevice(Device device) {
|
||||
// todo: Check if divece already exist
|
||||
connectetDevicesList.add(device);
|
||||
}
|
||||
|
||||
public Vector<Device> getConnectetDevicesList() {
|
||||
return connectetDevicesList;
|
||||
}
|
||||
|
||||
public void setDeviceSensor(String UUID, String Sensor) {
|
||||
// todo: iterate through HashMap and find Divece for UUID
|
||||
}
|
||||
|
||||
public String getDeviceSensor(String UUID) {
|
||||
// todo: iterate through HashMap and find Divece for UUID
|
||||
return "hasToBeDone";
|
||||
}
|
||||
|
||||
public void setDeviceStatus(String UUID, Boolean Status) {
|
||||
// todo: iterate through HashMap and find Divece for UUID
|
||||
}
|
||||
|
||||
public Boolean getDeviceStatus(String UUID) {
|
||||
// todo: iterate through HashMap and find Divece for UUID
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.example.greenwatch.mvc;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class DeviceView {
|
||||
|
||||
public void updateView(Vector<Device> deviceVector) {
|
||||
// todo: what should be displayed
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp"
|
||||
tools:context=".AccelerometerActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAccelerometerStatusmessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Accelerometer Activity">
|
||||
</TextView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/accelerometerBackToMainActivity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Back to MainActivity">
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp"
|
||||
tools:context=".AudiodetectionActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAudiodetectionStatusmessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Audiodetection Activity">
|
||||
</TextView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/audiodetectorBackToMainActivity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Back to MainActivity">
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp"
|
||||
tools:context=".AudiodetectionAndAccelerometerActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAudiodetectionAndAccelerometerStatusmessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Audiodetection + Accelerometer Activity">
|
||||
</TextView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/audiodetectionAndAccelerometerBackToMainActivity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Back to MainActivity">
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".Beschleunigungssensor">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DatenBsensor"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/WarnungBsensor"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="" />
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp"
|
||||
tools:context=".ConnectionActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvConnectionStatusmessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Connection Activity">
|
||||
</TextView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/connectionBackToMainActivity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Back to MainActivity">
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,47 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStatusmessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Hello World!"
|
||||
android:layout_weight="1">
|
||||
</TextView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TextView"
|
||||
tools:layout_editor_absoluteX="171dp"
|
||||
tools:layout_editor_absoluteY="186dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TextView" />
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1">
|
||||
|
||||
<Button
|
||||
android:id="@+id/beschleunigungssensor"
|
||||
android:id="@+id/audiodetectionButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Beschleunigungssensor" />
|
||||
android:layout_weight="1"
|
||||
android:text="Audiodetection">
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
android:id="@+id/aufnahme"
|
||||
android:id="@+id/videodetectionButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Aufnahme Start" />
|
||||
android:layout_weight="1"
|
||||
android:text="Videodetection">
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
android:id="@+id/wiedergabe"
|
||||
android:id="@+id/accelerometerButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Wiedergabe" />
|
||||
android:layout_weight="1"
|
||||
android:text="Accelerometer">
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
android:id="@+id/audiodetectionAndAccelerometerButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Audiodetection + Accelerometer">
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
android:id="@+id/videodetectionAndAccelerometerButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Videodetection + Accelerometer">
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
android:id="@+id/connectionButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Connect to Devices">
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp"
|
||||
tools:context=".VideodetectionActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvVideodetectionStatusmessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Videodetection Activity">
|
||||
</TextView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/videodetectorBackToMainActivity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Back to MainActivity">
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp"
|
||||
tools:context=".VideodetectionAndAccelerometerActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvVideodetectionAndAccelerometerStatusmessage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Videodetection + Accelerometer Activity">
|
||||
</TextView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/videodetectionAndAccelerometerBackToMainActivity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Back to MainActivity">
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in new issue
Block a user