Skip to content

Commit

Permalink
Merge branch 'hotfix/gapsync'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Calabrese committed Nov 9, 2014
2 parents 4845701 + 073a641 commit 70714a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nightscout.android"
android:versionCode="13"
android:versionName="0.1.7">
android:versionCode="14"
android:versionName="0.1.8">

<uses-feature android:name="android.hardware.usb.host" />

Expand Down
11 changes: 7 additions & 4 deletions app/src/main/java/com/nightscout/android/dexcom/ReadData.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public EGVRecord[] getRecentEGVsPages(int numOfRecentPages) {
Log.d(TAG, "Reading " + numOfRecentPages + " EGV page(s)...");
numOfRecentPages = numOfRecentPages - 1;
EGVRecord[] allPages = new EGVRecord[0];
for (int i = numOfRecentPages; i >= 0; i--) {
for (int i = Math.min(numOfRecentPages,endPage); i >= 0; i--) {
int nextPage = endPage - i;
Log.d(TAG, "Read number " + i + " of EGV pages (page number " + nextPage + ")");
Log.d(TAG, "Reading #" + i + " EGV pages (page number " + nextPage + ")");
EGVRecord[] ithEGVRecordPage = readDataBasePage(recordType, nextPage);
EGVRecord[] result = Arrays.copyOf(allPages, allPages.length + ithEGVRecordPage.length);
System.arraycopy(ithEGVRecordPage, 0, result, allPages.length, ithEGVRecordPage.length);
Expand Down Expand Up @@ -77,9 +77,9 @@ public SensorRecord[] getRecentSensorRecords(int numOfRecentPages) {
Log.d(TAG, "Reading " + numOfRecentPages + " Sensor page(s)...");
numOfRecentPages = numOfRecentPages - 1;
SensorRecord[] allPages = new SensorRecord[0];
for (int i = numOfRecentPages; i >= 0; i--) {
for (int i = Math.min(numOfRecentPages,endPage); i >= 0; i--) {
int nextPage = endPage - i;
Log.d(TAG, "Read number " + i + " of Sensor pages (page number " + nextPage + ")");
Log.d(TAG, "Reading #" + i + " Sensor pages (page number " + nextPage + ")");
SensorRecord[] ithSensorRecordPage = readDataBasePage(recordType, nextPage);
SensorRecord[] result = Arrays.copyOf(allPages, allPages.length + ithSensorRecordPage.length);
System.arraycopy(ithSensorRecordPage, 0, result, allPages.length, ithSensorRecordPage.length);
Expand Down Expand Up @@ -144,6 +144,9 @@ private int readDataBasePageRange(int recordType) {

private <T> T readDataBasePage(int recordType, int page) {
byte numOfPages = 1;
if (page < 0){
throw new IllegalArgumentException("Invalid page requested:" + page);
}
ArrayList<Byte> payload = new ArrayList<Byte>();
payload.add((byte) recordType);
byte[] pageInt = ByteBuffer.allocate(4).putInt(page).array();
Expand Down

0 comments on commit 70714a2

Please sign in to comment.