diff --git a/open_earable/lib/apps/powernapper/home_screen.dart b/open_earable/lib/apps/powernapper/home_screen.dart index 3880565..e7f9bb8 100644 --- a/open_earable/lib/apps/powernapper/home_screen.dart +++ b/open_earable/lib/apps/powernapper/home_screen.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:open_earable/apps/ufiiu/timerscreen.dart'; +import 'package:open_earable/apps/powernapper/timerscreen.dart'; import 'package:open_earable_flutter/src/open_earable_flutter.dart'; import 'interact.dart'; diff --git a/open_earable/lib/apps/powernapper/interact.dart b/open_earable/lib/apps/powernapper/interact.dart index 18f9515..cb3c528 100644 --- a/open_earable/lib/apps/powernapper/interact.dart +++ b/open_earable/lib/apps/powernapper/interact.dart @@ -3,19 +3,16 @@ import 'package:open_earable_flutter/src/open_earable_flutter.dart'; ///Interaction class for the earable. All actions executed on the earable are accessible through this class. ///For example rings or led colors. class Interact { - final OpenEarable _openEarable; //Constructor Interact(this._openEarable); - //Getter for the Earable OpenEarable getEarable() { return _openEarable; } - ///Lets the OpenEarable play the jingel-ID: '1'. void ring() { try { @@ -24,4 +21,4 @@ class Interact { print('ERROR: Jingle konnte nicht gespielt werden!'); } } -} \ No newline at end of file +} diff --git a/open_earable/lib/apps/powernapper/movementTracker.dart b/open_earable/lib/apps/powernapper/movementTracker.dart index 373f5d4..96103b8 100644 --- a/open_earable/lib/apps/powernapper/movementTracker.dart +++ b/open_earable/lib/apps/powernapper/movementTracker.dart @@ -1,12 +1,11 @@ import 'dart:async'; -import 'package:open_earable/apps/ufiiu/interact.dart'; -import 'package:open_earable/apps/ufiiu/sensor_datatypes.dart'; +import 'package:open_earable/apps/powernapper/interact.dart'; +import 'package:open_earable/apps/powernapper/sensor_datatypes.dart'; import 'package:open_earable_flutter/src/open_earable_flutter.dart'; /// Movement Tracker has lgoic for timer & movement validation. class MovementTracker { - //Incetaction variables final Interact _interact; late final OpenEarable _openEarable; @@ -16,7 +15,6 @@ class MovementTracker { //Stream Subscription StreamSubscription>? _subscription; - //Constructor MovementTracker(this._interact) { this._openEarable = _interact.getEarable(); @@ -27,7 +25,6 @@ class MovementTracker { /// Input: [minutes] for the time before the ring. /// Input: [updateText] as an void callback function for the textupdate. void start(int minutes, void Function(SensorDataType s) updateText) { - //Timer (re-)start stop(); _startTimer(minutes); @@ -36,8 +33,8 @@ class MovementTracker { _openEarable.sensorManager.writeSensorConfig(_buildSensorConfig()); //Starts listening to the subscription - _subscription = _openEarable.sensorManager.subscribeToSensorData(0).listen((event) { - + _subscription = + _openEarable.sensorManager.subscribeToSensorData(0).listen((event) { //Display update callback updateText(Gyroscope(event)); @@ -68,7 +65,7 @@ class MovementTracker { /// /// Uses the [SensorDataType] to validate update and int [minutes] to restart the timer. void _update(SensorDataType dt, int minutes) { - if(_validMovement(dt)) { + if (_validMovement(dt)) { _timer?.cancel(); _startTimer(minutes); } @@ -78,17 +75,13 @@ class MovementTracker { /// /// Input: [SensorDataType] with the data to be validated. bool _validMovement(SensorDataType dt) { - Gyroscope gyro; - if(dt is Gyroscope) { + if (dt is Gyroscope) { gyro = dt; //Threshold validating for gyroscope data. - if(gyro.x.abs() > 5 - || gyro.y.abs() > 5 - || gyro.z.abs() > 5 - ) { + if (gyro.x.abs() > 5 || gyro.y.abs() > 5 || gyro.z.abs() > 5) { return true; } } @@ -97,10 +90,6 @@ class MovementTracker { ///Sensor Config for the earable. OpenEarableSensorConfig _buildSensorConfig() { - return OpenEarableSensorConfig( - sensorId: 0, - samplingRate: 30, - latency: 0 - ); + return OpenEarableSensorConfig(sensorId: 0, samplingRate: 30, latency: 0); } -} \ No newline at end of file +} diff --git a/open_earable/lib/apps/powernapper/sensor_datatypes.dart b/open_earable/lib/apps/powernapper/sensor_datatypes.dart index 8bff3da..53a9db1 100644 --- a/open_earable/lib/apps/powernapper/sensor_datatypes.dart +++ b/open_earable/lib/apps/powernapper/sensor_datatypes.dart @@ -34,4 +34,4 @@ class EulerAngles extends SensorDataType { /// Placeholder data without any information in case no sensor data is available. class NullData extends SensorDataType { NullData() : super({"X": 0.0, "Y": 0.0, "Z": 0.0}); -} \ No newline at end of file +} diff --git a/open_earable/lib/apps/powernapper/timerscreen.dart b/open_earable/lib/apps/powernapper/timerscreen.dart index bfb57dd..bf3efd1 100644 --- a/open_earable/lib/apps/powernapper/timerscreen.dart +++ b/open_earable/lib/apps/powernapper/timerscreen.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:open_earable/apps/ufiiu/movementTracker.dart'; -import 'package:open_earable/apps/ufiiu/sensor_datatypes.dart'; +import 'package:open_earable/apps/powernapper/movementTracker.dart'; +import 'package:open_earable/apps/powernapper/sensor_datatypes.dart'; import 'package:open_earable/ble_controller.dart'; import 'package:open_earable/widgets/earable_not_connected_warning.dart'; import 'package:provider/provider.dart'; diff --git a/open_earable/lib/apps_tab.dart b/open_earable/lib/apps_tab.dart index f00733a..b541487 100644 --- a/open_earable/lib/apps_tab.dart +++ b/open_earable/lib/apps_tab.dart @@ -6,8 +6,7 @@ import 'package:open_earable/apps/recorder.dart'; import 'package:open_earable/apps/jump_height_test/jump_height_test.dart'; import 'package:open_earable_flutter/src/open_earable_flutter.dart'; import 'package:open_earable/apps/jump_rope_counter.dart'; - -import 'apps/ufiiu/home_screen.dart'; +import 'apps/powernapper/home_screen.dart'; class AppInfo { final IconData iconData;