rhino first parameter passing

This commit is contained in:
AdrianLxM 2017-10-15 03:50:18 +02:00
parent 81b611ad92
commit 303d35118e
2 changed files with 11 additions and 2 deletions

View file

@ -17,7 +17,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
};
rT.error ='Error: could not get current basal rate';
return setTempBasal(0, 30, profile, rT, offline);
return setTempBasal(glucose_status.athing, 30, profile, rT, offline);
if (typeof profile === 'undefined' || typeof profile.current_basal === 'undefined') {
rT.error ='Error: could not get current basal rate';

View file

@ -8,8 +8,10 @@ import com.j256.ormlite.logger.Log;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.javascript.Callable;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Function;
import org.mozilla.javascript.NativeJSON;
import org.mozilla.javascript.NativeObject;
import org.mozilla.javascript.Scriptable;
import org.slf4j.Logger;
@ -101,8 +103,15 @@ public class DetermineBasalAdapterMAJS {
// Call the function with params
Object param1 = NativeJSON.parse(rhino, scope, "{\"athing\": 2.3}", new Callable() {
@Override
public Object call(Context context, Scriptable scriptable, Scriptable scriptable1, Object[] objects) {
return objects[1];
}
});
Object[] params = {
"undefined",
param1,
"undefined",
"undefined",
"undefined",