diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index 9e98f219e9..4d2957cee0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -385,6 +385,10 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain @Override public int setNewBasalProfile(Profile profile) { + if (!SP.getBoolean(R.string.key_sync_profile_to_pump, false)) { + return NOT_NEEDED; + } + // Compare with pump limits Profile.BasalValue[] basalValues = profile.getBasalValues(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java index ea4f32e794..35df59b710 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfilePlugin.java @@ -169,55 +169,6 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte createConvertedProfile(); } - public String externallySetParameters(int timeshift, int percentage) { - - String msg = ""; - - if (!fragmentEnabled){ - msg+= "NO CPP!" + "\n"; - } - - //check for validity - if (percentage < Constants.CPP_MIN_PERCENTAGE || percentage > Constants.CPP_MAX_PERCENTAGE) { - msg+= String.format(MainApp.sResources.getString(R.string.openapsma_valueoutofrange), "Profile-Percentage") + "\n"; - } - if (timeshift < 0 || timeshift > 23) { - msg+= String.format(MainApp.sResources.getString(R.string.openapsma_valueoutofrange), "Profile-Timeshift") + "\n"; - } - if(!SP.getBoolean("syncprofiletopump", false)){ - msg+= MainApp.sResources.getString(R.string.syncprofiletopump_title) + " " + MainApp.sResources.getString(R.string.cpp_sync_setting_missing) + "\n"; - } - final PumpInterface pump = MainApp.getConfigBuilder(); - final Profile profile = MainApp.getConfigBuilder().getProfile(); - - if (pump == null || profile == null || profile.getBasal() == null){ - msg+= MainApp.sResources.getString(R.string.cpp_notloadedplugins) + "\n"; - } - if(!"".equals(msg)) { - msg += MainApp.sResources.getString(R.string.cpp_valuesnotstored); - return msg; - } - - //store profile - this.timeshift= timeshift; - this.percentage = percentage; - storeSettings(); - - - //send profile to pumpe - new NewNSTreatmentDialog(); //init - NewNSTreatmentDialog.doProfileSwitch(this.getProfile(), this.getProfileName(), 0, percentage, timeshift); - - //return formatted string - /*msg += "%: " + this.percentage + " h: +" + this.timeshift; - msg += "\n"; - msg += "\nBasal:\n" + basalString() + "\n"; - msg += "\nISF:\n" + isfString() + "\n"; - msg += "\nIC:\n" + isfString() + "\n";*/ - - return msg; - } - public static void migrateToLP(){ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); SharedPreferences.Editor editor = settings.edit(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java index e4fdabecf9..157ecb07ec 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java @@ -120,7 +120,7 @@ public class NSProfilePlugin implements PluginBase, ProfileInterface { storeNSProfile(); MainApp.bus().post(new EventNSProfileUpdateGUI()); PumpInterface pump = MainApp.getConfigBuilder(); - if (SP.getBoolean("syncprofiletopump", false)) { + if (SP.getBoolean(R.string.key_sync_profile_to_pump, false)) { if (pump.setNewBasalProfile(MainApp.getConfigBuilder().getProfile()) == PumpInterface.SUCCESS) { SmsCommunicatorPlugin smsCommunicatorPlugin = MainApp.getSpecificPlugin(SmsCommunicatorPlugin.class); if (smsCommunicatorPlugin != null && smsCommunicatorPlugin.isEnabled(PluginBase.GENERAL)) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index a7b90775f1..83fc112114 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -583,7 +583,7 @@ public class ActionStringHandler { if (timeshift < 0 || timeshift > 23) { msg+= String.format(MainApp.sResources.getString(R.string.openapsma_valueoutofrange), "Profile-Timeshift") + "\n"; } - if(!SP.getBoolean("syncprofiletopump", false)){ + if(!SP.getBoolean(R.string.key_sync_profile_to_pump, false)){ msg+= MainApp.sResources.getString(R.string.syncprofiletopump_title) + " " + MainApp.sResources.getString(R.string.cpp_sync_setting_missing) + "\n"; } final PumpInterface pump = MainApp.getConfigBuilder(); diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java index f993993d97..684cccd7fc 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java +++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java @@ -89,7 +89,7 @@ public class KeepAliveReceiver extends BroadcastReceiver { MainApp.bus().post(new EventNewNotification(n)); } - if (SP.getBoolean("syncprofiletopump", false) && !pump.isThisProfileSet(profile)) { + if (SP.getBoolean(MainApp.sResources.getString(R.string.key_sync_profile_to_pump), false) && !pump.isThisProfileSet(profile)) { Thread t = new Thread(new Runnable() { @Override public void run() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index be718b14fb..5140eb0b56 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -816,5 +816,6 @@ INFO To retrieve the alert history from the pump, long press the Refresh button. To retrieve the TDD history from the pump, long press the Refresh button. + sync_profile_to_pump