extract MealData
This commit is contained in:
parent
e585ab4030
commit
ebb3e90587
8 changed files with 21 additions and 47 deletions
|
@ -0,0 +1,10 @@
|
|||
package info.nightscout.androidaps.data;
|
||||
|
||||
/**
|
||||
* Created by mike on 04.01.2017.
|
||||
*/
|
||||
public class MealData {
|
||||
public double boluses = 0d;
|
||||
public double carbs = 0d;
|
||||
public double mealCOB = 0.0d; // TODO: add calculation for AMA
|
||||
}
|
|
@ -2,9 +2,9 @@ package info.nightscout.androidaps.interfaces;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.data.MealData;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
|
||||
/**
|
||||
* Created by mike on 14.06.2016.
|
||||
|
@ -13,6 +13,6 @@ public interface TreatmentsInterface {
|
|||
|
||||
void updateTotalIOB();
|
||||
IobTotal getLastCalculation();
|
||||
TreatmentsPlugin.MealData getMealData();
|
||||
MealData getMealData();
|
||||
List<Treatment> getTreatments();
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ import java.io.IOException;
|
|||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
import info.nightscout.androidaps.data.MealData;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.Loop.ScriptReader;
|
||||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
|
||||
public class DetermineBasalAdapterAMAJS {
|
||||
|
@ -246,7 +246,7 @@ public class DetermineBasalAdapterAMAJS {
|
|||
PumpInterface pump,
|
||||
IobTotal iobData,
|
||||
GlucoseStatus glucoseStatus,
|
||||
TreatmentsPlugin.MealData mealData,
|
||||
MealData mealData,
|
||||
JSONObject autosensData) {
|
||||
|
||||
String units = profile.getUnits();
|
||||
|
|
|
@ -53,37 +53,6 @@ public class DetermineBasalResultAMA extends APSResult {
|
|||
result.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeString(json.toString());
|
||||
dest.writeDouble(eventualBG);
|
||||
dest.writeDouble(snoozeBG);
|
||||
dest.writeString(mealAssist);
|
||||
}
|
||||
|
||||
public final Parcelable.Creator<DetermineBasalResultAMA> CREATOR = new Parcelable.Creator<DetermineBasalResultAMA>() {
|
||||
public DetermineBasalResultAMA createFromParcel(Parcel in) {
|
||||
return new DetermineBasalResultAMA(in);
|
||||
}
|
||||
|
||||
public DetermineBasalResultAMA[] newArray(int size) {
|
||||
return new DetermineBasalResultAMA[size];
|
||||
}
|
||||
};
|
||||
|
||||
private DetermineBasalResultAMA(Parcel in) {
|
||||
super(in);
|
||||
try {
|
||||
json = new JSONObject(in.readString());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
eventualBG = in.readDouble();
|
||||
snoozeBG = in.readDouble();
|
||||
mealAssist = in.readString();
|
||||
}
|
||||
|
||||
public DetermineBasalResultAMA() {
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.Constants;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
import info.nightscout.androidaps.data.MealData;
|
||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
|
@ -25,7 +26,6 @@ import info.nightscout.androidaps.plugins.Loop.ScriptReader;
|
|||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.Round;
|
||||
|
@ -171,7 +171,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
|||
|
||||
IobTotal iobTotal = IobTotal.combine(bolusIob, basalIob).round();
|
||||
|
||||
TreatmentsPlugin.MealData mealData = treatments.getMealData();
|
||||
MealData mealData = treatments.getMealData();
|
||||
|
||||
maxIob = MainApp.getConfigBuilder().applyMaxIOBConstraints(maxIob);
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ import java.io.IOException;
|
|||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.data.MealData;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.Loop.ScriptReader;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
|
||||
public class DetermineBasalAdapterMAJS {
|
||||
|
@ -225,7 +225,7 @@ public class DetermineBasalAdapterMAJS {
|
|||
PumpInterface pump,
|
||||
IobTotal iobData,
|
||||
GlucoseStatus glucoseStatus,
|
||||
TreatmentsPlugin.MealData mealData) {
|
||||
MealData mealData) {
|
||||
|
||||
String units = profile.getUnits();
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.data.MealData;
|
||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
|
@ -25,7 +26,6 @@ import info.nightscout.androidaps.plugins.Loop.APSResult;
|
|||
import info.nightscout.androidaps.plugins.Loop.ScriptReader;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.Round;
|
||||
|
@ -171,7 +171,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
|
||||
IobTotal iobTotal = IobTotal.combine(bolusIob, basalIob).round();
|
||||
|
||||
TreatmentsPlugin.MealData mealData = treatments.getMealData();
|
||||
MealData mealData = treatments.getMealData();
|
||||
|
||||
maxIob = MainApp.getConfigBuilder().applyMaxIOBConstraints(maxIob);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Iob;
|
||||
import info.nightscout.androidaps.data.MealData;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
|
@ -138,12 +139,6 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
lastCalculation = total;
|
||||
}
|
||||
|
||||
public class MealData {
|
||||
public double boluses = 0d;
|
||||
public double carbs = 0d;
|
||||
public double mealCOB = 0.0d; // TODO: add calculation for AMA
|
||||
}
|
||||
|
||||
@Override
|
||||
public MealData getMealData() {
|
||||
MealData result = new MealData();
|
||||
|
|
Loading…
Reference in a new issue