NSC: process objective 0 properly
This commit is contained in:
parent
1e5172a66a
commit
0d4d187775
3 changed files with 2 additions and 4 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue