diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.java index c2e6b45098..8f5dcb7b9f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.java @@ -201,6 +201,7 @@ public class AutomationPlugin extends PluginBase { } }); } + event.getTrigger().executed(DateUtil.now()); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.java index 876db6099c..644eb4226d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/Trigger.java @@ -89,6 +89,7 @@ public abstract class Trigger { public abstract boolean shouldRun(); + public abstract String toJSON(); /*package*/ abstract Trigger fromJSON(String data); @@ -99,8 +100,7 @@ public abstract class Trigger { public abstract Optional icon(); - void notifyAboutRun(long time) { - } + public abstract void executed(long time); public abstract Trigger duplicate(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBg.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBg.java index cd3217b414..df695d754d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBg.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBg.java @@ -131,6 +131,10 @@ public class TriggerBg extends Trigger { return Optional.of(R.drawable.icon_cp_bgcheck); } + @Override + public void executed(long time) { + } + @Override public Trigger duplicate() { return new TriggerBg(this); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.java index 28ee9b0705..9c77d8e6c4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.java @@ -192,6 +192,13 @@ public class TriggerConnector extends Trigger { return Optional.absent(); } + @Override + public void executed(long time) { + for (int i = 0; i < list.size(); ++i) { + list.get(i).executed(time); + } + } + @Override public Trigger duplicate() { return null; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerRecurringTime.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerRecurringTime.java index 2cdd57bf3d..5d9cbc9a3b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerRecurringTime.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerRecurringTime.java @@ -214,7 +214,7 @@ public class TriggerRecurringTime extends Trigger { } @Override - void notifyAboutRun(long time) { + public void executed(long time) { lastRun = time; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTime.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTime.java index 73950e694e..bbf30eab0d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTime.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTime.java @@ -90,7 +90,7 @@ public class TriggerTime extends Trigger { } @Override - void notifyAboutRun(long time) { + public void executed(long time) { lastRun = time; } @@ -104,7 +104,7 @@ public class TriggerTime extends Trigger { return new TriggerTime(this); } - public long getRunAt() { + long getRunAt() { return runAt; }