NSC: process objective 0 properly

This commit is contained in:
Milos Kozak 2024-01-17 13:16:39 +01:00
parent 1586336daf
commit 2798ae6473
3 changed files with 2 additions and 4 deletions

View file

@ -88,6 +88,8 @@ class NsIncomingDataProcessor @Inject constructor(
*/ */
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
fun processSgvs(sgvs: Any): Boolean { fun processSgvs(sgvs: Any): Boolean {
// Objective0
sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true)
if (!nsClientSource.isEnabled() && !sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_cgm, false)) return false if (!nsClientSource.isEnabled() && !sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_cgm, false)) return false

View file

@ -561,8 +561,6 @@ class NSClientService : DaggerService() {
val sgvs = data.getJSONArray("sgvs") val sgvs = data.getJSONArray("sgvs")
if (sgvs.length() > 0) { if (sgvs.length() > 0) {
rxBus.send(EventNSClientNewLog("◄ DATA", "received " + sgvs.length() + " sgvs")) rxBus.send(EventNSClientNewLog("◄ DATA", "received " + sgvs.length() + " sgvs"))
// Objective0
sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true)
nsIncomingDataProcessor.processSgvs(sgvs) nsIncomingDataProcessor.processSgvs(sgvs)
storeDataForDb.storeGlucoseValuesToDb() storeDataForDb.storeGlucoseValuesToDb()
} }

View file

@ -61,8 +61,6 @@ class LoadBgWorker(
if (sgvs.isNotEmpty()) { if (sgvs.isNotEmpty()) {
val action = if (isFirstLoad) "RCV-F" else "RCV" val action = if (isFirstLoad) "RCV-F" else "RCV"
rxBus.send(EventNSClientNewLog("$action", "${sgvs.size} SVGs from ${dateUtil.dateAndTimeAndSecondsString(lastLoaded)}")) rxBus.send(EventNSClientNewLog("$action", "${sgvs.size} SVGs from ${dateUtil.dateAndTimeAndSecondsString(lastLoaded)}"))
// Objective0
sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true)
// Schedule processing of fetched data and continue of loading // Schedule processing of fetched data and continue of loading
continueLoading = response.code != 304 && nsIncomingDataProcessor.processSgvs(sgvs) continueLoading = response.code != 304 && nsIncomingDataProcessor.processSgvs(sgvs)
} else { } else {