2015-10-21 16:11:16 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.devices.pebble;
|
|
|
|
|
2016-07-27 23:34:13 +02:00
|
|
|
import de.greenrobot.dao.AbstractDao;
|
|
|
|
import de.greenrobot.dao.Property;
|
2016-08-07 11:45:09 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractSampleProvider;
|
2015-10-21 16:11:16 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
2016-05-08 23:14:58 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
2016-07-27 23:34:13 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.PebbleMisfitSample;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.PebbleMisfitSampleDao;
|
2016-06-27 20:41:20 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
2015-10-21 16:11:16 +02:00
|
|
|
|
2016-08-07 11:45:09 +02:00
|
|
|
public class PebbleMisfitSampleProvider extends AbstractSampleProvider<PebbleMisfitSample> {
|
2015-10-21 16:11:16 +02:00
|
|
|
|
2015-11-23 23:04:46 +01:00
|
|
|
protected final float movementDivisor = 300f;
|
2015-10-21 16:11:16 +02:00
|
|
|
|
2016-07-30 23:22:27 +02:00
|
|
|
public PebbleMisfitSampleProvider(GBDevice device, DaoSession session) {
|
2016-08-07 11:45:09 +02:00
|
|
|
super(device, session);
|
2016-05-08 23:14:58 +02:00
|
|
|
}
|
|
|
|
|
2015-10-21 16:11:16 +02:00
|
|
|
@Override
|
2016-02-29 20:54:39 +01:00
|
|
|
public int normalizeType(int rawType) {
|
2016-06-14 23:10:35 +02:00
|
|
|
return rawType;
|
2015-10-21 16:11:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-02-29 20:54:39 +01:00
|
|
|
public int toRawActivityKind(int activityKind) {
|
2016-07-27 23:34:13 +02:00
|
|
|
return activityKind;
|
2015-10-21 16:11:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-02-29 20:54:39 +01:00
|
|
|
public float normalizeIntensity(int rawIntensity) {
|
2015-10-21 16:11:16 +02:00
|
|
|
return rawIntensity / movementDivisor;
|
|
|
|
}
|
|
|
|
|
2016-07-25 22:19:39 +02:00
|
|
|
@Override
|
2016-07-27 23:34:13 +02:00
|
|
|
public PebbleMisfitSample createActivitySample() {
|
2016-08-07 12:15:40 +02:00
|
|
|
return new PebbleMisfitSample();
|
2016-07-25 22:19:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-07-27 23:34:13 +02:00
|
|
|
public int getID() {
|
|
|
|
return SampleProvider.PROVIDER_PEBBLE_MISFIT;
|
2016-07-25 22:19:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-08-07 11:45:09 +02:00
|
|
|
public AbstractDao<PebbleMisfitSample, ?> getSampleDao() {
|
|
|
|
return getSession().getPebbleMisfitSampleDao();
|
2016-07-25 22:19:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-08-07 11:45:09 +02:00
|
|
|
protected Property getRawKindSampleProperty() {
|
|
|
|
return null;
|
2016-07-27 23:34:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected Property getTimestampSampleProperty() {
|
|
|
|
return PebbleMisfitSampleDao.Properties.Timestamp;
|
2015-10-21 16:11:16 +02:00
|
|
|
}
|
2016-07-27 23:34:13 +02:00
|
|
|
|
|
|
|
protected Property getDeviceIdentifierSampleProperty() {
|
|
|
|
return PebbleMisfitSampleDao.Properties.DeviceId;
|
|
|
|
}
|
2015-10-21 16:11:16 +02:00
|
|
|
}
|