NSCv3: mark devicestatus as received

This commit is contained in:
Milos Kozak 2023-02-17 17:52:16 +01:00
parent 0ae21b7a7d
commit 88ade01a63
2 changed files with 6 additions and 5 deletions

View file

@ -101,8 +101,8 @@ class NSDeviceStatusHandler @Inject constructor(
}
}
private fun updatePumpData(NSDeviceStatus: NSDeviceStatus) {
val pump = NSDeviceStatus.pump ?: return
private fun updatePumpData(nsDeviceStatus: NSDeviceStatus) {
val pump = nsDeviceStatus.pump ?: return
val clock = pump.clock?.let { dateUtil.fromISODateString(it) } ?: return
processedDeviceStatusData.pumpData?.let { if (clock < it.clock) return } // take only newer record
@ -134,8 +134,8 @@ class NSDeviceStatusHandler @Inject constructor(
}
}
private fun updateOpenApsData(NSDeviceStatus: NSDeviceStatus) {
NSDeviceStatus.openaps?.suggested?.let {
private fun updateOpenApsData(nsDeviceStatus: NSDeviceStatus) {
nsDeviceStatus.openaps?.suggested?.let {
JsonHelper.safeGetString(it, "timestamp")?.let { timestamp ->
val clock = dateUtil.fromISODateString(timestamp)
// check if this is new data
@ -145,7 +145,7 @@ class NSDeviceStatusHandler @Inject constructor(
}
}
}
NSDeviceStatus.openaps?.enacted?.let {
nsDeviceStatus.openaps?.enacted?.let {
JsonHelper.safeGetString(it, "timestamp")?.let { timestamp ->
val clock = dateUtil.fromISODateString(timestamp)
// check if this is new data

View file

@ -649,6 +649,7 @@ class NSClientV3Plugin @Inject constructor(
result.identifier?.let {
dataPair.value.interfaceIDs.nightscoutId = it
storeDataForDb.nsIdDeviceStatuses.add(dataPair.value)
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true)
}
}
} catch (e: Exception) {