Fixed timestamp conversion for DB, added local variables to make the code clearer
This commit is contained in:
parent
ea97a902d1
commit
9e2d32c33f
|
@ -498,19 +498,25 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
|
|
||||||
private void flushActivityDataHolder() {
|
private void flushActivityDataHolder() {
|
||||||
GregorianCalendar timestamp = this.activityDataTimestampProgress;
|
GregorianCalendar timestamp = this.activityDataTimestampProgress;
|
||||||
|
byte category, intensity, steps;
|
||||||
|
|
||||||
for (int i=0; i<this.activityDataHolder.length; i+=3) {
|
for (int i=0; i<this.activityDataHolder.length; i+=3) {
|
||||||
|
category = this.activityDataHolder[i];
|
||||||
|
intensity = this.activityDataHolder[i+1];
|
||||||
|
steps = this.activityDataHolder[i+2];
|
||||||
|
|
||||||
GBApplication.getActivityDatabaseHandler().addGBActivitySample(
|
GBApplication.getActivityDatabaseHandler().addGBActivitySample(
|
||||||
(int) timestamp.getTimeInMillis() / 1000,
|
(int) (timestamp.getTimeInMillis() / 1000),
|
||||||
GBActivitySample.PROVIDER_MIBAND,
|
GBActivitySample.PROVIDER_MIBAND,
|
||||||
this.activityDataHolder[i+1],
|
intensity,
|
||||||
this.activityDataHolder[i+2],
|
steps,
|
||||||
this.activityDataHolder[i]);
|
category);
|
||||||
|
|
||||||
ACTIVITYLOG.info(
|
ACTIVITYLOG.info(
|
||||||
" timestamp:"+DateFormat.getDateTimeInstance().format(timestamp.getTime()).toString() +
|
" timestamp:"+DateFormat.getDateTimeInstance().format(timestamp.getTime()).toString() +
|
||||||
" category:"+ this.activityDataHolder[i]+
|
" category:"+ category+
|
||||||
" intensity:"+this.activityDataHolder[i+1]+
|
" intensity:"+intensity+
|
||||||
" steps:"+this.activityDataHolder[i+2]
|
" steps:"+steps
|
||||||
);
|
);
|
||||||
timestamp.add(Calendar.MINUTE, 1);
|
timestamp.add(Calendar.MINUTE, 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue