Merge pull request #60 from danielegobbetti/fix_data_in_the_future

Do not allocate the buffer if there's no data available.
This commit is contained in:
Carsten Pfeiffer 2015-06-02 21:43:32 +02:00
commit 32b2500d6b
1 changed files with 4 additions and 2 deletions

View File

@ -462,8 +462,10 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
LOG.info("data to read until next header: "+ dataUntilNextHeader +" len: " + (dataUntilNextHeader / 3) + " minute(s)"); LOG.info("data to read until next header: "+ dataUntilNextHeader +" len: " + (dataUntilNextHeader / 3) + " minute(s)");
LOG.info("TIMESTAMP: " + DateFormat.getDateTimeInstance().format(timestamp.getTime()).toString() + " magic byte: " + dataUntilNextHeader); LOG.info("TIMESTAMP: " + DateFormat.getDateTimeInstance().format(timestamp.getTime()).toString() + " magic byte: " + dataUntilNextHeader);
if (dataUntilNextHeader > 0 ) { //tentative fix for data in the future
this.activityDataRemainingBytes = this.activityDataUntilNextHeader = dataUntilNextHeader; this.activityDataRemainingBytes = this.activityDataUntilNextHeader = dataUntilNextHeader;
this.activityDataTimestampProgress = this.activityDataTimestampToAck = timestamp; this.activityDataTimestampProgress = this.activityDataTimestampToAck = timestamp;
}
} else { } else {
bufferActivityData(value); bufferActivityData(value);