Merge remote-tracking branch 'milosremote/dev' into develop
This commit is contained in:
commit
e7249bf72e
|
@ -950,6 +950,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
if (tempBasal.source == Source.NIGHTSCOUT) {
|
if (tempBasal.source == Source.NIGHTSCOUT) {
|
||||||
old = getDaoTemporaryBasal().queryForId(tempBasal.date);
|
old = getDaoTemporaryBasal().queryForId(tempBasal.date);
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
|
if (!old.isAbsolute && tempBasal.isAbsolute) { // converted to absolute by "ns_sync_use_absolute"
|
||||||
|
// so far ignore, do not convert back because it may not be accurate
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!old.isEqual(tempBasal)) {
|
if (!old.isEqual(tempBasal)) {
|
||||||
long oldDate = old.date;
|
long oldDate = old.date;
|
||||||
getDaoTemporaryBasal().delete(old); // need to delete/create because date may change too
|
getDaoTemporaryBasal().delete(old); // need to delete/create because date may change too
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package info.nightscout.androidaps.plugins.ConfigBuilder;
|
||||||
|
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mike on 08.08.2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DetailedBolusInfoStorage {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(DetailedBolusInfoStorage.class);
|
||||||
|
private static List<DetailedBolusInfo> store = new ArrayList<>();
|
||||||
|
|
||||||
|
public static void add(DetailedBolusInfo detailedBolusInfo) {
|
||||||
|
log.debug("Bolus info stored: " + new Date(detailedBolusInfo.date).toLocaleString());
|
||||||
|
store.add(detailedBolusInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static DetailedBolusInfo findDetailedBolusInfo(long bolustime) {
|
||||||
|
DetailedBolusInfo found = null;
|
||||||
|
for (int i = 0; i < store.size(); i++) {
|
||||||
|
long infoTime = store.get(0).date;
|
||||||
|
log.debug("Existing info: " + new Date(infoTime).toLocaleString());
|
||||||
|
if (bolustime > infoTime - 60 * 1000 && bolustime < infoTime + 60 * 1000) {
|
||||||
|
found = store.get(i);
|
||||||
|
store.remove(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
}
|
|
@ -522,6 +522,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static AutosensData getAutosensData(long time) {
|
public static AutosensData getAutosensData(long time) {
|
||||||
|
synchronized (dataLock) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (time > now)
|
if (time > now)
|
||||||
return null;
|
return null;
|
||||||
|
@ -538,6 +539,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static AutosensData getLastAutosensData() {
|
public static AutosensData getLastAutosensData() {
|
||||||
|
|
|
@ -66,6 +66,8 @@ public class DanaRv2Fragment extends SubscriberFragment {
|
||||||
TextView reservoirView;
|
TextView reservoirView;
|
||||||
TextView iobView;
|
TextView iobView;
|
||||||
TextView firmwareView;
|
TextView firmwareView;
|
||||||
|
TextView basalStepView;
|
||||||
|
TextView bolusStepView;
|
||||||
Button viewProfileButton;
|
Button viewProfileButton;
|
||||||
Button historyButton;
|
Button historyButton;
|
||||||
Button statsButton;
|
Button statsButton;
|
||||||
|
@ -112,6 +114,8 @@ public class DanaRv2Fragment extends SubscriberFragment {
|
||||||
viewProfileButton = (Button) view.findViewById(R.id.danar_viewprofile);
|
viewProfileButton = (Button) view.findViewById(R.id.danar_viewprofile);
|
||||||
historyButton = (Button) view.findViewById(R.id.danar_history);
|
historyButton = (Button) view.findViewById(R.id.danar_history);
|
||||||
statsButton = (Button) view.findViewById(R.id.danar_stats);
|
statsButton = (Button) view.findViewById(R.id.danar_stats);
|
||||||
|
basalStepView = (TextView) view.findViewById(R.id.danar_basalstep);
|
||||||
|
bolusStepView = (TextView) view.findViewById(R.id.danar_bolusstep);
|
||||||
|
|
||||||
|
|
||||||
viewProfileButton.setOnClickListener(new View.OnClickListener() {
|
viewProfileButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -236,6 +240,8 @@ public class DanaRv2Fragment extends SubscriberFragment {
|
||||||
} else {
|
} else {
|
||||||
firmwareView.setText("OLD");
|
firmwareView.setText("OLD");
|
||||||
}
|
}
|
||||||
|
basalStepView.setText("" + pump.basalStep);
|
||||||
|
bolusStepView.setText("" + pump.bolusStep);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.ProfileStore;
|
import info.nightscout.androidaps.data.ProfileStore;
|
||||||
|
import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
|
@ -286,6 +287,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||||
detailedBolusInfo.insulin = configBuilderPlugin.applyBolusConstraints(detailedBolusInfo.insulin);
|
detailedBolusInfo.insulin = configBuilderPlugin.applyBolusConstraints(detailedBolusInfo.insulin);
|
||||||
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
|
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
|
||||||
|
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
|
||||||
Treatment t = new Treatment(detailedBolusInfo.insulinInterface);
|
Treatment t = new Treatment(detailedBolusInfo.insulinInterface);
|
||||||
boolean connectionOK = false;
|
boolean connectionOK = false;
|
||||||
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0)
|
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0)
|
||||||
|
@ -297,6 +299,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||||
if (Config.logPumpActions)
|
if (Config.logPumpActions)
|
||||||
log.debug("deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered);
|
log.debug("deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered);
|
||||||
|
// remove carbs because it's get from history seprately
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
|
|
|
@ -11,6 +11,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
import info.nightscout.androidaps.db.ExtendedBolus;
|
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||||
|
import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
|
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
|
||||||
|
|
||||||
|
@ -62,7 +63,15 @@ public class MsgHistoryEvents_v2 extends MessageBase {
|
||||||
extendedBolus.source = Source.PUMP;
|
extendedBolus.source = Source.PUMP;
|
||||||
extendedBolus.pumpId = datetime.getTime();
|
extendedBolus.pumpId = datetime.getTime();
|
||||||
|
|
||||||
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
|
DetailedBolusInfo detailedBolusInfo = DetailedBolusInfoStorage.findDetailedBolusInfo(datetime.getTime());
|
||||||
|
if (detailedBolusInfo == null) {
|
||||||
|
log.debug("DetailedBolusInfo not found for " + datetime.toLocaleString());
|
||||||
|
detailedBolusInfo = new DetailedBolusInfo();
|
||||||
|
} else {
|
||||||
|
log.debug("DetailedBolusInfo found for " + datetime.toLocaleString() + ": " + new Date(detailedBolusInfo.date).toLocaleString());
|
||||||
|
detailedBolusInfo.carbTime = 0;
|
||||||
|
detailedBolusInfo.carbs = 0;
|
||||||
|
}
|
||||||
detailedBolusInfo.date = datetime.getTime();
|
detailedBolusInfo.date = datetime.getTime();
|
||||||
detailedBolusInfo.source = Source.PUMP;
|
detailedBolusInfo.source = Source.PUMP;
|
||||||
detailedBolusInfo.pumpId = datetime.getTime();
|
detailedBolusInfo.pumpId = datetime.getTime();
|
||||||
|
@ -122,7 +131,7 @@ public class MsgHistoryEvents_v2 extends MessageBase {
|
||||||
log.debug("EVENT PRIME (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
|
log.debug("EVENT PRIME (" + recordCode + ") " + datetime.toLocaleString() + " Amount: " + param1 / 100d + "U");
|
||||||
break;
|
break;
|
||||||
case DanaRPump.PROFILECHANGE:
|
case DanaRPump.PROFILECHANGE:
|
||||||
log.debug("EVENT PROFILECHANGE (" + recordCode + ") " + datetime.toLocaleString() + " No: " + param1 + "U CurrentRate: " + param2 + "U/h");
|
log.debug("EVENT PROFILECHANGE (" + recordCode + ") " + datetime.toLocaleString() + " No: " + param1 + " CurrentRate: " + (param2 / 100d) + "U/h");
|
||||||
break;
|
break;
|
||||||
case DanaRPump.CARBS:
|
case DanaRPump.CARBS:
|
||||||
log.debug("EVENT CARBS (" + recordCode + ") " + datetime.toLocaleString() + " Carbs: " + param1 + "g");
|
log.debug("EVENT CARBS (" + recordCode + ") " + datetime.toLocaleString() + " Carbs: " + param1 + "g");
|
||||||
|
|
|
@ -502,6 +502,7 @@ public class DanaRv2ExecutionService extends Service {
|
||||||
|
|
||||||
public boolean loadEvents() {
|
public boolean loadEvents() {
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
waitMsec(300);
|
||||||
MsgHistoryEvents_v2 msg;
|
MsgHistoryEvents_v2 msg;
|
||||||
if (lastHistoryFetched == 0) {
|
if (lastHistoryFetched == 0) {
|
||||||
msg = new MsgHistoryEvents_v2();
|
msg = new MsgHistoryEvents_v2();
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<string name="careportal_newnstreatment_sensor">Sensor</string>
|
<string name="careportal_newnstreatment_sensor">Sensor</string>
|
||||||
<string name="configbuilder_profile">Profil</string>
|
<string name="configbuilder_profile">Profil</string>
|
||||||
<string name="configbuilder_pump">Pumpe</string>
|
<string name="configbuilder_pump">Pumpe</string>
|
||||||
<string name="confirmation">Konfiguration</string>
|
<string name="confirmation">Bestätigung</string>
|
||||||
<string name="days">Tage</string>
|
<string name="days">Tage</string>
|
||||||
<string name="ok">OK</string>
|
<string name="ok">OK</string>
|
||||||
<string name="openapsma_profile_label">Profil</string>
|
<string name="openapsma_profile_label">Profil</string>
|
||||||
|
@ -109,8 +109,8 @@
|
||||||
<string name="treatments_newtreatment_carbsamount_label">Kohlehydrat Menge</string>
|
<string name="treatments_newtreatment_carbsamount_label">Kohlehydrat Menge</string>
|
||||||
<string name="treatments_newtreatment_insulinamount_label">Insulin Menge</string>
|
<string name="treatments_newtreatment_insulinamount_label">Insulin Menge</string>
|
||||||
<string name="treatments">Treatments</string>
|
<string name="treatments">Treatments</string>
|
||||||
<string name="treatmentssafety_maxbolus_title">Max erlaubter Bolus</string>
|
<string name="treatmentssafety_maxbolus_title">Max erlaubter Bolus [U]</string>
|
||||||
<string name="treatmentssafety_maxcarbs_title">Max erlaubte Kohlehydrate</string>
|
<string name="treatmentssafety_maxcarbs_title">Max erlaubte Kohlehydrate [g]</string>
|
||||||
<string name="treatmentssafety_title">Tratments Sicherheit</string>
|
<string name="treatmentssafety_title">Tratments Sicherheit</string>
|
||||||
<string name="simpleprofile">Einfaches Profil</string>
|
<string name="simpleprofile">Einfaches Profil</string>
|
||||||
<string name="setextendedbolusquestion">Setze neuen extended Bolus:</string>
|
<string name="setextendedbolusquestion">Setze neuen extended Bolus:</string>
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
def generateGitBuild = { ->
|
||||||
|
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
stringBuilder.append('"')
|
||||||
|
try {
|
||||||
|
def stdout = new ByteArrayOutputStream()
|
||||||
|
exec {
|
||||||
|
commandLine 'git', 'describe', '--always'
|
||||||
|
standardOutput = stdout
|
||||||
|
}
|
||||||
|
String commitObject = stdout.toString().trim()
|
||||||
|
stringBuilder.append(commitObject)
|
||||||
|
} catch (ignored) {
|
||||||
|
stringBuilder.append('NoGitSystemAvailable')
|
||||||
|
}
|
||||||
|
stringBuilder.append('-')
|
||||||
|
stringBuilder.append((new Date()).format('yyyy.MM.dd'))
|
||||||
|
stringBuilder.append('"')
|
||||||
|
return stringBuilder.toString()
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 23
|
compileSdkVersion 23
|
||||||
|
@ -11,6 +31,7 @@ android {
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0.2"
|
versionName "1.0.2"
|
||||||
|
buildConfigField "String", "BUILDVERSION", generateGitBuild()
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package info.nightscout.androidaps.interaction.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.BuildConfig;
|
||||||
|
import preference.WearListPreference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by adrian on 07/08/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class VersionPreference extends WearListPreference {
|
||||||
|
public VersionPreference(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
entries = new CharSequence[]{BuildConfig.BUILDVERSION};
|
||||||
|
entryValues = new CharSequence[]{BuildConfig.BUILDVERSION};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public CharSequence getSummary(@NonNull final Context context) {
|
||||||
|
return BuildConfig.BUILDVERSION;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onPreferenceClick(@NonNull Context context) {
|
||||||
|
Toast.makeText(context, "Build version:" + BuildConfig.BUILDVERSION, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
|
@ -149,4 +149,11 @@
|
||||||
android:title="Wizard Percentage"
|
android:title="Wizard Percentage"
|
||||||
app:wear_iconOff="@drawable/settings_off"
|
app:wear_iconOff="@drawable/settings_off"
|
||||||
app:wear_iconOn="@drawable/settings_on"/>
|
app:wear_iconOn="@drawable/settings_on"/>
|
||||||
|
<info.nightscout.androidaps.interaction.utils.VersionPreference
|
||||||
|
android:defaultValue="1"
|
||||||
|
android:entries="@array/input_design"
|
||||||
|
android:entryValues="@array/input_design_values"
|
||||||
|
android:key="version_number"
|
||||||
|
android:summary="Input Design"
|
||||||
|
android:title="Version:" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
Loading…
Reference in a new issue