1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-14 22:19:29 +01:00

Some more byte -> int conversions

This commit is contained in:
cpfeiffer 2016-03-07 22:47:34 +01:00
parent 5ae680cab5
commit 5eb8f57b4c
3 changed files with 14 additions and 14 deletions

View File

@ -226,10 +226,10 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper implements DBHandl
GBActivitySample sample = new GBActivitySample(
provider,
cursor.getInt(cursor.getColumnIndex(KEY_TIMESTAMP)),
cursor.getShort(cursor.getColumnIndex(KEY_INTENSITY)),
cursor.getShort(cursor.getColumnIndex(KEY_STEPS)),
(byte) cursor.getShort(cursor.getColumnIndex(KEY_TYPE)),
cursor.getShort(cursor.getColumnIndex(KEY_CUSTOM_SHORT)));
cursor.getInt(cursor.getColumnIndex(KEY_INTENSITY)),
cursor.getInt(cursor.getColumnIndex(KEY_STEPS)),
cursor.getInt(cursor.getColumnIndex(KEY_TYPE)),
cursor.getInt(cursor.getColumnIndex(KEY_CUSTOM_SHORT)));
samples.add(sample);
} while (cursor.moveToNext());
}

View File

@ -4,12 +4,12 @@ import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
public class MiBandSampleProvider implements SampleProvider {
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;
public static final byte TYPE_NONWEAR = 3;
public static final byte TYPE_CHARGING = 6;
public static final int TYPE_DEEP_SLEEP = 5;
public static final int TYPE_LIGHT_SLEEP = 4;
public static final int TYPE_ACTIVITY = -1;
public static final int TYPE_UNKNOWN = -1;
public static final int TYPE_NONWEAR = 3;
public static final int TYPE_CHARGING = 6;
// public static final byte TYPE_NREM = 5; // DEEP SLEEP
// public static final byte TYPE_ONBED = 7;

View File

@ -333,10 +333,10 @@ public class FetchActivityOperation extends AbstractMiBandOperation {
samples[minutes] = new GBActivitySample(
sampleProvider,
timestampInSeconds,
(short) (intensity & 0xff),
(short) (steps & 0xff),
category,
(short) (heartrate & 0xff));
intensity & 0xff,
steps & 0xff,
category & 0xff,
heartrate & 0xff);
// next minute
minutes++;