add some constants to GBActivitySample

This commit is contained in:
Andreas Shimokawa 2015-05-30 21:52:29 +02:00
parent 41207516b1
commit 603d31a59e
2 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,12 @@
package nodomain.freeyourgadget.gadgetbridge; package nodomain.freeyourgadget.gadgetbridge;
public class GBActivitySample { public class GBActivitySample {
public static final byte PROVIDER_MIBAND = 0;
public static final byte PROVIDER_PEBBLE_MORPHEUZ = 1;
public static final byte TYPE_SLEEP = 0; //FIXME: we could just adapt to Mi Band (Dont know the correct values)
// add more here
private final int timestamp; private final int timestamp;
private final byte provider; private final byte provider;
private final short intensity; private final short intensity;

View File

@ -11,6 +11,7 @@ import java.util.SimpleTimeZone;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.UUID; import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommand; import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommand;
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandSendBytes; import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandSendBytes;
@ -100,7 +101,7 @@ public class MorpheuzSupport {
short data = (short) ((int) pair.second & 0xffff); short data = (short) ((int) pair.second & 0xffff);
LOG.info("got point:" + index + " " + data); LOG.info("got point:" + index + " " + data);
if (index >= 0 && index < 54) { if (index >= 0 && index < 54) {
GBApplication.getActivityDatabaseHandler().addGBActivitySample(recording_base_timestamp + index * 600, (byte) 1, data, (byte) 0, (byte) 0); GBApplication.getActivityDatabaseHandler().addGBActivitySample(recording_base_timestamp + index * 600, GBActivitySample.PROVIDER_PEBBLE_MORPHEUZ, data, (byte) 0, GBActivitySample.TYPE_SLEEP);
} }
ctrl_message = MorpheuzSupport.CTRL_VERSION_DONE | MorpheuzSupport.CTRL_SET_LAST_SENT | MorpheuzSupport.CTRL_DO_NEXT; ctrl_message = MorpheuzSupport.CTRL_VERSION_DONE | MorpheuzSupport.CTRL_SET_LAST_SENT | MorpheuzSupport.CTRL_DO_NEXT;