|
|
@@ -9,6 +9,7 @@ import android.app.ActionBar; |
|
|
|
import android.app.Dialog;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.hardware.Sensor;
|
|
|
|
import android.net.wifi.WifiManager;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.provider.Settings;
|
|
|
@@ -115,6 +116,8 @@ public class MainActivity extends FragmentActivity { |
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isServiceOK(){
|
|
|
|
Log.d(TAG, "isServicesOK(): checking google services version");
|
|
|
|
|
|
|
@@ -138,15 +141,17 @@ public class MainActivity extends FragmentActivity { |
|
|
|
public void deviceInitDataBase()
|
|
|
|
{
|
|
|
|
mDatenbank = FirebaseDatabase.getInstance().getReference();
|
|
|
|
Devices d1 = new Devices("10.00.00.000", false, Calendar.getInstance().getTimeInMillis(), 49.58967957913626, 11.011387124069765, 1000, LocalDateTime.now().toString(), ""); //Erlangen 49.58967957913626, 11.011387124069765
|
|
|
|
Devices d2 = new Devices("20.00.00.000", false, Calendar.getInstance().getTimeInMillis(), 48.7560280895443, 11.425157702952347, 200, LocalDateTime.now().toString(),""); //Ingolstadt 48.7560280895443, 11.425157702952347
|
|
|
|
Devices d3 = new Devices("30.00.00.000", false, Calendar.getInstance().getTimeInMillis(), 48.16958655466396, 11.617418429524394, 30, LocalDateTime.now().toString(),""); //München 48.16958655466396, 11.617418429524394
|
|
|
|
Devices d4 = new Devices("40.00.00.000", false, Calendar.getInstance().getTimeInMillis(), 45.55620112204013, 12.342516140205387, 4, LocalDateTime.now().toString(),""); //Venedig 45.55620112204013, 12.342516140205387
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG1").setValue(d1);
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG2").setValue(d2);
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG3").setValue(d3);
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG4").setValue(d4);
|
|
|
|
|
|
|
|
Devices d1 = new Devices("","","",49.58967957913626,11.011387124069765,false,false,0,1000); //Erlangen 49.58967957913626, 11.011387124069765
|
|
|
|
Devices d2 = new Devices("","","",48.7560280895443,11.425157702952347,false,false,0,1000); //Ingolstadt 48.7560280895443, 11.425157702952347
|
|
|
|
Devices d3 = new Devices("","","",48.16958655466396,11.617418429524394,false,false,0,1000); //München 48.16958655466396, 11.617418429524394
|
|
|
|
Devices d4 = new Devices("","","",45.55620112204013,12.342516140205387,false,false,0,1000); //Venedig 45.55620112204013, 12.342516140205387
|
|
|
|
Devices d5 = new Devices("","","",41.9204784730154,12.651055829215638,false,false,0,1000); //Rom 41.9204784730154, 12.651055829215638
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG1").setValue(d1);
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG2").setValue(d2);
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG3").setValue(d3);
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG4").setValue(d4);
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG5").setValue(d4);
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG5").setValue(d5);
|
|
|
|
//Nürnberg HBF: 49.4474136331757, 11.082661293035727
|
|
|
|
}
|
|
|
|
|
|
|
@@ -155,7 +160,7 @@ public class MainActivity extends FragmentActivity { |
|
|
|
public void getDataBaseValuesNoListener()
|
|
|
|
{
|
|
|
|
mDatenbank = FirebaseDatabase.getInstance().getReference();
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").get().addOnCompleteListener(new OnCompleteListener<DataSnapshot>() {
|
|
|
|
mDatenbank.child("overviewnodes").get().addOnCompleteListener(new OnCompleteListener<DataSnapshot>() {
|
|
|
|
@Override
|
|
|
|
public void onComplete(@NonNull Task<DataSnapshot> task) {
|
|
|
|
if (!task.isSuccessful()) {
|
|
|
@@ -171,22 +176,23 @@ public class MainActivity extends FragmentActivity { |
|
|
|
public void datenBankLeeren()
|
|
|
|
{
|
|
|
|
mDatenbank = FirebaseDatabase.getInstance().getReference();
|
|
|
|
for (int i = 1; i<=4; i++)
|
|
|
|
for (int i = 1; i<=5; i++)
|
|
|
|
{
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("ip").setValue("");
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("vibration").setValue(false);
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("timestamp").setValue("");
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("breitengrad").setValue("");
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("laengengrad").setValue("");
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("amplitude").setValue("");
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("localdatetime").setValue("");
|
|
|
|
mDatenbank.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("androidid").setValue("");
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG" + i).child("a_androidid").setValue("");
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG" + i).child("b_localdatetime").setValue("");
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG" + i).child("c_ip").setValue("");
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG" + i).child("d_breitengrad").setValue("");
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG" + i).child("e_laengengrad").setValue("");
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG" + i).child("f_nativegps").setValue(true);
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG" + i).child("g_vibration").setValue(false);
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG" + i).child("h_timestamp").setValue("");
|
|
|
|
mDatenbank.child("overviewnodes").child("IDG" + i).child("i_amplitude").setValue("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void testProcess(DataSnapshot data)
|
|
|
|
{
|
|
|
|
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewAronTestetInDiesemAbschnitt");
|
|
|
|
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewnodes");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
@@ -227,10 +233,10 @@ public class MainActivity extends FragmentActivity { |
|
|
|
for (int i = 1; i<=4; i++) //Für alle IDG 1-4 werden Werte ausgegeben
|
|
|
|
{
|
|
|
|
//####### Auslesen für String-Werte #######:
|
|
|
|
String ipAdresse = data.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("ip").getValue().toString();
|
|
|
|
String ipAdresse = data.child("overviewnodes").child("IDG" + i).child("ip").getValue().toString();
|
|
|
|
|
|
|
|
//####### Auslesen für boolean-Werte #######:
|
|
|
|
String vibrationString = data.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("vibration").getValue().toString();
|
|
|
|
String vibrationString = data.child("overviewnodes").child("IDG" + i).child("vibration").getValue().toString();
|
|
|
|
boolean vibration;
|
|
|
|
if(vibrationString == "true"){
|
|
|
|
vibration = true;
|
|
|
@@ -239,21 +245,21 @@ public class MainActivity extends FragmentActivity { |
|
|
|
}
|
|
|
|
|
|
|
|
//####### Auslesen für double-Werte #######:
|
|
|
|
String breitengradString = data.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("breitengrad").getValue().toString();
|
|
|
|
String laengengradString = data.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("laengengrad").getValue().toString();
|
|
|
|
String breitengradString = data.child("overviewnodes").child("IDG" + i).child("breitengrad").getValue().toString();
|
|
|
|
String laengengradString = data.child("overviewnodes").child("IDG" + i).child("laengengrad").getValue().toString();
|
|
|
|
double breitengrad = Double.parseDouble(breitengradString);
|
|
|
|
double laengengrad = Double.parseDouble(laengengradString);
|
|
|
|
|
|
|
|
//####### Auslesen für long-Werte #######:
|
|
|
|
String timestampString = data.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("timestamp").getValue().toString();
|
|
|
|
String timestampString = data.child("overviewnodes").child("IDG" + i).child("timestamp").getValue().toString();
|
|
|
|
long timestamp = Long.parseLong(timestampString);
|
|
|
|
|
|
|
|
//####### Auslesen für ing-Werte #######:
|
|
|
|
String amplitudeString = data.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("amplitude").getValue().toString();
|
|
|
|
String amplitudeString = data.child("overviewnodes").child("IDG" + i).child("amplitude").getValue().toString();
|
|
|
|
int amplitude = Integer.parseInt(amplitudeString);
|
|
|
|
|
|
|
|
//####### Auslesen für LocalDateTime#######:
|
|
|
|
String localdatetimeString = data.child("overviewAronTestetInDiesemAbschnitt").child("IDG" + i).child("localdatetime").getValue().toString();
|
|
|
|
String localdatetimeString = data.child("overviewnodes").child("IDG" + i).child("localdatetime").getValue().toString();
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
|
|
|
|
LocalDateTime localdatetime = LocalDateTime.parse(localdatetimeString, formatter);
|
|
|
|
}
|