Panagiotis Triantafyllou

new keys

...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library' ...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
2 2
3 ext { 3 ext {
4 PUBLISH_GROUP_ID = 'ly.warp' 4 PUBLISH_GROUP_ID = 'ly.warp'
5 - PUBLISH_VERSION = '4.5.4-cosbeta72' 5 + PUBLISH_VERSION = '4.5.4-cosbeta73a'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -54,12 +54,10 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -54,12 +54,10 @@ public class WarplyHealthService extends Service implements SensorEventListener
54 54
55 private SensorManager mSensorManager; 55 private SensorManager mSensorManager;
56 private Sensor mSensor; 56 private Sensor mSensor;
57 - // private int mSteps = 0;
58 -// private double mStepsAll = 0.0d;
59 private final int ACCEL_RING_SIZE = 50; 57 private final int ACCEL_RING_SIZE = 50;
60 private final int VEL_RING_SIZE = 10; 58 private final int VEL_RING_SIZE = 10;
61 // change this threshold according to your sensitivity preferences 59 // change this threshold according to your sensitivity preferences
62 - private final float STEP_THRESHOLD = 18f; // default 40, cosmote default 20 60 + private final float STEP_THRESHOLD = 50f; // default 40, cosmote default 20
63 private final int STEP_DELAY_NS = 250000000; 61 private final int STEP_DELAY_NS = 250000000;
64 private int accelRingCounter = 0; 62 private int accelRingCounter = 0;
65 private float[] accelRingX = new float[ACCEL_RING_SIZE]; 63 private float[] accelRingX = new float[ACCEL_RING_SIZE];
...@@ -69,7 +67,8 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -69,7 +67,8 @@ public class WarplyHealthService extends Service implements SensorEventListener
69 private float[] velRing = new float[VEL_RING_SIZE]; 67 private float[] velRing = new float[VEL_RING_SIZE];
70 private long lastStepTimeNs = 0; 68 private long lastStepTimeNs = 0;
71 private float oldVelocityEstimate = 0; 69 private float oldVelocityEstimate = 0;
72 - private double mPacingMeters = 0.0d; 70 + private double eventMeters = 0.0d;
71 + private int sumSteps = 0;
73 72
74 // =========================================================== 73 // ===========================================================
75 // Contructors 74 // Contructors
...@@ -86,7 +85,7 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -86,7 +85,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
86 85
87 mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); 86 mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
88 mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); 87 mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
89 - WarplyManager.getPacingDetails(new PacingDetailsRequest(), mPacingCallback); 88 + registerStepSensor();
90 } 89 }
91 90
92 @RequiresApi(api = Build.VERSION_CODES.O) 91 @RequiresApi(api = Build.VERSION_CODES.O)
...@@ -138,11 +137,10 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -138,11 +137,10 @@ public class WarplyHealthService extends Service implements SensorEventListener
138 super.onDestroy(); 137 super.onDestroy();
139 138
140 unregisterStepSensor(); 139 unregisterStepSensor();
141 -// mStepsAll = 0.0d;
142 -// WarpUtils.setStepsMetersCounter(this, 0.0d);
143 WarplyManagerHelper.mStepsWebview = 0; 140 WarplyManagerHelper.mStepsWebview = 0;
144 WarplyManagerHelper.mMetersWebview = 0.0d; 141 WarplyManagerHelper.mMetersWebview = 0.0d;
145 - mPacingMeters = 0.0d; 142 + eventMeters = 0.0d;
143 + sumSteps = 0;
146 sendSteps(); 144 sendSteps();
147 } 145 }
148 146
...@@ -212,19 +210,17 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -212,19 +210,17 @@ public class WarplyHealthService extends Service implements SensorEventListener
212 if (velocityEstimate > STEP_THRESHOLD 210 if (velocityEstimate > STEP_THRESHOLD
213 && oldVelocityEstimate <= STEP_THRESHOLD 211 && oldVelocityEstimate <= STEP_THRESHOLD
214 && (timeNs - lastStepTimeNs > STEP_DELAY_NS)) { 212 && (timeNs - lastStepTimeNs > STEP_DELAY_NS)) {
215 -// mStepsAll++;
216 WarplyManagerHelper.mStepsWebview++; 213 WarplyManagerHelper.mStepsWebview++;
214 + sumSteps++;
217 WarplyManagerHelper.mSteps += WarplyManagerHelper.mStepsWebview; 215 WarplyManagerHelper.mSteps += WarplyManagerHelper.mStepsWebview;
218 WarpUtils.setStepsCounter(this, WarplyManagerHelper.mSteps); 216 WarpUtils.setStepsCounter(this, WarplyManagerHelper.mSteps);
219 WarplyManagerHelper.mMetersWebview = (WarplyManagerHelper.mStepsWebview * 0.762); 217 WarplyManagerHelper.mMetersWebview = (WarplyManagerHelper.mStepsWebview * 0.762);
220 HealthEventModel healthSteps = new HealthEventModel(); 218 HealthEventModel healthSteps = new HealthEventModel();
221 // healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022 219 // healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022
222 // healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022 220 // healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022
223 - double eventMeters = 0.0d; 221 + eventMeters = (sumSteps * 0.762);
224 - eventMeters = mPacingMeters + WarplyManagerHelper.mMetersWebview;
225 healthSteps.setMeters(eventMeters); 222 healthSteps.setMeters(eventMeters);
226 EventBus.getDefault().post(new WarplyEventBusManager(healthSteps)); 223 EventBus.getDefault().post(new WarplyEventBusManager(healthSteps));
227 -// WarpUtils.setStepsMetersCounter(this, (mStepsAll * 0.762));
228 224
229 lastStepTimeNs = timeNs; 225 lastStepTimeNs = timeNs;
230 } 226 }
...@@ -292,17 +288,4 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -292,17 +288,4 @@ public class WarplyHealthService extends Service implements SensorEventListener
292 }); 288 });
293 } 289 }
294 } 290 }
295 -
296 - private CallbackReceiver<PacingDetails> mPacingCallback = new CallbackReceiver<PacingDetails>() {
297 - @Override
298 - public void onSuccess(PacingDetails result) {
299 - mPacingMeters = result.getMeters().getDay().getValue();
300 - registerStepSensor();
301 - }
302 -
303 - @Override
304 - public void onFailure(int errorCode) {
305 - registerStepSensor();
306 - }
307 - };
308 } 291 }
......