Skip to content

Commit

Permalink
MockDataSource: add support for pre-calibration
Browse files Browse the repository at this point in the history
  • Loading branch information
jamorham committed Jul 8, 2023
1 parent 65efe87 commit a7e9aa1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1970,7 +1970,13 @@ public static boolean usingNativeMode() {
}

public static boolean onlyUsingNativeMode() {
return usingNativeMode() && !fallbackToXdripAlgorithm();
return (usingNativeMode() && !fallbackToXdripAlgorithm())
|| usingMockPreCalibrated();
}

public static boolean usingMockPreCalibrated() {
return Pref.getBooleanDefaultFalse("fake_data_pre_calibrated")
&& DexCollectionType.getDexCollectionType() == DexCollectionType.Mock;
}

public static boolean isProvidingNativeGlucoseData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ private static List<TransmitterRawData> readFake() {
trd.CaptureDateTime = System.currentTimeMillis() - trd.RelativeTime;
final List<TransmitterRawData> l = new ArrayList<>();
l.add(trd);
if (Ob1G5CollectionService.usingMockPreCalibrated()) {
BgReading.bgReadingInsertFromG5(trd.RawValue / 1000.0, trd.getCaptureDateTime(), "Mock");
}
return l;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public static void processVoiceCommand(final String allWords, final Activity mAc
Pref.setString(DexCollectionType.DEX_COLLECTION_METHOD, DexCollectionType.Mock.toString());
JoH.static_toast_long("YOU ARE NOW USING FAKE DATA!!!");
MockDataSource.defaults();
CollectionServiceStarter.restartCollectionServiceBackground();
} else if (get_engineering_mode() && allWords.equals("fake data source automatic calibration")) {
Pref.setBoolean("fake_data_pre_calibrated", true);
JoH.static_toast_long("Fake data pre-calibration ON");
} else if (get_engineering_mode() && allWords.equals("fake data source manual calibration")) {
Pref.setBoolean("fake_data_pre_calibrated", false);
JoH.static_toast_long("Fake data pre-calibration OFF");
} else if (get_engineering_mode() && allWords.equals("break fake data source")) {
JoH.static_toast_long("Breaking fake data source");
MockDataSource.breakRaw();
Expand Down

0 comments on commit a7e9aa1

Please sign in to comment.