public void setGlucoseStatus( double glocoseValue, double glucoseDelta, double glucoseAvgDelta15m) { mGlucoseStatus.add("delta", glucoseDelta); mGlucoseStatus.add("glucose", glocoseValue); mGlucoseStatus.add("avgdelta", glucoseAvgDelta15m); mGlucoseStatus.add("short_avgdelta", 10.0); mGlucoseStatus.add("long_avgdelta", 10.0); }
public void release() { try { mProfile.release(); mCurrentTemp.release(); mIobData.release(); mGlucoseStatus.release(); mCobData.release(); mV8rt.release(); } catch (Exception e) { log.error("release()", e); } }
public DetermineBasalAdapterJS(ScriptReader scriptReader) throws IOException { mV8rt = V8.createV8Runtime(); mScriptReader = scriptReader; initProfile(); initGlucoseStatus(); initIobData(); initCurrentTemp(); initLogCallback(); initProcessExitCallback(); initModuleParent(); mV8rt.executeVoidScript( readFile("oref0/lib/round-basal.js"), "oref0/lib/determine-basal/round-basal.js", 0); mV8rt.executeVoidScript("var round_basal = module.exports;"); mV8rt.executeVoidScript("require = function() {return round_basal;};"); mV8rt.executeVoidScript( readFile("oref0/lib/basal-set-temp.js"), "oref0/lib/determine-basal/basal-set-temp.js ", 0); mV8rt.executeVoidScript("var tempBasalFunctions = module.exports;"); mCobData = new V8Object(mV8rt); mCobData.add("mealCOB", 0.0); mV8rt.add("meal_data", mCobData); // V8Object autosens_data = new V8Object(mV8rt); // runtime.add("autosens_data", autosens_data); mV8rt.executeVoidScript("autosens_data = undefined"); loadScript(); }
private void initCurrentTemp() { mCurrentTemp = new V8Object(mV8rt); setCurrentTemp(30.0, 0.1); mCurrentTemp.add("temp", "absolute"); mV8rt.add(PARAM_currentTemp, mCurrentTemp); }
private void initProfile() { mProfile = new V8Object(mV8rt); mProfile.add("max_iob", 2.0); mProfile.add("carbs_hr", 28.0); mProfile.add("dia", 4.0); mProfile.add("type", "current"); setProfile_CurrentBasal(1.6); mProfile.add("max_daily_basal", 1.1); setProfile_MaxBasal(2.0); mProfile.add("max_bg", 125); mProfile.add("min_bg", 106); mProfile.add("carbratio", 10); setProfile_Sens(27); mV8rt.add(PARAM_profile, mProfile); }
public void setProfile_MaxBasal(double max_basal) { mProfile.add("max_basal", max_basal); }
public void setProfile_CurrentBasal(double currentBasal) { mProfile.add("current_basal", currentBasal); }
public void setProfile_Sens(int sensitivityInMGDL) { mProfile.add("sens", sensitivityInMGDL); }
public void setIobData(double netIob, double netActivity, double bolusIob) { mIobData.add("iob", netIob); mIobData.add("activity", netActivity); mIobData.add("bolusiob", bolusIob); mIobData.add("bolussnooze", 0.0); }
public void setCurrentTemp(double tempBasalDurationInMinutes, double tempBasalRateAbsolute) { mCurrentTemp.add("duration", tempBasalDurationInMinutes); mCurrentTemp.add("rate", tempBasalRateAbsolute); }
@Override protected void finalize() throws Throwable { super.finalize(); }