diff --git a/build.gradle b/build.gradle index 06b112eda6db8d79a4a490442c9a03fc72485d2b..2e533af1215aee3c385547b0af6788f741eb3aa5 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ed81f1e51f238601260890dc6681e885424e7251..32f358585c0b740dc381ff4fe51e65f5ba4bdd91 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Nov 28 11:04:23 CET 2018 +#Fri May 10 15:21:13 CEST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java b/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java index 4d73906f1e996a44cd7b9465fab6d060dab1a462..138edac14ab4377f809910b390cded5c5714cf5e 100644 --- a/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java +++ b/mobile/src/main/java/de/tudresden/inf/st/sensorsharing/MainActivity.java @@ -439,6 +439,7 @@ public class MainActivity extends AppCompatActivity implements final CheckBox sendUpdates = findViewById(R.id.checkBox_send_brightness); final CheckBox sendUpdatesRotation = findViewById(R.id.checkBox_send_rotation_ahrs); final CheckBox sendUpdatesRotationQuat = findViewById(R.id.checkBox_send_rotation_quaternion); + final CheckBox sendUpdatesAcceleration = findViewById(R.id.checkBox_send_acceleration); final CheckBox sendUpdatesWearBrightness = findViewById(R.id.checkBox_send_wear_brightness); final CheckBox sendUpdatesWearAcc= findViewById(R.id.checkBox_send_wear_acceleration); @@ -450,6 +451,7 @@ public class MainActivity extends AppCompatActivity implements sendMqttUpdates.put(phoneTopics.mqtt_topic_brightness, sendUpdates.isChecked()); sendMqttUpdates.put(phoneTopics.mqtt_topic_rotation_ahrs, sendUpdatesRotation.isChecked()); sendMqttUpdates.put(phoneTopics.mqtt_topic_rotation, sendUpdatesRotationQuat.isChecked()); + sendMqttUpdates.put(phoneTopics.mqtt_topic_acceleration, sendUpdatesAcceleration.isChecked()); sendMqttUpdates.put(wearTopics.mqtt_topic_brightness, sendUpdatesWearBrightness.isChecked()); sendMqttUpdates.put(wearTopics.mqtt_topic_acceleration, sendUpdatesWearAcc.isChecked()); @@ -471,6 +473,9 @@ public class MainActivity extends AppCompatActivity implements sendMqttUpdates.put(phoneTopics.mqtt_topic_rotation, sendUpdatesRotationQuat.isChecked()); break; //test wear + case R.id.checkBox_send_acceleration: + sendMqttUpdates.put(phoneTopics.mqtt_topic_acceleration, sendUpdatesAcceleration.isChecked()); + break; case R.id.checkBox_send_wear_brightness: sendMqttUpdates.put(wearTopics.mqtt_topic_brightness, sendUpdatesWearBrightness.isChecked()); break; @@ -495,6 +500,7 @@ public class MainActivity extends AppCompatActivity implements sendUpdates.setOnCheckedChangeListener(onCheckedChangeListener); sendUpdatesRotation.setOnCheckedChangeListener(onCheckedChangeListener); sendUpdatesRotationQuat.setOnCheckedChangeListener(onCheckedChangeListener); + sendUpdatesAcceleration.setOnCheckedChangeListener(onCheckedChangeListener); sendUpdatesWearBrightness.setOnCheckedChangeListener(onCheckedChangeListener); sendUpdatesWearAcc.setOnCheckedChangeListener(onCheckedChangeListener); sendUpdatesWearRotation.setOnCheckedChangeListener(onCheckedChangeListener); @@ -687,6 +693,8 @@ public class MainActivity extends AppCompatActivity implements break; case Sensor.TYPE_ACCELEROMETER: accelVectorValues = sensorEvent.values; + textView = findViewById(R.id.value_own_acceleration); + textView.setText(Utils.formatArray3(accelVectorValues)); case Sensor.TYPE_GYROSCOPE: gyroVectorValues = sensorEvent.values; break; @@ -715,7 +723,6 @@ public class MainActivity extends AppCompatActivity implements mSensorManager.registerListener(this, gyroSensor, SensorManager.SENSOR_DELAY_UI); mSensorManager.registerListener(this, magSensor, SensorManager.SENSOR_DELAY_UI); Wearable.getMessageClient(this).addListener(this); - } @Override @@ -886,6 +893,17 @@ public class MainActivity extends AppCompatActivity implements } catch (JsonProcessingException e) { e.printStackTrace(); } + // Acceleration data + HashMap<String, Float> acceleration = new HashMap<>(); + acceleration.put("x", accelVectorValues[0]); + acceleration.put("y", accelVectorValues[1]); + acceleration.put("z", accelVectorValues[2]); + try { + String s = mapper.writeValueAsString(acceleration); + sendUpdate(phoneTopics.mqtt_topic_acceleration, String.valueOf(acceleration)); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } // AHRS data filter.Update(gyroVectorValues[0], gyroVectorValues[1], gyroVectorValues[2], diff --git a/mobile/src/main/res/layout/fragment_first.xml b/mobile/src/main/res/layout/fragment_first.xml index 152205678bf1207ace513441cb9d48d143e2718a..f3e4d04f0d5f6886667f8f3c3d90ddff2febe255 100644 --- a/mobile/src/main/res/layout/fragment_first.xml +++ b/mobile/src/main/res/layout/fragment_first.xml @@ -17,7 +17,7 @@ android:layout_marginTop="8dp" android:text="@string/text_rotation" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/label_own_brightness" /> + app:layout_constraintTop_toBottomOf="@+id/label_own_acceleration" /> <TextView android:id="@+id/value_own_rotation" @@ -27,7 +27,25 @@ android:layout_marginTop="8dp" android:text="@android:string/unknownName" app:layout_constraintStart_toEndOf="@+id/label_own_rotation" - app:layout_constraintTop_toBottomOf="@+id/value_own_brightness" /> + app:layout_constraintTop_toBottomOf="@+id/value_own_acceleration" /> + <TextView + android:id="@+id/label_own_acceleration" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="Acceleration" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/label_own_brightness" /> + <TextView + android:id="@+id/value_own_acceleration" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:text="unknown" + app:layout_constraintLeft_toRightOf="@id/label_own_acceleration" + app:layout_constraintTop_toBottomOf="@+id/label_own_brightness" /> <TextView android:id="@+id/label_wear_name" @@ -97,7 +115,7 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/label_own_brightness" /> + app:layout_constraintTop_toBottomOf="@+id/label_own_rotation" /> <TextView android:id="@+id/label_own_brightness" diff --git a/mobile/src/main/res/layout/fragment_second.xml b/mobile/src/main/res/layout/fragment_second.xml index ecca488c743feaac2723555fafe98d76fe8c4c61..c619fdfc66d43b2e921fcd36b81571d5e86a991e 100644 --- a/mobile/src/main/res/layout/fragment_second.xml +++ b/mobile/src/main/res/layout/fragment_second.xml @@ -81,6 +81,14 @@ android:text="@string/send_updates_rotation_quaternion" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/checkBox_send_rotation_ahrs" /> + <CheckBox + android:id="@+id/checkBox_send_acceleration" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="Send Updates Acceleration" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/checkBox_send_rotation_quaternion" /> <CheckBox android:id="@+id/checkBox_send_wear_brightness" @@ -89,7 +97,7 @@ android:layout_marginStart="8dp" android:text="@string/send_updates_wear_brightness" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/checkBox_send_rotation_quaternion" /> + app:layout_constraintTop_toBottomOf="@+id/checkBox_send_acceleration" /> <CheckBox android:id="@+id/checkBox_send_wear_acceleration"