2015-08-03 23:09:49 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.devices.pebble;
|
2015-07-27 23:49:53 +02:00
|
|
|
|
2015-08-03 23:09:49 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
2015-07-27 23:49:53 +02:00
|
|
|
|
|
|
|
public class MorpheuzSampleProvider implements SampleProvider {
|
|
|
|
// raw types
|
|
|
|
public static final byte TYPE_DEEP_SLEEP = 5;
|
|
|
|
public static final byte TYPE_LIGHT_SLEEP = 4;
|
|
|
|
public static final byte TYPE_ACTIVITY = -1;
|
|
|
|
public static final byte TYPE_UNKNOWN = -1;
|
|
|
|
|
|
|
|
protected float movementDivisor = 5000f;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int normalizeType(byte rawType) {
|
|
|
|
switch (rawType) {
|
|
|
|
case TYPE_DEEP_SLEEP:
|
|
|
|
return ActivityKind.TYPE_DEEP_SLEEP;
|
|
|
|
case TYPE_LIGHT_SLEEP:
|
|
|
|
return ActivityKind.TYPE_LIGHT_SLEEP;
|
|
|
|
case TYPE_ACTIVITY:
|
|
|
|
return ActivityKind.TYPE_ACTIVITY;
|
|
|
|
default:
|
|
|
|
// case TYPE_UNKNOWN: // fall through
|
|
|
|
return ActivityKind.TYPE_UNKNOWN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public byte toRawActivityKind(int activityKind) {
|
|
|
|
switch (activityKind) {
|
|
|
|
case ActivityKind.TYPE_ACTIVITY:
|
|
|
|
return TYPE_ACTIVITY;
|
|
|
|
case ActivityKind.TYPE_DEEP_SLEEP:
|
|
|
|
return TYPE_DEEP_SLEEP;
|
|
|
|
case ActivityKind.TYPE_LIGHT_SLEEP:
|
|
|
|
return TYPE_LIGHT_SLEEP;
|
|
|
|
case ActivityKind.TYPE_UNKNOWN: // fall through
|
|
|
|
default:
|
|
|
|
return TYPE_UNKNOWN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float normalizeIntensity(short rawIntensity) {
|
2015-07-28 17:30:20 +02:00
|
|
|
return rawIntensity / movementDivisor;
|
2015-07-27 23:49:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public byte getID() {
|
|
|
|
return SampleProvider.PROVIDER_PEBBLE_MORPHEUZ;
|
|
|
|
}
|
|
|
|
}
|