2017-05-29 21:45:59 +02:00
|
|
|
package info.nightscout.androidaps.data;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
2018-03-26 13:25:53 +02:00
|
|
|
import com.rits.cloning.Cloner;
|
|
|
|
|
2017-05-29 21:45:59 +02:00
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import info.nightscout.androidaps.db.CareportalEvent;
|
|
|
|
import info.nightscout.androidaps.db.Source;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by mike on 29.05.2017.
|
|
|
|
*/
|
|
|
|
|
2018-02-02 23:59:05 +01:00
|
|
|
public class DetailedBolusInfo {
|
2017-06-15 23:12:12 +02:00
|
|
|
public long date = System.currentTimeMillis();
|
2017-05-29 21:45:59 +02:00
|
|
|
public String eventType = CareportalEvent.MEALBOLUS;
|
|
|
|
public double insulin = 0;
|
|
|
|
public double carbs = 0;
|
|
|
|
public int source = Source.NONE;
|
2017-08-17 20:51:24 +02:00
|
|
|
public boolean isValid = true;
|
2017-05-29 21:45:59 +02:00
|
|
|
public double glucose = 0; // Bg value in current units
|
|
|
|
public String glucoseType = ""; // NS values: Manual, Finger, Sensor
|
|
|
|
public int carbTime = 0; // time shift of carbs in minutes
|
|
|
|
public JSONObject boluscalc = null; // additional bolus wizard info
|
|
|
|
public Context context = null; // context for progress dialog
|
2017-08-06 12:19:25 +02:00
|
|
|
public long pumpId = 0; // id of record if comming from pump history (not a newly created treatment)
|
|
|
|
public boolean isSMB = false; // is a Super-MicroBolus
|
2017-12-10 17:04:22 +01:00
|
|
|
public long deliverAt = 0; // SMB should be delivered within 1 min from this time
|
2018-04-09 22:10:08 +02:00
|
|
|
public String notes = null;
|
2017-10-21 18:55:56 +02:00
|
|
|
|
2018-01-31 13:54:15 +01:00
|
|
|
public DetailedBolusInfo copy() {
|
2018-03-27 20:16:33 +02:00
|
|
|
DetailedBolusInfo n = new DetailedBolusInfo();
|
|
|
|
n.date = date;
|
|
|
|
n.eventType = eventType;
|
|
|
|
n.insulin = insulin;
|
|
|
|
n.carbs = carbs;
|
|
|
|
n.source = source;
|
|
|
|
n.isValid = isValid;
|
|
|
|
n.glucose = glucose;
|
|
|
|
n.glucoseType = glucoseType;
|
|
|
|
n.carbTime = carbTime;
|
|
|
|
n.boluscalc = boluscalc;
|
|
|
|
n.context = context;
|
|
|
|
n.pumpId = pumpId;
|
|
|
|
n.isSMB = isSMB;
|
|
|
|
n.deliverAt = deliverAt;
|
2018-04-09 22:10:08 +02:00
|
|
|
n.notes = notes;
|
2018-03-27 20:16:33 +02:00
|
|
|
return n;
|
2018-01-31 13:54:15 +01:00
|
|
|
}
|
|
|
|
|
2017-10-21 18:55:56 +02:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return new Date(date).toLocaleString() +
|
|
|
|
" insulin: " + insulin +
|
|
|
|
" carbs: " + carbs +
|
|
|
|
" isValid: " + isValid +
|
|
|
|
" carbTime: " + carbTime +
|
2017-12-10 17:04:22 +01:00
|
|
|
" isSMB: " + isSMB +
|
|
|
|
" deliverAt: " + new Date(deliverAt).toLocaleString();
|
2017-10-21 18:55:56 +02:00
|
|
|
}
|
2017-05-29 21:45:59 +02:00
|
|
|
}
|