diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/CircadianPercentageProfile/CircadianPercentageProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/CircadianPercentageProfile/CircadianPercentageProfilePlugin.java index 03598d10f2..274e1a941d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/CircadianPercentageProfile/CircadianPercentageProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/CircadianPercentageProfile/CircadianPercentageProfilePlugin.java @@ -265,7 +265,7 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte if (percentage < MIN_PERCENTAGE || percentage > MAX_PERCENTAGE){ String msg = String.format(MainApp.sResources.getString(R.string.openapsma_valueoutofrange), "Profile-Percentage"); log.error(msg); - OpenAPSMAPlugin.sendErrorToNSClient(msg); + MainApp.getConfigBuilder().uploadError(msg); ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), msg, R.raw.error); percentage = Math.max(percentage, MIN_PERCENTAGE); percentage = Math.min(percentage, MAX_PERCENTAGE); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java index 6f65489e7e..138fae369f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java @@ -235,7 +235,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface { if (value < lowLimit || value > highLimit) { String msg = String.format(MainApp.sResources.getString(R.string.openapsma_valueoutofrange), valueName); log.error(msg); - sendErrorToNSClient(msg); + MainApp.getConfigBuilder().uploadError(msg); ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), msg, R.raw.error); value = Math.max(value, lowLimit); value = Math.min(value, highLimit); @@ -243,26 +243,4 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface { return value; } - public static void sendErrorToNSClient(String error) { - Context context = MainApp.instance().getApplicationContext(); - Bundle bundle = new Bundle(); - bundle.putString("action", "dbAdd"); - bundle.putString("collection", "treatments"); - JSONObject data = new JSONObject(); - try { - data.put("eventType", "Announcement"); - data.put("created_at", DateUtil.toISOString(new Date())); - data.put("notes", error); - data.put("isAnnouncement", true); - } catch (JSONException e) { - e.printStackTrace(); - } - bundle.putString("data", data.toString()); - Intent intent = new Intent(Intents.ACTION_DATABASE); - intent.putExtras(bundle); - intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); - DbLogger.dbAdd(intent, data.toString(), OpenAPSMAPlugin.class); - } - } diff --git a/wear/wear.iml b/wear/wear.iml index 358c117e0f..40a96e0eab 100644 --- a/wear/wear.iml +++ b/wear/wear.iml @@ -123,6 +123,8 @@ + + @@ -131,11 +133,13 @@ + +