Panagiotis Triantafyllou

new keys

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta72'
PUBLISH_VERSION = '4.5.4-cosbeta73a'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -54,12 +54,10 @@ public class WarplyHealthService extends Service implements SensorEventListener
private SensorManager mSensorManager;
private Sensor mSensor;
// private int mSteps = 0;
// private double mStepsAll = 0.0d;
private final int ACCEL_RING_SIZE = 50;
private final int VEL_RING_SIZE = 10;
// change this threshold according to your sensitivity preferences
private final float STEP_THRESHOLD = 18f; // default 40, cosmote default 20
private final float STEP_THRESHOLD = 50f; // default 40, cosmote default 20
private final int STEP_DELAY_NS = 250000000;
private int accelRingCounter = 0;
private float[] accelRingX = new float[ACCEL_RING_SIZE];
......@@ -69,7 +67,8 @@ public class WarplyHealthService extends Service implements SensorEventListener
private float[] velRing = new float[VEL_RING_SIZE];
private long lastStepTimeNs = 0;
private float oldVelocityEstimate = 0;
private double mPacingMeters = 0.0d;
private double eventMeters = 0.0d;
private int sumSteps = 0;
// ===========================================================
// Contructors
......@@ -86,7 +85,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
WarplyManager.getPacingDetails(new PacingDetailsRequest(), mPacingCallback);
registerStepSensor();
}
@RequiresApi(api = Build.VERSION_CODES.O)
......@@ -138,11 +137,10 @@ public class WarplyHealthService extends Service implements SensorEventListener
super.onDestroy();
unregisterStepSensor();
// mStepsAll = 0.0d;
// WarpUtils.setStepsMetersCounter(this, 0.0d);
WarplyManagerHelper.mStepsWebview = 0;
WarplyManagerHelper.mMetersWebview = 0.0d;
mPacingMeters = 0.0d;
eventMeters = 0.0d;
sumSteps = 0;
sendSteps();
}
......@@ -212,19 +210,17 @@ public class WarplyHealthService extends Service implements SensorEventListener
if (velocityEstimate > STEP_THRESHOLD
&& oldVelocityEstimate <= STEP_THRESHOLD
&& (timeNs - lastStepTimeNs > STEP_DELAY_NS)) {
// mStepsAll++;
WarplyManagerHelper.mStepsWebview++;
sumSteps++;
WarplyManagerHelper.mSteps += WarplyManagerHelper.mStepsWebview;
WarpUtils.setStepsCounter(this, WarplyManagerHelper.mSteps);
WarplyManagerHelper.mMetersWebview = (WarplyManagerHelper.mStepsWebview * 0.762);
HealthEventModel healthSteps = new HealthEventModel();
// healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022
// healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022
double eventMeters = 0.0d;
eventMeters = mPacingMeters + WarplyManagerHelper.mMetersWebview;
eventMeters = (sumSteps * 0.762);
healthSteps.setMeters(eventMeters);
EventBus.getDefault().post(new WarplyEventBusManager(healthSteps));
// WarpUtils.setStepsMetersCounter(this, (mStepsAll * 0.762));
lastStepTimeNs = timeNs;
}
......@@ -292,17 +288,4 @@ public class WarplyHealthService extends Service implements SensorEventListener
});
}
}
private CallbackReceiver<PacingDetails> mPacingCallback = new CallbackReceiver<PacingDetails>() {
@Override
public void onSuccess(PacingDetails result) {
mPacingMeters = result.getMeters().getDay().getValue();
registerStepSensor();
}
@Override
public void onFailure(int errorCode) {
registerStepSensor();
}
};
}
......