- added option for Beep TBR

- added line to DatabaseHelper that can be uncommented in case we make any change tp PodHistory database
- isPumpSuspended evaluates PodSessionState.isSuspended too
This commit is contained in:
Andy Rozman 2019-12-22 12:28:19 +01:00
parent 1dd296ef0e
commit b16e685ecc
7 changed files with 16 additions and 5 deletions

View file

@ -137,6 +137,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
//TableUtils.dropTable(connectionSource, PodHistory.class, true);
TableUtils.createTableIfNotExists(connectionSource, PodHistory.class);
database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " +
"WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\")");

View file

@ -182,6 +182,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
.subscribe(event -> {
if ((event.isChanged(R.string.key_omnipod_beep_basal_enabled)) ||
(event.isChanged(R.string.key_omnipod_beep_bolus_enabled)) ||
(event.isChanged(R.string.key_omnipod_beep_tbr_enabled)) ||
(event.isChanged(R.string.key_omnipod_beep_smb_enabled)))
refreshConfiguration();
}, FabricPrivacy::logException)
@ -355,7 +356,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
@Override
public boolean isSuspended() {
return (pumpStatusLocal != null && !pumpStatusLocal.podAvailable);
return (pumpStatusLocal != null && !pumpStatusLocal.podAvailable) ||
(OmnipodUtil.getPodSessionState()!=null && OmnipodUtil.getPodSessionState().isSuspended());
}
@Override

View file

@ -57,7 +57,7 @@ public class OmnipodPumpStatus extends PumpStatus {
public boolean beepBolusEnabled = true;
public boolean beepBasalEnabled = true;
public boolean beepSMBEnabled = true;
public boolean beepTBREnabled = true;
public OmnipodPumpStatus(PumpDescription pumpDescription) {
super(pumpDescription);
@ -104,8 +104,9 @@ public class OmnipodPumpStatus extends PumpStatus {
this.beepBasalEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepBasalEnabled, true);
this.beepBolusEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepBolusEnabled, true);
this.beepSMBEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepSMBEnabled, true);
this.beepTBREnabled = SP.getBoolean(OmnipodConst.Prefs.BeepTBREnabled, true);
LOG.debug("Beeps [basal={}, bolus={}, SMB={}]", this.beepBasalEnabled, this.beepBolusEnabled, this.beepSMBEnabled);
LOG.debug("Beeps [basal={}, bolus={}, SMB={}, TBR={}]", this.beepBasalEnabled, this.beepBolusEnabled, this.beepSMBEnabled, this.beepTBREnabled);
reconfigureService();

View file

@ -623,8 +623,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
}
private boolean isTempBasalBeepsEnabled() {
// TODO add separate setting for temp basal beeps
return this.pumpStatus.beepBasalEnabled;
return this.pumpStatus.beepTBREnabled;
}
private String getStringResource(int id, Object... args) {

View file

@ -17,6 +17,7 @@ public class OmnipodConst {
public static final int BeepBasalEnabled = R.string.key_omnipod_beep_basal_enabled;
public static final int BeepBolusEnabled = R.string.key_omnipod_beep_bolus_enabled;
public static final int BeepSMBEnabled = R.string.key_omnipod_beep_smb_enabled;
public static final int BeepTBREnabled = R.string.key_omnipod_beep_tbr_enabled;
}
public class Statistics {

View file

@ -1649,9 +1649,11 @@
<string name="key_omnipod_beep_bolus_enabled" translatable="false">pref_omnipod_beep_bolus_enabled</string>
<string name="key_omnipod_beep_basal_enabled" translatable="false">pref_omnipod_beep_basal_enabled</string>
<string name="key_omnipod_beep_smb_enabled" translatable="false">pref_omnipod_beep_smb_enabled</string>
<string name="key_omnipod_beep_tbr_enabled" translatable="false">pref_omnipod_beep_tbr_enabled</string>
<string name="omnipod_config_beep_bolus_enabled">Bolus Beep Enabled</string>
<string name="omnipod_config_beep_basal_enabled">Basal Beep Enabled</string>
<string name="omnipod_config_beep_smb_enabled">SMB Beep Enabled</string>
<string name="omnipod_config_beep_tbr_enabled">TBR Beep Enabled</string>
<!-- Omnipod - Fragment -->
<string name="omnipod_pod_mgmt">Pod Mgmt</string>

View file

@ -26,5 +26,10 @@
android:key="@string/key_omnipod_beep_smb_enabled"
android:title="@string/omnipod_config_beep_smb_enabled" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_omnipod_beep_tbr_enabled"
android:title="@string/omnipod_config_beep_tbr_enabled" />
</PreferenceCategory>
</PreferenceScreen>