basic danar description
This commit is contained in:
parent
6ba532d178
commit
3acabd792c
2 changed files with 27 additions and 2 deletions
|
@ -5,8 +5,9 @@ package info.nightscout.androidaps.interfaces;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PumpDescription {
|
public class PumpDescription {
|
||||||
public final int PERCENT = 0;
|
public static final int PERCENT = 0;
|
||||||
public final int ABSOLUTE = 0;
|
public static final int ABSOLUTE = 1;
|
||||||
|
public static final int EXTENDED = 2;
|
||||||
|
|
||||||
public boolean isBolusCapable = true;
|
public boolean isBolusCapable = true;
|
||||||
public double bolusStep = 0.1d;
|
public double bolusStep = 0.1d;
|
||||||
|
|
|
@ -78,6 +78,25 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
Intent intent = new Intent(context, ExecutionService.class);
|
Intent intent = new Intent(context, ExecutionService.class);
|
||||||
context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
|
context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
|
|
||||||
|
pumpDescription.isBolusCapable = true;
|
||||||
|
pumpDescription.bolusStep = 0.05d;
|
||||||
|
|
||||||
|
pumpDescription.isExtendedBolusCapable = true;
|
||||||
|
pumpDescription.extendedBolusStep = 0.1d;
|
||||||
|
|
||||||
|
pumpDescription.isTempBasalCapable = true;
|
||||||
|
pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
|
||||||
|
pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
|
||||||
|
pumpDescription.maxHighTemp = useExtendedBoluses ? 0: 200;
|
||||||
|
pumpDescription.lowTempStep = 10;
|
||||||
|
pumpDescription.highTempStep = useExtendedBoluses ? 0.05d : 10;
|
||||||
|
|
||||||
|
pumpDescription.isSetBasalProfileCapable = true;
|
||||||
|
pumpDescription.basalStep = 0.01d;
|
||||||
|
pumpDescription.basalMinimumRate = 0.04d;
|
||||||
|
|
||||||
|
pumpDescription.isRefillingCapable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceConnection mConnection = new ServiceConnection() {
|
ServiceConnection mConnection = new ServiceConnection() {
|
||||||
|
@ -106,6 +125,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
boolean previousValue = useExtendedBoluses;
|
boolean previousValue = useExtendedBoluses;
|
||||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||||
useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false);
|
useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false);
|
||||||
|
|
||||||
|
pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
|
||||||
|
pumpDescription.maxHighTemp = useExtendedBoluses ? 0: 200;
|
||||||
|
pumpDescription.highTempStep = useExtendedBoluses ? 0.05d : 10;
|
||||||
|
|
||||||
if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) {
|
if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) {
|
||||||
sExecutionService.extendedBolusStop();
|
sExecutionService.extendedBolusStop();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue