1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-01 14:32:54 +01:00

Fix remaining byte parameter in the API for steps.

Maybe this was the reason for #91 (negative steps)

This could happen making at least 3 steps per second.
This commit is contained in:
cpfeiffer 2015-08-15 00:23:13 +02:00
parent ecc483f027
commit a66a3a15c2
3 changed files with 5 additions and 3 deletions

View File

@ -115,7 +115,8 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper implements DBHandl
* @param steps the sample's steps value * @param steps the sample's steps value
* @param kind the raw activity kind of the sample * @param kind the raw activity kind of the sample
*/ */
public void addGBActivitySample(int timestamp, byte provider, short intensity, byte steps, byte kind) { @Override
public void addGBActivitySample(int timestamp, byte provider, short intensity, short steps, byte kind) {
try (SQLiteDatabase db = this.getWritableDatabase()) { try (SQLiteDatabase db = this.getWritableDatabase()) {
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
values.put(KEY_TIMESTAMP, timestamp); values.put(KEY_TIMESTAMP, timestamp);

View File

@ -24,7 +24,7 @@ public interface DBHandler {
List<ActivitySample> getSleepSamples(int tsFrom, int tsTo, SampleProvider provider); List<ActivitySample> getSleepSamples(int tsFrom, int tsTo, SampleProvider provider);
void addGBActivitySample(int timestamp, byte provider, short intensity, byte steps, byte kind); void addGBActivitySample(int timestamp, byte provider, short intensity, short steps, byte kind);
SQLiteDatabase getWritableDatabase(); SQLiteDatabase getWritableDatabase();
} }

View File

@ -12,6 +12,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.Charset;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -918,7 +919,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
(int) (activityStruct.activityDataTimestampProgress.getTimeInMillis() / 1000), (int) (activityStruct.activityDataTimestampProgress.getTimeInMillis() / 1000),
SampleProvider.PROVIDER_MIBAND, SampleProvider.PROVIDER_MIBAND,
intensity, intensity,
steps, (short) (steps & 0xff),
category); category);
activityStruct.activityDataTimestampProgress.add(Calendar.MINUTE, 1); activityStruct.activityDataTimestampProgress.add(Calendar.MINUTE, 1);
} }