combov2: Update pump status when timezone or DST changes

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
This commit is contained in:
Carlos Rafael Giani 2022-11-28 01:33:03 +01:00
parent b029814de5
commit 4cef189f9a
2 changed files with 14 additions and 2 deletions

View file

@ -1324,9 +1324,17 @@ class ComboV2Plugin @Inject constructor (
override fun canHandleDST() = true
override fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {
// Currently just logging this; the ComboCtl.Pump code will set the new datetime
// (as localtime) as part of the on-connect checks automatically.
aapsLogger.info(LTag.PUMP, "Time, Date and/or TimeZone changed. Time change type = $timeChangeType")
val reason = when (timeChangeType) {
TimeChangeType.TimezoneChanged -> rh.gs(R.string.combov2_timezone_changed)
TimeChangeType.TimeChanged -> rh.gs(R.string.combov2_datetime_changed)
TimeChangeType.DSTStarted -> rh.gs(R.string.combov2_dst_started)
TimeChangeType.DSTEnded -> rh.gs(R.string.combov2_dst_ended)
}
// Updating pump status implicitly also updates the pump's local datetime,
// which is what we want after the system datetime/timezone/DST changed.
commandQueue.readStatus(reason, null)
}
/*** Loop constraints ***/

View file

@ -129,4 +129,8 @@ buttons at the same time to cancel pairing)\n
<string name="combov2_automatic_battery_entry">Autodetect and automatically enter battery change</string>
<string name="combov2_note_reservoir_change">Insulin reservoir change inserted automatically by combov2 driver</string>
<string name="combov2_note_battery_change">Battery change inserted automatically by combov2 driver</string>
<string name="combov2_timezone_changed">Timezone changed</string>
<string name="combov2_datetime_changed">Date and/or time changed</string>
<string name="combov2_dst_started">Daylight savings time (DST) started</string>
<string name="combov2_dst_ended">Daylight savings time (DST) ended</string>
</resources>