1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 04:46:51 +01:00

change some more short and byte to int regarding Morpheuz

This commit is contained in:
Andreas Shimokawa 2016-02-29 23:13:07 +01:00
parent 9adae3b538
commit fc464d112d
2 changed files with 8 additions and 8 deletions

View File

@ -5,10 +5,10 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
public class MorpheuzSampleProvider implements SampleProvider { public class MorpheuzSampleProvider implements SampleProvider {
// raw types // raw types
public static final byte TYPE_DEEP_SLEEP = 5; public static final int TYPE_DEEP_SLEEP = 5;
public static final byte TYPE_LIGHT_SLEEP = 4; public static final int TYPE_LIGHT_SLEEP = 4;
public static final byte TYPE_ACTIVITY = -1; public static final int TYPE_ACTIVITY = -1;
public static final byte TYPE_UNKNOWN = -1; public static final int TYPE_UNKNOWN = -1;
protected float movementDivisor = 5000f; protected float movementDivisor = 5000f;

View File

@ -80,10 +80,10 @@ public class AppMessageHandlerMorpheuz extends AppMessageHandler {
// we have no base timestamp but received points, stop this // we have no base timestamp but received points, stop this
ctrl_message = AppMessageHandlerMorpheuz.CTRL_VERSION_DONE | AppMessageHandlerMorpheuz.CTRL_GONEOFF_DONE | AppMessageHandlerMorpheuz.CTRL_TRANSMIT_DONE | AppMessageHandlerMorpheuz.CTRL_SET_LAST_SENT; ctrl_message = AppMessageHandlerMorpheuz.CTRL_VERSION_DONE | AppMessageHandlerMorpheuz.CTRL_GONEOFF_DONE | AppMessageHandlerMorpheuz.CTRL_TRANSMIT_DONE | AppMessageHandlerMorpheuz.CTRL_SET_LAST_SENT;
} else { } else {
short index = (short) ((int) pair.second >> 16); int index = ((int) pair.second >> 16);
short intensity = (short) ((int) pair.second & 0xffff); int intensity = ((int) pair.second & 0xffff);
LOG.info("got point:" + index + " " + intensity); LOG.info("got point:" + index + " " + intensity);
byte type = MorpheuzSampleProvider.TYPE_UNKNOWN; int type = MorpheuzSampleProvider.TYPE_UNKNOWN;
if (intensity <= 120) { if (intensity <= 120) {
type = MorpheuzSampleProvider.TYPE_DEEP_SLEEP; type = MorpheuzSampleProvider.TYPE_DEEP_SLEEP;
} else if (intensity <= 1000) { } else if (intensity <= 1000) {
@ -93,7 +93,7 @@ public class AppMessageHandlerMorpheuz extends AppMessageHandler {
DBHandler db = null; DBHandler db = null;
try { try {
db = GBApplication.acquireDB(); db = GBApplication.acquireDB();
db.addGBActivitySample(recording_base_timestamp + index * 600, SampleProvider.PROVIDER_PEBBLE_MORPHEUZ, intensity, (byte) 0, type, (short) 0); db.addGBActivitySample(recording_base_timestamp + index * 600, SampleProvider.PROVIDER_PEBBLE_MORPHEUZ, intensity, 0, type, 0);
} catch (GBException e) { } catch (GBException e) {
LOG.error("Error acquiring database", e); LOG.error("Error acquiring database", e);
} finally { } finally {