NSCv3: mark devicestatus as received
This commit is contained in:
parent
0ae21b7a7d
commit
88ade01a63
2 changed files with 6 additions and 5 deletions
|
@ -101,8 +101,8 @@ class NSDeviceStatusHandler @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePumpData(NSDeviceStatus: NSDeviceStatus) {
|
private fun updatePumpData(nsDeviceStatus: NSDeviceStatus) {
|
||||||
val pump = NSDeviceStatus.pump ?: return
|
val pump = nsDeviceStatus.pump ?: return
|
||||||
val clock = pump.clock?.let { dateUtil.fromISODateString(it) } ?: return
|
val clock = pump.clock?.let { dateUtil.fromISODateString(it) } ?: return
|
||||||
processedDeviceStatusData.pumpData?.let { if (clock < it.clock) return } // take only newer record
|
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) {
|
private fun updateOpenApsData(nsDeviceStatus: NSDeviceStatus) {
|
||||||
NSDeviceStatus.openaps?.suggested?.let {
|
nsDeviceStatus.openaps?.suggested?.let {
|
||||||
JsonHelper.safeGetString(it, "timestamp")?.let { timestamp ->
|
JsonHelper.safeGetString(it, "timestamp")?.let { timestamp ->
|
||||||
val clock = dateUtil.fromISODateString(timestamp)
|
val clock = dateUtil.fromISODateString(timestamp)
|
||||||
// check if this is new data
|
// 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 ->
|
JsonHelper.safeGetString(it, "timestamp")?.let { timestamp ->
|
||||||
val clock = dateUtil.fromISODateString(timestamp)
|
val clock = dateUtil.fromISODateString(timestamp)
|
||||||
// check if this is new data
|
// check if this is new data
|
||||||
|
|
|
@ -649,6 +649,7 @@ class NSClientV3Plugin @Inject constructor(
|
||||||
result.identifier?.let {
|
result.identifier?.let {
|
||||||
dataPair.value.interfaceIDs.nightscoutId = it
|
dataPair.value.interfaceIDs.nightscoutId = it
|
||||||
storeDataForDb.nsIdDeviceStatuses.add(dataPair.value)
|
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) {
|
} catch (e: Exception) {
|
||||||
|
|
Loading…
Reference in a new issue