Skip to content

Commit 7cecb51

Browse files
committed
Merge branch 'NightscoutFoundation-master'
2 parents 9e703d6 + 9d375bb commit 7cecb51

52 files changed

Lines changed: 564 additions & 115 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/src/main/java/com/eveningoutpost/dexdrip/SystemStatusFragment.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import java.util.Set;
5858

5959
import static com.eveningoutpost.dexdrip.Home.startWatchUpdaterService;
60+
import static com.eveningoutpost.dexdrip.utils.DatabaseUtil.getDataBaseSizeInBytes;
6061
import static com.eveningoutpost.dexdrip.utils.DexCollectionType.DexcomG5;
6162
import static com.eveningoutpost.dexdrip.xdrip.gs;
6263

@@ -80,6 +81,7 @@ public class SystemStatusFragment extends Fragment {
8081
private ActiveBluetoothDevice activeBluetoothDevice;
8182
private static final String TAG = "SystemStatus";
8283
private BroadcastReceiver serviceDataReceiver;
84+
private TextView db_size_view;
8385

8486
//@Inject
8587
MicroStatus microStatus;
@@ -177,6 +179,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
177179
sensor_status_view = (TextView) v.findViewById(R.id.sensor_status);
178180
transmitter_status_view = (TextView) v.findViewById(R.id.transmitter_status);
179181
current_device = (TextView) v.findViewById(R.id.remembered_device);
182+
db_size_view = (TextView) v.findViewById(R.id.db_size);
180183

181184
notes = (TextView) v.findViewById(R.id.other_notes);
182185

@@ -238,6 +241,7 @@ private void set_current_values() {
238241
setTransmitterStatus();
239242
setNotes();
240243
futureDataCheck();
244+
setDbSize();
241245

242246
/* if (notes.getText().length()==0) {
243247
notes.setText("Swipe for more status pages!");
@@ -274,6 +278,18 @@ private void setTransmitterStatus() {
274278

275279
}
276280

281+
private void setDbSize() {
282+
long dbSizeLengthLong = getDataBaseSizeInBytes();
283+
String dbSizeString = "0";
284+
if (dbSizeLengthLong > 0) { // If there is a database
285+
if (dbSizeLengthLong < 31457280) { // When smaller than 30M, round and show one decimal point
286+
dbSizeString = JoH.roundFloat((float) dbSizeLengthLong / (1024 * 1024), 1) + "";
287+
} else { // When greater than 30M, round and just show integer
288+
dbSizeString = (int) (JoH.roundFloat((float) dbSizeLengthLong / (1024 * 1024), 0)) + "";
289+
}
290+
db_size_view.setText(dbSizeString + "M");
291+
}
292+
}
277293

278294
private void setSensorStatus() {
279295
sensor_status_view.setText(SensorStatus.status());
@@ -285,7 +301,7 @@ private void setVersionName() {
285301
try {
286302
versionName = safeGetContext().getPackageManager().getPackageInfo(safeGetContext().getPackageName(), PackageManager.GET_META_DATA).versionName;
287303
int versionNumber = safeGetContext().getPackageManager().getPackageInfo(safeGetContext().getPackageName(), PackageManager.GET_META_DATA).versionCode;
288-
versionName += "\nCode: " + BuildConfig.buildVersion + "\nDowngradable to: " + versionNumber;
304+
versionName += "\nCode: " + BuildConfig.buildVersion;
289305
version_name_view.setText(versionName);
290306
} catch (PackageManager.NameNotFoundException e) {
291307
//e.printStackTrace();

app/src/main/java/com/eveningoutpost/dexdrip/cgm/carelinkfollow/auth/CareLinkAuthenticator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class CareLinkAuthenticator {
7373

7474
private static final String TAG = "CareLinkAuthenticator";
7575

76-
protected static final String CAREPARTNER_APP_DISCO_URL = "https://clcloud.minimed.com/connect/carepartner/v6/discover/android/3.1";
76+
protected static final String CAREPARTNER_APP_DISCO_URL = "https://clcloud.minimed.eu/connect/carepartner/v11/discover/android/3.2";
7777
protected static final String CARELINK_CONNECT_SERVER_EU = "carelink.minimed.eu";
7878
protected static final String CARELINK_CONNECT_SERVER_US = "carelink.minimed.com";
7979
protected static final String CARELINK_LANGUAGE_EN = "en";

app/src/main/java/com/eveningoutpost/dexdrip/evaluators/PersistentHigh.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,30 @@ public class PersistentHigh {
3030

3131
private static final String TAG = PersistentHigh.class.getSimpleName();
3232
private static final String PERSISTENT_HIGH_SINCE = "persistent_high_since";
33+
public static double persistentHighThreshold = Home.convertToMgDlIfMmol(JoH.tolerantParseDouble(Pref.getString("highValue", "170"))); // By default, the persistent High threshold is equal to the High Value
3334

3435
public static boolean checkForPersistentHigh() {
3536

37+
if (!Pref.getBoolean("high_value_is_persistent_high_threshold", true)) { // If the user has chosen not to use the High Value as the threshold
38+
persistentHighThreshold = Home.convertToMgDlIfMmol(JoH.tolerantParseDouble(Pref.getString("persistent_high_threshold", "170"))); // Set the threshold to the value chosen by the user
39+
}
40+
3641
// skip if not enabled
3742
if (!Pref.getBooleanDefaultFalse("persistent_high_alert_enabled")) return false;
3843

3944

4045
final List<BgReading> last = BgReading.latest(1);
4146
if ((last != null) && (last.size() > 0)) {
4247

43-
final double highMarkMgDl = Home.convertToMgDlIfMmol(
44-
JoH.tolerantParseDouble(Pref.getString("highValue", "170"), 170d));
45-
4648
final long now = JoH.tsl();
4749
final long since = now - last.get(0).timestamp;
4850
// only process if last reading <10 mins
4951
if (since < MINUTE_IN_MS * 10) {
50-
// check if exceeding high
51-
if (last.get(0).getDg_mgdl() > highMarkMgDl) {
52+
// check if exceeding persistent high threshold
53+
if (last.get(0).getDg_mgdl() > persistentHighThreshold) {
5254

5355
final double this_slope = last.get(0).getDg_slope() * MINUTE_IN_MS;
54-
Log.d(TAG, "CheckForPersistentHigh: Slope: " + JoH.qs(this_slope)+ " "+JoH.dateTimeText(last.get(0).timestamp));
56+
Log.d(TAG, "CheckForPersistentHigh: Slope: " + JoH.qs(this_slope) + " " + JoH.dateTimeText(last.get(0).timestamp));
5557

5658
// if not falling
5759
if (this_slope > 0 && !last.get(0).hide_slope) {
@@ -78,7 +80,7 @@ public static boolean checkForPersistentHigh() {
7880
return false;
7981
}
8082

81-
if (!dataQualityCheck(high_since, highMarkMgDl)) {
83+
if (!dataQualityCheck(high_since, persistentHighThreshold)) {
8284
Log.d(TAG, "Insufficient data quality to raise persistent high alert");
8385
return false;
8486
}

app/src/main/java/com/eveningoutpost/dexdrip/g5model/FirmwareCapability.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class FirmwareCapability {
1515

1616
private static final ImmutableSet<String> KNOWN_G5_FIRMWARES = ImmutableSet.of("1.0.0.13", "1.0.0.17", "1.0.4.10", "1.0.4.12", "1.0.4.14", "1.0.4.15");
1717
private static final ImmutableSet<String> KNOWN_G6_FIRMWARES = ImmutableSet.of("1.6.5.23", "1.6.5.25", "1.6.5.27");
18-
private static final ImmutableSet<String> KNOWN_G6_REV2_FIRMWARES = ImmutableSet.of("2.18.2.67", "2.18.2.88", "2.18.2.98", "2.24.2.88", "2.27.2.98", "2.27.2.103");
18+
private static final ImmutableSet<String> KNOWN_G6_REV2_FIRMWARES = ImmutableSet.of("2.18.2.67", "2.18.2.88", "2.18.2.98", "2.24.2.88", "2.27.2.98", "2.27.2.103", "2.27.2.105");
1919
private static final ImmutableSet<String> KNOWN_G6_REV2_RAW_FIRMWARES = ImmutableSet.of("2.18.2.67");
2020
private static final ImmutableSet<String> KNOWN_G6_PLUS_FIRMWARES = ImmutableSet.of("2.4.2.88");
2121
private static final ImmutableSet<String> KNOWN_ONE_FIRMWARES = ImmutableSet.of("30.192.103.34");

app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1DexTransmitterBattery.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ public boolean voltageAWarning() {
9595
}
9696

9797
public boolean voltageBWarning() {
98-
if (shortTxId()) { // G7 only
99-
return voltageB() < (G5BaseService.LOW_BATTERY_WARNING_LEVEL - 25);
98+
if (shortTxId()) {
99+
return voltageB() < (G5BaseService.LOW_BATTERY_WARNING_LEVEL - 60);
100100
}
101101
return voltageB() < (G5BaseService.LOW_BATTERY_WARNING_LEVEL - 10);
102102
};

app/src/main/java/com/eveningoutpost/dexdrip/models/BgReading.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.eveningoutpost.dexdrip.models;
22

3+
import static com.eveningoutpost.dexdrip.evaluators.PersistentHigh.persistentHighThreshold;
34
import static com.eveningoutpost.dexdrip.g5model.Ob1G5StateMachine.shortTxId;
45
import static com.eveningoutpost.dexdrip.importedlibraries.dexcom.Dex_Constants.TREND_ARROW_VALUES.NOT_COMPUTABLE;
56
import static com.eveningoutpost.dexdrip.importedlibraries.dexcom.Dex_Constants.TREND_ARROW_VALUES.getTrend;
@@ -1073,6 +1074,10 @@ public BgReading noRawWillBeAvailable() {
10731074
}
10741075

10751076
public BgReading appendSourceInfo(String info) {
1077+
return appendSourceInfo(info, false);
1078+
}
1079+
1080+
public BgReading appendSourceInfo(String info, final boolean autoSave) {
10761081
if ((source_info == null) || (source_info.length() == 0)) {
10771082
source_info = info;
10781083
} else {
@@ -1082,6 +1087,9 @@ public BgReading appendSourceInfo(String info) {
10821087
UserError.Log.e(TAG, "Ignoring duplicate source info " + source_info + " -> " + info);
10831088
}
10841089
}
1090+
if (autoSave) {
1091+
save();
1092+
}
10851093
return this;
10861094
}
10871095

@@ -1328,7 +1336,7 @@ public static void bgReadingInsertFromInt(int value, long timestamp, long margin
13281336
// TODO sanity check data!
13291337

13301338
if ((value <= 0) || (timestamp <= 0)) {
1331-
Log.e(TAG, "Invalid data fed to InsertFromInt");
1339+
Log.e(TAG, "Invalid data fed to InsertFromInt " + value + " " + JoH.dateTimeText(timestamp));
13321340
return;
13331341
}
13341342

@@ -1834,10 +1842,8 @@ public static boolean checkForPersistentHigh() {
18341842
final long since = now - last.get(0).timestamp;
18351843
// only process if last reading <10 mins
18361844
if (since < 600000) {
1837-
// check if exceeding high
1838-
if (last.get(0).calculated_value >
1839-
Home.convertToMgDlIfMmol(
1840-
JoH.tolerantParseDouble(Pref.getString("highValue", "170")))) {
1845+
// check if exceeding persistent high threshold
1846+
if (last.get(0).calculated_value > persistentHighThreshold) {
18411847

18421848
final double this_slope = last.get(0).calculated_value_slope * 60000;
18431849
//Log.d(TAG, "CheckForPersistentHigh: Slope: " + JoH.qs(this_slope));
@@ -2147,7 +2153,7 @@ public static Long getUnclearTime(Long interstingTime) {
21472153
public static Long getTimeSinceLastReading() {
21482154
BgReading bgReading = BgReading.last();
21492155
if (bgReading != null) {
2150-
return (new Date().getTime() - bgReading.timestamp);
2156+
return (new Date().getTime() - bgReading.timestamp); // TODO should be tsl
21512157
}
21522158
return (long) 0;
21532159
}

app/src/main/java/com/eveningoutpost/dexdrip/services/UiBasedCollector.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,16 @@ public class UiBasedCollector extends NotificationListenerService {
7575
static {
7676
coOptedPackages.add("com.dexcom.g6");
7777
coOptedPackages.add("com.dexcom.g6.region1.mmol");
78+
coOptedPackages.add("com.dexcom.g6.region2.mgdl");
7879
coOptedPackages.add("com.dexcom.g6.region3.mgdl");
80+
coOptedPackages.add("com.dexcom.g6.region4.mmol");
81+
coOptedPackages.add("com.dexcom.g6.region5.mmol");
82+
coOptedPackages.add("com.dexcom.g6.region6.mgdl");
83+
coOptedPackages.add("com.dexcom.g6.region7.mmol");
84+
coOptedPackages.add("com.dexcom.g6.region8.mmol");
85+
coOptedPackages.add("com.dexcom.g6.region9.mgdl");
86+
coOptedPackages.add("com.dexcom.g6.region10.mgdl");
87+
coOptedPackages.add("com.dexcom.g6.region11.mmol");
7988
coOptedPackages.add("com.dexcom.dexcomone");
8089
coOptedPackages.add("com.dexcom.stelo");
8190
coOptedPackages.add("com.dexcom.g7");
@@ -92,7 +101,10 @@ public class UiBasedCollector extends NotificationListenerService {
92101
coOptedPackages.add("com.medtronic.diabetes.simplera.eu");
93102
coOptedPackages.add("com.senseonics.gen12androidapp");
94103
coOptedPackages.add("com.senseonics.androidapp");
95-
coOptedPackages.add("com.microtech.aidexx.mgdl"); // Experiment
104+
coOptedPackages.add("com.microtech.aidexx.mgdl");
105+
coOptedPackages.add("com.ottai.seas"); // Experiment
106+
coOptedPackages.add("com.microtech.aidexx"); //for microtech china version
107+
coOptedPackages.add("com.ottai.tag"); // //for ottai china version
96108

97109
coOptedPackagesAll.add("com.dexcom.dexcomone");
98110
coOptedPackagesAll.add("com.dexcom.d1plus");
@@ -101,7 +113,10 @@ public class UiBasedCollector extends NotificationListenerService {
101113
coOptedPackagesAll.add("com.medtronic.diabetes.simplera.eu");
102114
coOptedPackagesAll.add("com.senseonics.gen12androidapp");
103115
coOptedPackagesAll.add("com.senseonics.androidapp");
104-
coOptedPackagesAll.add("com.microtech.aidexx.mgdl"); // Experiment
116+
coOptedPackagesAll.add("com.microtech.aidexx.mgdl");
117+
coOptedPackagesAll.add("com.ottai.seas"); // Experiment
118+
coOptedPackagesAll.add("com.microtech.aidexx"); //for microtech china version
119+
coOptedPackagesAll.add("com.ottai.tag"); // //for ottai china version
105120

106121
companionAppIoBPackages.add("com.insulet.myblue.pdm");
107122

app/src/main/java/com/eveningoutpost/dexdrip/tidepool/UploadChunk.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static String getNext(final Session session) {
5353

5454
public static String get(final long start, final long end) {
5555

56-
UserError.Log.uel(TAG, "Syncing data between: " + dateTimeText(start) + " -> " + dateTimeText(end));
56+
UserError.Log.d(TAG, "Syncing data between: " + dateTimeText(start) + " -> " + dateTimeText(end));
5757
if (end <= start) {
5858
UserError.Log.e(TAG, "End is <= start: " + dateTimeText(start) + " " + dateTimeText(end));
5959
return null;

app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class Constants {
6161
public static final int ZXING_CAM_REQ_CODE = 49374;
6262
public static final int ZXING_FILE_REQ_CODE = 49375; // This is created by just incrementing the existing camera scan code from the zxing package
6363
public static final int SENSORY_EXPIRY_NOTIFICATION_ID = 2003;
64+
public static final int OUT_OF_RANGE_GLUCOSE_ENTRY_ID = 2004; // Preference setting out of range
6465

6566

6667
// increments from this start number

app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/IdempotentMigrations.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.eveningoutpost.dexdrip.utilitymodels;
22

3+
import static com.eveningoutpost.dexdrip.utils.Preferences.MAX_GLUCOSE_INPUT;
4+
import static com.eveningoutpost.dexdrip.utils.Preferences.MIN_GLUCOSE_INPUT;
5+
36
import android.content.Context;
47
import android.content.SharedPreferences;
58
import android.net.Uri;
@@ -20,6 +23,7 @@
2023
import com.eveningoutpost.dexdrip.models.UserNotification;
2124
import com.eveningoutpost.dexdrip.R;
2225
import com.eveningoutpost.dexdrip.SnoozeActivity;
26+
import com.eveningoutpost.dexdrip.utils.Preferences;
2327

2428
import java.util.ArrayList;
2529
import java.util.Iterator;
@@ -60,6 +64,7 @@ public void performAll() {
6064
IncompatibleApps.notifyAboutIncompatibleApps();
6165
CompatibleApps.notifyAboutCompatibleApps();
6266
legacySettingsMoveLanguageFromNoToNb();
67+
prefSettingRangeVerification();
6368

6469
}
6570

@@ -160,4 +165,11 @@ private static void legacySettingsMoveLanguageFromNoToNb() {
160165
Pref.setString("forced_language", "nb");
161166
}
162167
}
168+
169+
// Correct preference setting values if the values are out of range.
170+
// Include new preference settings here that represent glucose values.
171+
private static void prefSettingRangeVerification() {
172+
Preferences.applyPrefSettingRange("persistent_high_threshold", "170", MIN_GLUCOSE_INPUT, MAX_GLUCOSE_INPUT);
173+
}
174+
163175
}

0 commit comments

Comments
 (0)