Combo: use PrivacyFabric to align with dev.
This commit is contained in:
parent
30d522e1a8
commit
6bebb30da0
2 changed files with 28 additions and 26 deletions
|
@ -52,6 +52,7 @@ import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.PumpHi
|
|||
import info.nightscout.androidaps.queue.Callback;
|
||||
import info.nightscout.androidaps.queue.CommandQueue;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.FabricPrivacy;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
|
@ -585,7 +586,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
}
|
||||
if (waitLoops > 0) {
|
||||
long waitDuration = (System.currentTimeMillis() - waitStartTime) / 1000;
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboBolusTimestampWait")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusTimestampWait")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("waitTimeSecs", String.valueOf(waitDuration)));
|
||||
|
@ -690,7 +691,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_error_updating_treatment_record), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
}
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboBolusToDbError")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusToDbError")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("bolus", String.valueOf(lastPumpBolus.amount))
|
||||
|
@ -702,7 +703,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
if (dbi.isSMB) {
|
||||
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.gs(R.string.combo_error_updating_treatment_record), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboBolusToDbError")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusToDbError")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("bolus", String.valueOf(lastPumpBolus.amount))
|
||||
|
@ -1085,7 +1086,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
TemporaryBasal aapsTbr = MainApp.getConfigBuilder().getTempBasalFromHistory(now);
|
||||
if (aapsTbr == null && state.tbrActive && state.tbrRemainingDuration > 2) {
|
||||
log.debug("Creating temp basal from pump TBR");
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("type", "new TBR on pump"));
|
||||
|
@ -1098,7 +1099,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
MainApp.getConfigBuilder().addToHistoryTempBasal(newTempBasal);
|
||||
} else if (aapsTbr != null && aapsTbr.getPlannedRemainingMinutes() > 2 && !state.tbrActive) {
|
||||
log.debug("Ending AAPS-TBR since pump has no TBR active");
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("type", "TBR cancelled on pump"));
|
||||
|
@ -1111,7 +1112,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
&& (aapsTbr.percentRate != state.tbrPercent ||
|
||||
Math.abs(aapsTbr.getPlannedRemainingMinutes() - state.tbrRemainingDuration) > 2)) {
|
||||
log.debug("AAPSs and pump-TBR differ; ending AAPS-TBR and creating new TBR based on pump TBR");
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboTbrMismatch")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("type", "TBR on pump differs from AAPS TBR"));
|
||||
|
@ -1286,7 +1287,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
HashSet<Bolus> bolusSet = new HashSet<>(historyResult.history.bolusHistory);
|
||||
if (bolusSet.size() != historyResult.history.bolusHistory.size()) {
|
||||
log.debug("Bolus with same amount within the same minute imported. Only one will make it to the DB.");
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboBolusToDbError")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusToDbError")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("bolus", "")
|
||||
|
|
|
@ -41,6 +41,7 @@ import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.commands.ReadP
|
|||
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.commands.SetBasalProfileCommand;
|
||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.commands.SetTbrCommand;
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.utils.FabricPrivacy;
|
||||
|
||||
/**
|
||||
* Provides scripting 'runtime' and operations. consider moving operations into a separate
|
||||
|
@ -75,13 +76,13 @@ public class RuffyScripter implements RuffyCommands {
|
|||
public void fail(String message) throws RemoteException {
|
||||
log.warn("Ruffy warns: " + message);
|
||||
if (message.startsWith("no connection possible"))
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", "no connection possible"));
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", "no connection possible"));
|
||||
else if (message.startsWith("Error sending keep alive while rtModeRunning is still true"))
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", "Error sending keep alive while rtModeRunning is still true"));
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", "Error sending keep alive while rtModeRunning is still true"));
|
||||
else if (message.startsWith("Error sending keep alive. rtModeRunning is false, so this is most likely a race condition during disconnect"))
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", "Error sending keep alive. rtModeRunning is false, so this is most likely a race condition during disconnect"));
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", "Error sending keep alive. rtModeRunning is false, so this is most likely a race condition during disconnect"));
|
||||
else
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", message.substring(0, 98)));
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRuffyWarning").putCustomAttribute("message", message.substring(0, 98)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -171,7 +172,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
if (!boundSucceeded) {
|
||||
log.error("No connection to ruffy. Pump control unavailable.");
|
||||
} else {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboScripterInit")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboScripterInit")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION));
|
||||
}
|
||||
|
@ -224,7 +225,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
|
||||
@Override
|
||||
public CommandResult readQuickInfo(int numberOfBolusRecordsToRetrieve) {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboReadQuickInfoCmd")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboReadQuickInfoCmd")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION));
|
||||
return runCommand(new ReadQuickInfoCommand(numberOfBolusRecordsToRetrieve));
|
||||
|
@ -425,7 +426,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
}
|
||||
}
|
||||
log.debug("Recovery from connection loss " + (connected ? "succeeded" : "failed"));
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboRecoveryFromConnectionLoss")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRecoveryFromConnectionLoss")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : ""))
|
||||
|
@ -440,7 +441,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
private PumpState recoverFromCommandFailure() {
|
||||
Menu menu = this.currentMenu;
|
||||
if (menu == null) {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : ""))
|
||||
|
@ -459,7 +460,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
}
|
||||
try {
|
||||
PumpState pumpState = readPumpStateInternal();
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : ""))
|
||||
|
@ -467,7 +468,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
.putCustomAttribute("success", "true"));
|
||||
return pumpState;
|
||||
} catch (Exception e) {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("exit", "3")
|
||||
|
@ -495,7 +496,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
long initialUpdateTime = menuLastUpdated;
|
||||
while (initialUpdateTime == menuLastUpdated) {
|
||||
if (System.currentTimeMillis() > timeoutExpired) {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboConnectTimeout")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboConnectTimeout")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION)
|
||||
.putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : ""))
|
||||
|
@ -808,7 +809,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
|
||||
@Override
|
||||
public CommandResult deliverBolus(double amount, BolusProgressReporter bolusProgressReporter) {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboBolusCmd")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusCmd")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION));
|
||||
return runCommand(new BolusCommand(amount, bolusProgressReporter));
|
||||
|
@ -817,7 +818,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
@Override
|
||||
public void cancelBolus() {
|
||||
if (activeCmd instanceof BolusCommand) {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboBolusCmdCancel")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboBolusCmdCancel")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION));
|
||||
((BolusCommand) activeCmd).requestCancellation();
|
||||
|
@ -828,7 +829,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
|
||||
@Override
|
||||
public CommandResult setTbr(int percent, int duration) {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboSetTbrCmd")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboSetTbrCmd")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION));
|
||||
return runCommand(new SetTbrCommand(percent, duration));
|
||||
|
@ -836,7 +837,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
|
||||
@Override
|
||||
public CommandResult cancelTbr() {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboCancelTbrCmd")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboCancelTbrCmd")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION));
|
||||
return runCommand(new CancelTbrCommand());
|
||||
|
@ -844,7 +845,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
|
||||
@Override
|
||||
public CommandResult confirmAlert(int warningCode) {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboConfirmAlertCmd")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboConfirmAlertCmd")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION));
|
||||
return runCommand(new ConfirmAlertCommand(warningCode));
|
||||
|
@ -852,7 +853,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
|
||||
@Override
|
||||
public CommandResult readHistory(PumpHistoryRequest request) {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboReadHistoryCmd")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboReadHistoryCmd")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION));
|
||||
return runCommand(new ReadHistoryCommand(request));
|
||||
|
@ -860,7 +861,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
|
||||
@Override
|
||||
public CommandResult readBasalProfile() {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboReadBasalProfileCmd")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboReadBasalProfileCmd")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION));
|
||||
return runCommand(new ReadBasalProfileCommand());
|
||||
|
@ -868,7 +869,7 @@ public class RuffyScripter implements RuffyCommands {
|
|||
|
||||
@Override
|
||||
public CommandResult setBasalProfile(BasalProfile basalProfile) {
|
||||
Answers.getInstance().logCustom(new CustomEvent("ComboSetBasalProfileCmd")
|
||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("ComboSetBasalProfileCmd")
|
||||
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
|
||||
.putCustomAttribute("version", BuildConfig.VERSION));
|
||||
return runCommand(new SetBasalProfileCommand(basalProfile));
|
||||
|
|
Loading…
Reference in a new issue