diff --git a/app/build.gradle b/app/build.gradle
index 3b58a7abdb..1470aa526e 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -105,7 +105,7 @@ android {
defaultConfig {
multiDexEnabled true
versionCode 1500
- version "3.1.0.3-dev-a"
+ version "3.1.0.3-dev-b"
buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8fb0dea2f6..ed8747157d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -35,7 +35,6 @@
-
{
onBackPressed()
- return true
+ true
}
+
+ else -> super.onOptionsItemSelected(item)
}
- return super.onOptionsItemSelected(item)
- }
}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt
index dcba11d059..e3c21e15ad 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt
@@ -175,29 +175,29 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
for (i in 0..1) {
if (typeSelected[i] == ProfileType.MOTOL_DEFAULT) {
if (ageUsed[i] < 1 || ageUsed[i] > 18) {
- ToastUtils.showToastInUiThread(this, R.string.invalidage)
+ ToastUtils.warnToast(this, R.string.invalidage)
return@setOnClickListener
}
if ((weightUsed[i] < 5 || weightUsed[i] > 150) && tddUsed[i] == 0.0) {
- ToastUtils.showToastInUiThread(this, R.string.invalidweight)
+ ToastUtils.warnToast(this, R.string.invalidweight)
return@setOnClickListener
}
if ((tddUsed[i] < 5 || tddUsed[i] > 150) && weightUsed[i] == 0.0) {
- ToastUtils.showToastInUiThread(this, R.string.invalidweight)
+ ToastUtils.warnToast(this, R.string.invalidweight)
return@setOnClickListener
}
}
if (typeSelected[i] == ProfileType.DPV_DEFAULT) {
if (ageUsed[i] < 1 || ageUsed[i] > 18) {
- ToastUtils.showToastInUiThread(this, R.string.invalidage)
+ ToastUtils.warnToast(this, R.string.invalidage)
return@setOnClickListener
}
if (tddUsed[i] < 5 || tddUsed[i] > 150) {
- ToastUtils.showToastInUiThread(this, R.string.invalidweight)
+ ToastUtils.warnToast(this, R.string.invalidweight)
return@setOnClickListener
}
if ((pctUsed[i] < 32 || pctUsed[i] > 37)) {
- ToastUtils.showToastInUiThread(this, R.string.invalidpct)
+ ToastUtils.warnToast(this, R.string.invalidpct)
return@setOnClickListener
}
}
@@ -226,7 +226,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
return@setOnClickListener
}
}
- ToastUtils.showToastInUiThread(this, R.string.invalidinput)
+ ToastUtils.warnToast(this, R.string.invalidinput)
}
binding.ageLabel.labelFor = binding.age.editTextId
binding.tddLabel.labelFor = binding.tdd.editTextId
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt
index 9421324b66..634720f0b4 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt
@@ -27,25 +27,31 @@ class SingleFragmentActivity : DaggerAppCompatActivityWithResult() {
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
if (savedInstanceState == null) {
- supportFragmentManager.beginTransaction().replace(R.id.frame_layout,
- supportFragmentManager.fragmentFactory.instantiate(ClassLoader.getSystemClassLoader(), plugin?.pluginDescription?.fragmentClass!!)).commit()
+ supportFragmentManager.beginTransaction().replace(
+ R.id.frame_layout,
+ supportFragmentManager.fragmentFactory.instantiate(ClassLoader.getSystemClassLoader(), plugin?.pluginDescription?.fragmentClass!!)
+ ).commit()
}
}
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- if (item.itemId == android.R.id.home) {
- finish()
- return true
- } else if (item.itemId == R.id.nav_plugin_preferences) {
- protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, Runnable {
- val i = Intent(this, PreferencesActivity::class.java)
- i.putExtra("id", plugin?.preferencesId)
- startActivity(i)
- }, null)
- return true
+ override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ when (item.itemId) {
+ android.R.id.home -> {
+ finish()
+ true
+ }
+
+ R.id.nav_plugin_preferences -> {
+ protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, {
+ val i = Intent(this, PreferencesActivity::class.java)
+ i.putExtra("id", plugin?.preferencesId)
+ startActivity(i)
+ }, null)
+ true
+ }
+
+ else -> super.onOptionsItemSelected(item)
}
- return false
- }
override fun onCreateOptionsMenu(menu: Menu): Boolean {
if (plugin?.preferencesId != -1) menuInflater.inflate(R.menu.menu_single_fragment, menu)
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt
index c5f2d52cbf..1d108a7d17 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt
@@ -52,15 +52,15 @@ class SurveyActivity : NoSplashAppCompatActivity() {
val weight = SafeParse.stringToDouble(binding.weight.text.toString())
val tdd = SafeParse.stringToDouble(binding.tdd.text.toString())
if (age < 1 || age > 120) {
- ToastUtils.showToastInUiThread(this, R.string.invalidage)
+ ToastUtils.warnToast(this, R.string.invalidage)
return@setOnClickListener
}
if ((weight < 5 || weight > 150) && tdd == 0.0) {
- ToastUtils.showToastInUiThread(this, R.string.invalidweight)
+ ToastUtils.warnToast(this, R.string.invalidweight)
return@setOnClickListener
}
if ((tdd < 5 || tdd > 150) && weight == 0.0) {
- ToastUtils.showToastInUiThread(this, R.string.invalidweight)
+ ToastUtils.warnToast(this, R.string.invalidweight)
return@setOnClickListener
}
profileFunction.getProfile()?.let { runningProfile ->
@@ -84,11 +84,11 @@ class SurveyActivity : NoSplashAppCompatActivity() {
r.age = SafeParse.stringToInt(binding.age.text.toString())
r.weight = SafeParse.stringToInt(binding.weight.text.toString())
if (r.age < 1 || r.age > 120) {
- ToastUtils.showToastInUiThread(this, R.string.invalidage)
+ ToastUtils.warnToast(this, R.string.invalidage)
return@setOnClickListener
}
if (r.weight < 5 || r.weight > 150) {
- ToastUtils.showToastInUiThread(this, R.string.invalidweight)
+ ToastUtils.warnToast(this, R.string.invalidweight)
return@setOnClickListener
}
@@ -110,7 +110,7 @@ class SurveyActivity : NoSplashAppCompatActivity() {
database.child("survey").child(r.id).setValue(r)
} else {
aapsLogger.error("signInAnonymously:failure", task.exception!!)
- ToastUtils.showToastInUiThread(this, "Authentication failed.")
+ ToastUtils.warnToast(this, "Authentication failed.")
//updateUI(null)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt
index d8c71fa70f..c7b913753f 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt
@@ -7,7 +7,13 @@ import androidx.fragment.app.FragmentTransaction
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayout.OnTabSelectedListener
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.activities.fragments.*
+import info.nightscout.androidaps.activities.fragments.TreatmentsBolusCarbsFragment
+import info.nightscout.androidaps.activities.fragments.TreatmentsCareportalFragment
+import info.nightscout.androidaps.activities.fragments.TreatmentsExtendedBolusesFragment
+import info.nightscout.androidaps.activities.fragments.TreatmentsProfileSwitchFragment
+import info.nightscout.androidaps.activities.fragments.TreatmentsTempTargetFragment
+import info.nightscout.androidaps.activities.fragments.TreatmentsTemporaryBasalsFragment
+import info.nightscout.androidaps.activities.fragments.TreatmentsUserEntryFragment
import info.nightscout.androidaps.databinding.TreatmentsFragmentBinding
import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.interfaces.ActivePlugin
@@ -25,7 +31,7 @@ class TreatmentsActivity : NoSplashAppCompatActivity() {
super.onCreate(savedInstanceState)
binding = TreatmentsFragmentBinding.inflate(layoutInflater)
setContentView(binding.root)
-
+
// Use index, TabItems crashes with an id
val useFakeTempBasal = activePlugin.activePump.isFakingTempsByExtendedBoluses
binding.treatmentsTabs.getTabAt(1)?.view?.visibility = useFakeTempBasal.toVisibility()
@@ -55,16 +61,15 @@ class TreatmentsActivity : NoSplashAppCompatActivity() {
})
}
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- return when (item.itemId) {
+ override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ when (item.itemId) {
android.R.id.home -> {
finish()
true
}
- else -> false
+ else -> super.onOptionsItemSelected(item)
}
- }
private fun setFragment(selectedFragment: Fragment) {
supportFragmentManager.beginTransaction()
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt
index be18c83e80..bbeddf2cac 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt
@@ -270,6 +270,10 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
}
holder.binding.calculation.tag = ml
+
+ var notes = ml.carbs?.notes ?: ml.bolus?.notes ?: ""
+ holder.binding.notes.text = notes
+ holder.binding.notes.visibility = if (notes != "") View.VISIBLE else View.GONE
}
override fun getItemCount() = mealLinks.size
@@ -315,7 +319,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
R.id.nav_show_invalidated -> {
showInvalidated = true
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.show_invalidated_records))
+ ToastUtils.infoToast(context, R.string.show_invalidated_records)
swapAdapter()
true
}
@@ -323,7 +327,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
R.id.nav_hide_invalidated -> {
showInvalidated = false
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.hide_invalidated_records))
+ ToastUtils.infoToast(context, R.string.hide_invalidated_records)
swapAdapter()
true
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt
index bedac02f8d..7803ee4359 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt
@@ -206,7 +206,7 @@ class TreatmentsCareportalFragment : DaggerFragment(), MenuProvider {
R.id.nav_show_invalidated -> {
showInvalidated = true
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.show_invalidated_records))
+ ToastUtils.infoToast(context, R.string.show_invalidated_records)
swapAdapter()
true
}
@@ -214,7 +214,7 @@ class TreatmentsCareportalFragment : DaggerFragment(), MenuProvider {
R.id.nav_hide_invalidated -> {
showInvalidated = false
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.hide_invalidated_records))
+ ToastUtils.infoToast(context, R.string.hide_invalidated_records)
swapAdapter()
true
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt
index 46c8bdc5f4..6bc126b1a4 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt
@@ -194,7 +194,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment(), MenuProvider {
R.id.nav_show_invalidated -> {
showInvalidated = true
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.show_invalidated_records))
+ ToastUtils.infoToast(context, R.string.show_invalidated_records)
swapAdapter()
true
}
@@ -202,7 +202,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment(), MenuProvider {
R.id.nav_hide_invalidated -> {
showInvalidated = false
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.hide_invalidated_records))
+ ToastUtils.infoToast(context, R.string.hide_invalidated_records)
swapAdapter()
true
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt
index eb4ea10937..b845bbc1de 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt
@@ -294,7 +294,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider {
R.id.nav_show_invalidated -> {
showInvalidated = true
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.show_invalidated_records))
+ ToastUtils.infoToast(context, R.string.show_invalidated_records)
swapAdapter()
true
}
@@ -302,7 +302,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider {
R.id.nav_hide_invalidated -> {
showInvalidated = false
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.hide_invalidated_records))
+ ToastUtils.infoToast(context, R.string.hide_invalidated_records)
swapAdapter()
true
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt
index ffe324b869..840dd7b1b4 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt
@@ -225,7 +225,7 @@ class TreatmentsTempTargetFragment : DaggerFragment(), MenuProvider {
R.id.nav_show_invalidated -> {
showInvalidated = true
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.show_invalidated_records))
+ ToastUtils.infoToast(context, R.string.show_invalidated_records)
swapAdapter()
true
}
@@ -233,7 +233,7 @@ class TreatmentsTempTargetFragment : DaggerFragment(), MenuProvider {
R.id.nav_hide_invalidated -> {
showInvalidated = false
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.show_invalidated_records))
+ ToastUtils.infoToast(context, R.string.show_invalidated_records)
swapAdapter()
true
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
index 7da21e6cad..3bb55c7963 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
@@ -236,7 +236,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment(), MenuProvider {
R.id.nav_show_invalidated -> {
showInvalidated = true
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.show_invalidated_records))
+ ToastUtils.infoToast(context, R.string.show_invalidated_records)
swapAdapter()
true
}
@@ -244,7 +244,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment(), MenuProvider {
R.id.nav_hide_invalidated -> {
showInvalidated = false
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.hide_invalidated_records))
+ ToastUtils.infoToast(context, R.string.hide_invalidated_records)
swapAdapter()
true
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsUserEntryFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsUserEntryFragment.kt
index bd7bcdc406..3219eeb5bb 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsUserEntryFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsUserEntryFragment.kt
@@ -162,7 +162,7 @@ class TreatmentsUserEntryFragment : DaggerFragment(), MenuProvider {
R.id.nav_show_loop -> {
showLoop = true
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.show_loop_records))
+ ToastUtils.infoToast(context, R.string.show_loop_records)
swapAdapter()
true
}
@@ -170,7 +170,7 @@ class TreatmentsUserEntryFragment : DaggerFragment(), MenuProvider {
R.id.nav_hide_loop -> {
showLoop = false
updateMenuVisibility()
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.show_hide_records))
+ ToastUtils.infoToast(context, R.string.show_hide_records)
swapAdapter()
true
}
diff --git a/app/src/main/java/info/nightscout/androidaps/db/CompatDBHelper.kt b/app/src/main/java/info/nightscout/androidaps/db/CompatDBHelper.kt
index 2dcfac933e..7d223be028 100644
--- a/app/src/main/java/info/nightscout/androidaps/db/CompatDBHelper.kt
+++ b/app/src/main/java/info/nightscout/androidaps/db/CompatDBHelper.kt
@@ -31,31 +31,31 @@ class CompatDBHelper @Inject constructor(
*
*/
var newestGlucoseValue: GlucoseValue? = null
- it.filterIsInstance().lastOrNull()?.let { gv ->
+ it.filterIsInstance().maxByOrNull { gv -> gv.timestamp }?.let { gv ->
aapsLogger.debug(LTag.DATABASE, "Firing EventNewBg $gv")
rxBus.send(EventNewBG(gv))
newestGlucoseValue = gv
}
- it.filterIsInstance().map { gv -> gv.timestamp }.minOrNull()?.let { timestamp ->
- aapsLogger.debug(LTag.DATABASE, "Firing EventNewHistoryData $newestGlucoseValue")
+ it.filterIsInstance().minOfOrNull { gv -> gv.timestamp }?.let { timestamp ->
+ aapsLogger.debug(LTag.DATABASE, "Firing EventNewHistoryData $timestamp $newestGlucoseValue")
rxBus.send(EventNewHistoryData(timestamp, true, newestGlucoseValue))
}
- it.filterIsInstance().map { t -> t.timestamp }.minOrNull()?.let { timestamp ->
+ it.filterIsInstance().minOfOrNull { t -> t.timestamp }?.let { timestamp ->
aapsLogger.debug(LTag.DATABASE, "Firing EventTreatmentChange $timestamp")
rxBus.send(EventTreatmentChange())
rxBus.send(EventNewHistoryData(timestamp, false))
}
- it.filterIsInstance().map { t -> t.timestamp }.minOrNull()?.let { timestamp ->
+ it.filterIsInstance().minOfOrNull { t -> t.timestamp }?.let { timestamp ->
aapsLogger.debug(LTag.DATABASE, "Firing EventTreatmentChange $timestamp")
rxBus.send(EventTreatmentChange())
rxBus.send(EventNewHistoryData(timestamp, false))
}
- it.filterIsInstance().map { t -> t.timestamp }.minOrNull()?.let { timestamp ->
+ it.filterIsInstance().minOfOrNull { t -> t.timestamp }?.let { timestamp ->
aapsLogger.debug(LTag.DATABASE, "Firing EventTempBasalChange $timestamp")
rxBus.send(EventTempBasalChange())
rxBus.send(EventNewHistoryData(timestamp, false))
}
- it.filterIsInstance().map { t -> t.timestamp }.minOrNull()?.let { timestamp ->
+ it.filterIsInstance().minOfOrNull { t -> t.timestamp }?.let { timestamp ->
aapsLogger.debug(LTag.DATABASE, "Firing EventExtendedBolusChange $timestamp")
rxBus.send(EventExtendedBolusChange())
rxBus.send(EventNewHistoryData(timestamp, false))
diff --git a/app/src/main/java/info/nightscout/androidaps/di/PluginsModule.kt b/app/src/main/java/info/nightscout/androidaps/di/PluginsModule.kt
index e7b110e844..4d1e3758a5 100644
--- a/app/src/main/java/info/nightscout/androidaps/di/PluginsModule.kt
+++ b/app/src/main/java/info/nightscout/androidaps/di/PluginsModule.kt
@@ -377,6 +377,12 @@ abstract class PluginsModule {
@IntKey(470)
abstract fun bindGlunovoPlugin(plugin: GlunovoPlugin): PluginBase
+ @Binds
+ @AllConfigs
+ @IntoMap
+ @IntKey(473)
+ abstract fun bindIntelligoPlugin(plugin: IntelligoPlugin): PluginBase
+
@Binds
@AllConfigs
@IntoMap
@@ -419,4 +425,4 @@ abstract class PluginsModule {
@Qualifier
annotation class APS
-}
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt
index ff3d0c778a..db221159ce 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt
@@ -78,15 +78,15 @@ class CarbsDialog : DialogFragmentWithDate() {
val time = binding.time.value.toInt()
if (time > 12 * 60 || time < -7 * 24 * 60) {
binding.time.value = 0.0
- ToastUtils.showToastInUiThread(ctx, rh.gs(R.string.constraintapllied))
+ ToastUtils.warnToast(ctx, R.string.constraintapllied)
}
if (binding.duration.value > 10) {
binding.duration.value = 0.0
- ToastUtils.showToastInUiThread(ctx, rh.gs(R.string.constraintapllied))
+ ToastUtils.warnToast(ctx, R.string.constraintapllied)
}
if (binding.carbs.value.toInt() > maxCarbs) {
binding.carbs.value = 0.0
- ToastUtils.showToastInUiThread(ctx, rh.gs(R.string.carbsconstraintapplied))
+ ToastUtils.warnToast(ctx, R.string.carbsconstraintapplied)
}
}
@@ -392,7 +392,7 @@ class CarbsDialog : DialogFragmentWithDate() {
val cancelFail = {
queryingProtection = false
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
- ToastUtils.showToastInUiThread(ctx, R.string.dialog_canceled)
+ ToastUtils.warnToast(ctx, R.string.dialog_canceled)
dismiss()
}
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
index 0f6fd525a1..d068a8b1d1 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
@@ -120,7 +120,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
val cancelFail = {
queryingProtection = false
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
- ToastUtils.showToastInUiThread(ctx, R.string.dialog_canceled)
+ ToastUtils.warnToast(ctx, R.string.dialog_canceled)
dismiss()
}
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
index a11fd61cbb..3699e70352 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
@@ -208,7 +208,7 @@ class FillDialog : DialogFragmentWithDate() {
val cancelFail = {
queryingProtection = false
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
- ToastUtils.showToastInUiThread(ctx, R.string.dialog_canceled)
+ ToastUtils.warnToast(ctx, R.string.dialog_canceled)
dismiss()
}
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
index 7c45fe99ee..25143f9feb 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
@@ -83,11 +83,11 @@ class InsulinDialog : DialogFragmentWithDate() {
val maxInsulin = constraintChecker.getMaxBolusAllowed().value()
if (abs(binding.time.value.toInt()) > 12 * 60) {
binding.time.value = 0.0
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.constraintapllied))
+ ToastUtils.warnToast(context, R.string.constraintapllied)
}
if (binding.amount.value > maxInsulin) {
binding.amount.value = 0.0
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.bolusconstraintapplied))
+ ToastUtils.warnToast(context, R.string.bolusconstraintapplied)
}
}
@@ -267,7 +267,7 @@ class InsulinDialog : DialogFragmentWithDate() {
val cancelFail = {
queryingProtection = false
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
- ToastUtils.showToastInUiThread(ctx, R.string.dialog_canceled)
+ ToastUtils.warnToast(ctx, R.string.dialog_canceled)
dismiss()
}
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
index e0b0788a25..88a400f82c 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
@@ -304,7 +304,7 @@ class LoopDialog : DaggerDialogFragment() {
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
- ToastUtils.showToastInUiThread(ctx, rh.gs(R.string.tempbasaldeliveryerror))
+ ToastUtils.errorToast(ctx, rh.gs(R.string.tempbasaldeliveryerror))
}
}
})
@@ -449,7 +449,7 @@ class LoopDialog : DaggerDialogFragment() {
val cancelFail = {
queryingProtection = false
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
- ToastUtils.showToastInUiThread(ctx, R.string.dialog_canceled)
+ ToastUtils.warnToast(ctx, R.string.dialog_canceled)
dismiss()
}
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
index db1a8d0478..a3e410e826 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
@@ -258,7 +258,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
val cancelFail = {
queryingProtection = false
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
- ToastUtils.showToastInUiThread(ctx, R.string.dialog_canceled)
+ ToastUtils.warnToast(ctx, R.string.dialog_canceled)
dismiss()
}
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
index 39e0ddda9b..8940d1fb94 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
@@ -153,7 +153,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
val cancelFail = {
queryingProtection = false
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
- ToastUtils.showToastInUiThread(ctx, R.string.dialog_canceled)
+ ToastUtils.warnToast(ctx, R.string.dialog_canceled)
dismiss()
}
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
index 407af78133..60609fe12d 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
@@ -230,7 +230,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
val cancelFail = {
queryingProtection = false
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
- ToastUtils.showToastInUiThread(ctx, R.string.dialog_canceled)
+ ToastUtils.warnToast(ctx, R.string.dialog_canceled)
dismiss()
}
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
index 3a783410dd..14f18a193d 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
@@ -72,11 +72,11 @@ class TreatmentDialog : DialogFragmentWithDate() {
val maxInsulin = constraintChecker.getMaxBolusAllowed().value()
if (SafeParse.stringToInt(binding.carbs.text) > maxCarbs) {
binding.carbs.value = 0.0
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.carbsconstraintapplied))
+ ToastUtils.warnToast(context, R.string.carbsconstraintapplied)
}
if (SafeParse.stringToDouble(binding.insulin.text) > maxInsulin) {
binding.insulin.value = 0.0
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.bolusconstraintapplied))
+ ToastUtils.warnToast(context, R.string.bolusconstraintapplied)
}
}
@@ -212,7 +212,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
val cancelFail = {
queryingProtection = false
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
- ToastUtils.showToastInUiThread(ctx, R.string.dialog_canceled)
+ ToastUtils.warnToast(ctx, R.string.dialog_canceled)
dismiss()
}
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
index 9c8fe4ba91..8d86cb5e9e 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
@@ -335,7 +335,7 @@ class WizardDialog : DaggerDialogFragment() {
val tempTarget = repository.getTemporaryTargetActiveAt(dateUtil.now()).blockingGet()
if (profile == null || profileStore == null) {
- ToastUtils.showToastInUiThread(ctx, rh.gs(R.string.noprofile))
+ ToastUtils.errorToast(ctx, R.string.noprofile)
dismiss()
return
}
@@ -409,7 +409,7 @@ class WizardDialog : DaggerDialogFragment() {
val carbsAfterConstraint = constraintChecker.applyCarbsConstraints(Constraint(carbs)).value()
if (abs(carbs - carbsAfterConstraint) > 0.01) {
binding.carbsInput.value = 0.0
- ToastUtils.showToastInUiThread(ctx, rh.gs(R.string.carbsconstraintapplied))
+ ToastUtils.warnToast(ctx, R.string.carbsconstraintapplied)
return
}
@@ -511,7 +511,7 @@ class WizardDialog : DaggerDialogFragment() {
val cancelFail = {
queryingProtection = false
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
- ToastUtils.showToastInUiThread(ctx, R.string.dialog_canceled)
+ ToastUtils.warnToast(ctx, R.string.dialog_canceled)
dismiss()
}
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt
index 49345faff8..400080344a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt
@@ -130,13 +130,14 @@ class LoopFragment : DaggerFragment(), MenuProvider {
binding.smbsetbypump.text = it.smbSetByPump?.let { smbSetByPump -> HtmlHelper.fromHtml(smbSetByPump.toHtml()) }
?: ""
- val constraints =
+ var constraints =
it.constraintsProcessed?.let { constraintsProcessed ->
val allConstraints = Constraint(0.0)
constraintsProcessed.rateConstraint?.let { rateConstraint -> allConstraints.copyReasons(rateConstraint) }
constraintsProcessed.smbConstraint?.let { smbConstraint -> allConstraints.copyReasons(smbConstraint) }
allConstraints.getMostLimitedReasons(aapsLogger)
} ?: ""
+ constraints += loop.closedLoopEnabled?.getReasons(aapsLogger) ?: ""
binding.constraints.text = constraints
binding.swipeRefresh.isRefreshing = false
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt
index 4303cb179f..a39d00d0bd 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt
@@ -105,6 +105,7 @@ class LoopPlugin @Inject constructor(
private var carbsSuggestionsSuspendedUntil: Long = 0
private var prevCarbsreq = 0
override var lastRun: LastRun? = null
+ override var closedLoopEnabled: Constraint? = null
override fun onStart() {
createNotificationChannel()
@@ -294,8 +295,8 @@ class LoopPlugin @Inject constructor(
rxBus.send(EventLoopSetLastRunGui(rh.gs(R.string.pumpsuspended)))
return
}
- val closedLoopEnabled = constraintChecker.isClosedLoopAllowed()
- if (closedLoopEnabled.value()) {
+ closedLoopEnabled = constraintChecker.isClosedLoopAllowed()
+ if (closedLoopEnabled?.value() == true) {
if (allowNotification) {
if (resultAfterConstraints.isCarbsRequired
&& resultAfterConstraints.carbsReq >= sp.getInt(
@@ -369,12 +370,17 @@ class LoopPlugin @Inject constructor(
if (resultAfterConstraints.bolusRequested()) lastRun.smbSetByPump = waiting
rxBus.send(EventLoopUpdateGui())
fabricPrivacy.logCustom("APSRequest")
+ // TBR request must be applied first to prevent situation where
+ // SMB was executed and zero TBR afterwards failed
applyTBRRequest(resultAfterConstraints, profile, object : Callback() {
override fun run() {
if (result.enacted || result.success) {
lastRun.tbrSetByPump = result
lastRun.lastTBRRequest = lastRun.lastAPSRun
lastRun.lastTBREnact = dateUtil.now()
+ // deliverAt is used to prevent executing too old SMB request (older than 1 min)
+ // executing TBR may take some time thus give more time to SMB
+ resultAfterConstraints.deliverAt = lastRun.lastTBREnact
rxBus.send(EventLoopUpdateGui())
applySMBRequest(resultAfterConstraints, object : Callback() {
override fun run() {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/activities/ObjectivesExamDialog.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/activities/ObjectivesExamDialog.kt
index e2ae0121a0..7e4ac193fa 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/activities/ObjectivesExamDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/activities/ObjectivesExamDialog.kt
@@ -109,7 +109,7 @@ class ObjectivesExamDialog : DaggerDialogFragment() {
task.answered = result
if (!result) {
task.disabledTo = dateUtil.now() + T.hours(1).msecs()
- context?.let { it1 -> ToastUtils.showToastInUiThread(it1, R.string.wronganswer) }
+ context?.let { it1 -> ToastUtils.infoToast(it1, R.string.wronganswer) }
} else task.disabledTo = 0
updateGui()
rxBus.send(EventObjectivesUpdateGui())
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt
index 6ad3b9e04e..57388f49cf 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt
@@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.general.autotune
+import android.content.Context
import android.graphics.Paint
import android.graphics.Typeface
import android.os.Bundle
@@ -262,6 +263,7 @@ class AutotuneFragment : DaggerFragment() {
binding.tuneLastrun.setOnClickListener {
if (!autotunePlugin.calculationRunning) {
autotunePlugin.loadLastRun()
+ binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
updateGui()
}
}
@@ -418,11 +420,12 @@ class AutotuneFragment : DaggerFragment() {
setTextAppearance(android.R.style.TextAppearance_Material_Medium)
})
autotunePlugin.tunedProfile?.let { tuned ->
- layout.addView(toTableRowHeader())
+ layout.addView(toTableRowHeader(context))
val tuneInsulin = sp.getBoolean(R.string.key_autotune_tune_insulin_curve, false)
if (tuneInsulin) {
layout.addView(
toTableRowValue(
+ context,
rh.gs(R.string.insulin_peak),
autotunePlugin.pumpProfile.localInsulin.peak.toDouble(),
tuned.localInsulin.peak.toDouble(),
@@ -431,6 +434,7 @@ class AutotuneFragment : DaggerFragment() {
)
layout.addView(
toTableRowValue(
+ context,
rh.gs(R.string.dia),
Round.roundTo(autotunePlugin.pumpProfile.localInsulin.dia, 0.1),
Round.roundTo(tuned.localInsulin.dia, 0.1),
@@ -440,13 +444,14 @@ class AutotuneFragment : DaggerFragment() {
}
layout.addView(
toTableRowValue(
+ context,
rh.gs(R.string.isf_short),
Round.roundTo(autotunePlugin.pumpProfile.isf / toMgDl, 0.001),
Round.roundTo(tuned.isf / toMgDl, 0.001),
isfFormat
)
)
- layout.addView(toTableRowValue(rh.gs(R.string.ic_short), Round.roundTo(autotunePlugin.pumpProfile.ic, 0.001), Round.roundTo(tuned.ic, 0.001), "%.2f"))
+ layout.addView(toTableRowValue(context, rh.gs(R.string.ic_short), Round.roundTo(autotunePlugin.pumpProfile.ic, 0.001), Round.roundTo(tuned.ic, 0.001), "%.2f"))
layout.addView(
TextView(context).apply {
text = rh.gs(R.string.basal)
@@ -455,7 +460,7 @@ class AutotuneFragment : DaggerFragment() {
setTextAppearance(android.R.style.TextAppearance_Material_Medium)
}
)
- layout.addView(toTableRowHeader(true))
+ layout.addView(toTableRowHeader(context,true))
var totalPump = 0.0
var totalTuned = 0.0
for (h in 0 until tuned.basal.size) {
@@ -463,9 +468,9 @@ class AutotuneFragment : DaggerFragment() {
val time = df.format(h.toLong()) + ":00"
totalPump += autotunePlugin.pumpProfile.basal[h]
totalTuned += tuned.basal[h]
- layout.addView(toTableRowValue(time, autotunePlugin.pumpProfile.basal[h], tuned.basal[h], "%.3f", tuned.basalUntuned[h].toString()))
+ layout.addView(toTableRowValue(context, time, autotunePlugin.pumpProfile.basal[h], tuned.basal[h], "%.3f", tuned.basalUntuned[h].toString()))
}
- layout.addView(toTableRowValue("∑", totalPump, totalTuned, "%.3f", " "))
+ layout.addView(toTableRowValue(context, "∑", totalPump, totalTuned, "%.3f", " "))
}
}
)
@@ -476,7 +481,7 @@ class AutotuneFragment : DaggerFragment() {
}
}
- private fun toTableRowHeader(basal: Boolean = false): TableRow =
+ private fun toTableRowHeader(context: Context, basal: Boolean = false): TableRow =
TableRow(context).also { header ->
val lp = TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT).apply { weight = 1f }
header.layoutParams = TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT).apply { gravity = Gravity.CENTER_HORIZONTAL }
@@ -507,7 +512,7 @@ class AutotuneFragment : DaggerFragment() {
})
}
- private fun toTableRowValue(hour: String, inputValue: Double, tunedValue: Double, format: String = "%.3f", missing: String = ""): TableRow =
+ private fun toTableRowValue(context: Context, hour: String, inputValue: Double, tunedValue: Double, format: String = "%.3f", missing: String = ""): TableRow =
TableRow(context).also { row ->
val percentValue = Round.roundTo(tunedValue / inputValue * 100 - 100, 1.0).toInt().toString() + "%"
val lp = TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT).apply { weight = 1f }
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/dataBroadcaster/DataBroadcastPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/dataBroadcaster/DataBroadcastPlugin.kt
index 26dd91eb91..0f3c03a404 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/dataBroadcaster/DataBroadcastPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/dataBroadcaster/DataBroadcastPlugin.kt
@@ -9,6 +9,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.Event
import info.nightscout.androidaps.events.EventAutosensCalculationFinished
import info.nightscout.androidaps.extensions.durationInMinutes
+import info.nightscout.androidaps.extensions.safeQueryBroadcastReceivers
import info.nightscout.androidaps.extensions.toStringFull
import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateGui
@@ -17,16 +18,16 @@ import info.nightscout.androidaps.plugins.general.nsclient.data.DeviceStatusData
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
-import info.nightscout.androidaps.receivers.ReceiverStatusStore
import info.nightscout.androidaps.receivers.Intents
+import info.nightscout.androidaps.receivers.ReceiverStatusStore
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.FabricPrivacy
-import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
import io.reactivex.rxjava3.disposables.CompositeDisposable
+import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject
import javax.inject.Singleton
@@ -64,21 +65,18 @@ class DataBroadcastPlugin @Inject constructor(
private val disposable = CompositeDisposable()
override fun onStart() {
super.onStart()
- disposable.add(rxBus
- .toObservable(EventOpenAPSUpdateGui::class.java)
- .observeOn(aapsSchedulers.io)
- .subscribe({ sendData(it) }, fabricPrivacy::logException)
- )
- disposable.add(rxBus
- .toObservable(EventAutosensCalculationFinished::class.java)
- .observeOn(aapsSchedulers.io)
- .subscribe({ sendData(it) }, fabricPrivacy::logException)
- )
- disposable.add(rxBus
- .toObservable(EventOverviewBolusProgress::class.java)
- .observeOn(aapsSchedulers.io)
- .subscribe({ sendData(it) }, fabricPrivacy::logException)
- )
+ disposable += rxBus
+ .toObservable(EventOpenAPSUpdateGui::class.java)
+ .observeOn(aapsSchedulers.io)
+ .subscribe({ sendData(it) }, fabricPrivacy::logException)
+ disposable += rxBus
+ .toObservable(EventAutosensCalculationFinished::class.java)
+ .observeOn(aapsSchedulers.io)
+ .subscribe({ sendData(it) }, fabricPrivacy::logException)
+ disposable += rxBus
+ .toObservable(EventOverviewBolusProgress::class.java)
+ .observeOn(aapsSchedulers.io)
+ .subscribe({ sendData(it) }, fabricPrivacy::logException)
}
override fun onStop() {
@@ -186,7 +184,7 @@ class DataBroadcastPlugin @Inject constructor(
}
private fun sendBroadcast(intent: Intent) {
- val receivers: List = context.packageManager.queryBroadcastReceivers(intent, 0)
+ val receivers: List = context.packageManager.safeQueryBroadcastReceivers(intent, 0)
for (resolveInfo in receivers)
resolveInfo.activityInfo.packageName?.let {
intent.setPackage(it)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt
index c0b1210cb9..d11c447341 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt
@@ -88,7 +88,7 @@ class NSClientAddUpdateWorker(
.also { result ->
result.inserted.forEach {
uel.log(
- Action.BOLUS, Sources.NSClient,
+ Action.BOLUS, Sources.NSClient, it.notes,
ValueWithUnit.Timestamp(it.timestamp),
ValueWithUnit.Insulin(it.amount)
)
@@ -124,7 +124,7 @@ class NSClientAddUpdateWorker(
.also { result ->
result.inserted.forEach {
uel.log(
- Action.CARBS, Sources.NSClient,
+ Action.CARBS, Sources.NSClient, it.notes,
ValueWithUnit.Timestamp(it.timestamp),
ValueWithUnit.Gram(it.amount.toInt())
)
@@ -140,7 +140,7 @@ class NSClientAddUpdateWorker(
}
result.updated.forEach {
uel.log(
- Action.CARBS, Sources.NSClient,
+ Action.CARBS, Sources.NSClient, it.notes,
ValueWithUnit.Timestamp(it.timestamp),
ValueWithUnit.Gram(it.amount.toInt())
)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSDeviceStatus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSDeviceStatus.kt
index 88bbbce04c..7a42d9efdd 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSDeviceStatus.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/data/NSDeviceStatus.kt
@@ -54,6 +54,8 @@ import javax.inject.Singleton
"predBGs": {
"IOB": [116, 114, 112, 110, 109, 107, 106, 105, 105, 104, 104, 104, 104, 104, 104, 104, 104, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 107]
},
+ "sensitivityRatio": 0.81,
+ "variable_sens": 137.3,
"COB": 0,
"IOB": -0.035,
"reason": "COB: 0, Dev: -18, BGI: 0.43, ISF: 216, Target: 99; Eventual BG 105 > 99 but Min. Delta -2.60 < Exp. Delta 0.1; setting current basal of 0.4 as temp. Suggested rate is same as profile rate, no temp basal is active, doing nothing",
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
index 54a2bbcb40..139e51f67d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
@@ -67,6 +67,7 @@ import info.nightscout.androidaps.skins.SkinProvider
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.FabricPrivacy
+import info.nightscout.androidaps.utils.JsonHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.TrendCalculator
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
@@ -379,7 +380,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
dexcomMediator.findDexcomPackageName()?.let {
openCgmApp(it)
}
- ?: ToastUtils.showToastInUiThread(activity, rh.gs(R.string.dexcom_app_not_installed))
+ ?: ToastUtils.infoToast(activity, rh.gs(R.string.dexcom_app_not_installed))
}
}
@@ -395,9 +396,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
)
}
- ?: ToastUtils.showToastInUiThread(activity, rh.gs(R.string.dexcom_app_not_installed))
+ ?: ToastUtils.infoToast(activity, rh.gs(R.string.dexcom_app_not_installed))
} catch (e: ActivityNotFoundException) {
- ToastUtils.showToastInUiThread(activity, rh.gs(R.string.g5appnotdetected))
+ ToastUtils.infoToast(activity, rh.gs(R.string.g5appnotdetected))
}
}
}
@@ -544,7 +545,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
// **** Various treatment buttons ****
binding.buttonsLayout.carbsButton.visibility =
- ((!activePlugin.activePump.pumpDescription.storesCarbInfo || pump.isInitialized() && !pump.isSuspended()) && profile != null
+ (/*(!activePlugin.activePump.pumpDescription.storesCarbInfo || pump.isInitialized() && !pump.isSuspended()) &&*/ profile != null
&& sp.getBoolean(R.string.key_show_carbs_button, true)).toVisibility()
binding.buttonsLayout.treatmentButton.visibility = (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null
&& sp.getBoolean(R.string.key_show_treatment_button, false)).toVisibility()
@@ -602,7 +603,6 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
private fun processAps() {
val pump = activePlugin.activePump
- val profile = profileFunction.getProfile()
// aps mode
val closedLoopEnabled = constraintChecker.isClosedLoopAllowed()
@@ -681,21 +681,6 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
binding.infoLayout.apsModeText.visibility = View.GONE
}
}
- // Show variable sensitivity
- val request = loop.lastRun?.request
- if (request is DetermineBasalResultSMB) {
- val isfMgdl = profile?.getIsfMgdl()
- val variableSens = request.variableSens
- if (variableSens != isfMgdl && variableSens != null && isfMgdl != null) {
- binding.infoLayout.variableSensitivity.text =
- String.format(
- Locale.getDefault(), "%1$.1f→%2$.1f",
- Profile.toUnits(isfMgdl, isfMgdl * Constants.MGDL_TO_MMOLL, profileFunction.getUnits()),
- Profile.toUnits(variableSens, variableSens * Constants.MGDL_TO_MMOLL, profileFunction.getUnits())
- )
- binding.infoLayout.variableSensitivity.visibility = View.VISIBLE
- } else binding.infoLayout.variableSensitivity.visibility = View.GONE
- } else binding.infoLayout.variableSensitivity.visibility = View.GONE
} else {
//nsclient
binding.infoLayout.apsMode.visibility = View.GONE
@@ -1094,6 +1079,24 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
overviewData.lastAutosensData(iobCobCalculator)?.let { autosensData ->
String.format(Locale.ENGLISH, "%.0f%%", autosensData.autosensResult.ratio * 100)
} ?: ""
+ // Show variable sensitivity
+ val profile = profileFunction.getProfile()
+ val request = loop.lastRun?.request
+ val isfMgdl = profile?.getIsfMgdl()
+ val variableSens =
+ if (config.APS && request is DetermineBasalResultSMB) request.variableSens ?: 0.0
+ else if (config.NSCLIENT) JsonHelper.safeGetDouble(nsDeviceStatus.getAPSResult(injector).json, "variable_sens")
+ else 0.0
+
+ if (variableSens != isfMgdl && variableSens != 0.0 && isfMgdl != null) {
+ binding.infoLayout.variableSensitivity.text =
+ String.format(
+ Locale.getDefault(), "%1$.1f→%2$.1f",
+ Profile.toUnits(isfMgdl, isfMgdl * Constants.MGDL_TO_MMOLL, profileFunction.getUnits()),
+ Profile.toUnits(variableSens, variableSens * Constants.MGDL_TO_MMOLL, profileFunction.getUnits())
+ )
+ binding.infoLayout.variableSensitivity.visibility = View.VISIBLE
+ } else binding.infoLayout.variableSensitivity.visibility = View.GONE
}
private fun updatePumpStatus() {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt
index 7b34ba26c3..d3aeb014e0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt
@@ -56,7 +56,7 @@ class GraphData(
addSeries(overviewData.bgReadingGraphSeries)
if (addPredictions) addSeries(overviewData.predictionsGraphSeries)
overviewData.bgReadingGraphSeries.setOnDataPointTapListener { _, dataPoint ->
- if (dataPoint is GlucoseValueDataPoint) ToastUtils.showToastInUiThread(context, dataPoint.label)
+ if (dataPoint is GlucoseValueDataPoint) ToastUtils.infoToast(context, dataPoint.label)
}
}
@@ -93,14 +93,14 @@ class GraphData(
maxY = maxOf(maxY, overviewData.maxTreatmentsValue)
addSeries(overviewData.treatmentsSeries)
overviewData.treatmentsSeries.setOnDataPointTapListener { _, dataPoint ->
- if (dataPoint is BolusDataPoint) ToastUtils.showToastInUiThread(context, dataPoint.label)
+ if (dataPoint is BolusDataPoint) ToastUtils.infoToast(context, dataPoint.label)
}
}
fun addEps(context: Context?, scale: Double) {
addSeries(overviewData.epsSeries)
overviewData.epsSeries.setOnDataPointTapListener { _, dataPoint ->
- if (dataPoint is EffectiveProfileSwitchDataPoint) ToastUtils.showToastInUiThread(context, dataPoint.data.originalCustomizedName)
+ if (dataPoint is EffectiveProfileSwitchDataPoint) ToastUtils.infoToast(context, dataPoint.data.originalCustomizedName)
}
overviewData.epsScale.multiplier = maxY * scale / overviewData.maxEpsValue
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.kt
index 402daed73e..438cb4f7d0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/DummyService.kt
@@ -8,11 +8,11 @@ import android.os.IBinder
import dagger.android.DaggerService
import info.nightscout.androidaps.events.EventAppExit
import info.nightscout.androidaps.interfaces.NotificationHolder
-import info.nightscout.shared.logging.AAPSLogger
-import info.nightscout.shared.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.rx.AapsSchedulers
+import info.nightscout.shared.logging.AAPSLogger
+import info.nightscout.shared.logging.LTag
import io.reactivex.rxjava3.disposables.CompositeDisposable
import javax.inject.Inject
@@ -59,7 +59,7 @@ class DummyService : DaggerService() {
aapsLogger.debug(LTag.CORE, "onDestroy")
disposable.clear()
super.onDestroy()
- stopForeground(true)
+ stopForeground(STOP_FOREGROUND_REMOVE)
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
index 311b1999fa..fecdc3b3d3 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
@@ -190,7 +190,7 @@ class SmsCommunicatorPlugin @Inject constructor(
?: return Result.failure(workDataOf("Error" to "missing input data"))
val format = bundle.getString("format")
?: return Result.failure(workDataOf("Error" to "missing format in input data"))
- val pdus = bundle["pdus"] as Array<*>
+ @Suppress("DEPRECATION") val pdus = bundle["pdus"] as Array<*>
for (pdu in pdus) {
val message = SmsMessage.createFromPdu(pdu as ByteArray, format)
smsCommunicatorPlugin.processSms(Sms(message))
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt
index 30c05b1f32..c048c7133a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt
@@ -369,7 +369,7 @@ class IobCobCalculatorPlugin @Inject constructor(
@Synchronized
private fun scheduleHistoryDataChange(event: EventNewHistoryData) {
// if there is nothing scheduled or asking reload deeper to the past
- if (scheduledEvent == null || event.oldDataTimestamp < (scheduledEvent?.oldDataTimestamp) ?: 0L) {
+ if (scheduledEvent == null || event.oldDataTimestamp < (scheduledEvent?.oldDataTimestamp ?: 0L)) {
// cancel waiting task to prevent sending multiple posts
scheduledHistoryPost?.cancel(false)
// prepare task for execution in 1 sec
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt
index 0284ce9259..12ac04a0b8 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpPlugin.kt
@@ -91,7 +91,7 @@ open class VirtualPumpPlugin @Inject constructor(
it.basalStep = 0.01
it.basalMinimumRate = 0.01
it.isRefillingCapable = true
- it.storesCarbInfo = false
+ //it.storesCarbInfo = false
it.is30minBasalRatesCapable = true
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
index 9da1348c48..6266213326 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
@@ -119,7 +119,8 @@ class BGSourceFragment : DaggerFragment(), MenuProvider {
}
override fun onMenuItemSelected(item: MenuItem) =
- actionHelper.onOptionsItemSelected(item)
+ if (actionHelper.onOptionsItemSelected(item)) true
+ else super.onContextItemSelected(item)
inner class RecyclerViewAdapter internal constructor(private var glucoseValues: List) : RecyclerView.Adapter() {
@@ -195,6 +196,7 @@ class BGSourceFragment : DaggerFragment(), MenuProvider {
R.string.poctech -> Sources.PocTech
R.string.tomato -> Sources.Tomato
R.string.glunovo -> Sources.Glunovo
+ R.string.intelligo -> Sources.Intelligo
R.string.xdrip -> Sources.Xdrip
R.string.aidex -> Sources.Aidex
else -> Sources.Unknown
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt
index 7df9fe9729..18a726da44 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt
@@ -19,13 +19,19 @@ import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
import info.nightscout.androidaps.database.transactions.InvalidateGlucoseValueTransaction
import info.nightscout.androidaps.extensions.fromConstant
-import info.nightscout.androidaps.interfaces.*
+import info.nightscout.androidaps.extensions.safeGetInstalledPackages
+import info.nightscout.androidaps.interfaces.BgSource
+import info.nightscout.androidaps.interfaces.Config
+import info.nightscout.androidaps.interfaces.PluginBase
+import info.nightscout.androidaps.interfaces.PluginDescription
+import info.nightscout.androidaps.interfaces.PluginType
+import info.nightscout.androidaps.interfaces.Profile
+import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.receivers.DataWorker
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.XDripBroadcast
-import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
@@ -244,7 +250,7 @@ class DexcomPlugin @Inject constructor(
fun findDexcomPackageName(): String? {
val packageManager = context.packageManager
- for (packageInfo in packageManager.getInstalledPackages(0)) {
+ for (packageInfo in packageManager.safeGetInstalledPackages(0)) {
if (PACKAGE_NAMES.contains(packageInfo.packageName)) return packageInfo.packageName
}
return null
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/IntelligoPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/IntelligoPlugin.kt
new file mode 100644
index 0000000000..3f328b2fc5
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/IntelligoPlugin.kt
@@ -0,0 +1,193 @@
+package info.nightscout.androidaps.plugins.source
+
+import android.content.Context
+import android.content.pm.PackageManager
+import android.net.Uri
+import android.os.Handler
+import android.os.HandlerThread
+import android.util.Log
+import dagger.android.HasAndroidInjector
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.androidaps.database.entities.UserEntry
+import info.nightscout.androidaps.database.entities.ValueWithUnit
+import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
+import info.nightscout.androidaps.extensions.safeGetInstalledPackages
+import info.nightscout.androidaps.interfaces.BgSource
+import info.nightscout.androidaps.interfaces.PluginBase
+import info.nightscout.androidaps.interfaces.PluginDescription
+import info.nightscout.androidaps.interfaces.PluginType
+import info.nightscout.androidaps.interfaces.ResourceHelper
+import info.nightscout.androidaps.logging.UserEntryLogger
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.FabricPrivacy
+import info.nightscout.androidaps.utils.T
+import info.nightscout.androidaps.utils.XDripBroadcast
+import info.nightscout.shared.logging.AAPSLogger
+import info.nightscout.shared.logging.LTag
+import info.nightscout.shared.sharedPreferences.SP
+import io.reactivex.rxjava3.disposables.CompositeDisposable
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class IntelligoPlugin @Inject constructor(
+ injector: HasAndroidInjector,
+ resourceHelper: ResourceHelper,
+ aapsLogger: AAPSLogger,
+ private val sp: SP,
+ private val context: Context,
+ private val repository: AppRepository,
+ private val xDripBroadcast: XDripBroadcast,
+ private val dateUtil: DateUtil,
+ private val uel: UserEntryLogger,
+ private val fabricPrivacy: FabricPrivacy
+) : PluginBase(
+ PluginDescription()
+ .mainType(PluginType.BGSOURCE)
+ .fragmentClass(BGSourceFragment::class.java.name)
+ .pluginIcon(R.drawable.ic_intelligo)
+ .pluginName(R.string.intelligo)
+ .preferencesId(R.xml.pref_bgsource)
+ .shortName(R.string.intelligo)
+ .description(R.string.description_source_intelligo),
+ aapsLogger, resourceHelper, injector
+), BgSource {
+
+ private val handler = Handler(HandlerThread(this::class.java.simpleName + "Handler").also { it.start() }.looper)
+ private lateinit var refreshLoop: Runnable
+
+ private val contentUri: Uri = Uri.parse("content://$AUTHORITY/$TABLE_NAME")
+
+ init {
+ refreshLoop = Runnable {
+ try {
+ handleNewData()
+ } catch (e: Exception) {
+ fabricPrivacy.logException(e)
+ aapsLogger.error("Error while processing data", e)
+ }
+ val lastReadTimestamp = sp.getLong(R.string.key_last_processed_intelligo_timestamp, 0L)
+ val differenceToNow = INTERVAL - (dateUtil.now() - lastReadTimestamp) % INTERVAL + T.secs(10).msecs()
+ handler.postDelayed(refreshLoop, differenceToNow)
+ }
+ }
+
+ private val disposable = CompositeDisposable()
+
+ override fun onStart() {
+ super.onStart()
+ handler.postDelayed(refreshLoop, T.secs(30).msecs()) // do not start immediately, app may be still starting
+ }
+
+ override fun onStop() {
+ super.onStop()
+ handler.removeCallbacks(refreshLoop)
+ disposable.clear()
+ }
+
+ private fun handleNewData() {
+ if (!isEnabled()) return
+
+ for (pack in context.packageManager.safeGetInstalledPackages(PackageManager.GET_PROVIDERS)) {
+ val providers = pack.providers
+ if (providers != null) {
+ for (provider in providers) {
+ Log.d("Example", "provider: " + provider.authority)
+ }
+ }
+ }
+
+ context.contentResolver.query(contentUri, null, null, null, null)?.let { cr ->
+ val glucoseValues = mutableListOf()
+ val calibrations = mutableListOf()
+ cr.moveToFirst()
+
+ while (!cr.isAfterLast) {
+ val timestamp = cr.getLong(0)
+ val value = cr.getDouble(1) //value in mmol/l...
+ val curr = cr.getDouble(2)
+
+ // bypass already processed
+ if (timestamp < sp.getLong(R.string.key_last_processed_intelligo_timestamp, 0L)) {
+ cr.moveToNext()
+ continue
+ }
+
+ if (timestamp > dateUtil.now() || timestamp == 0L) {
+ aapsLogger.error(LTag.BGSOURCE, "Error in received data date/time $timestamp")
+ cr.moveToNext()
+ continue
+ }
+
+ if (value < 2 || value > 25) {
+ aapsLogger.error(LTag.BGSOURCE, "Error in received data value (value out of bounds) $value")
+ cr.moveToNext()
+ continue
+ }
+
+ if (curr != 0.0)
+ glucoseValues += CgmSourceTransaction.TransactionGlucoseValue(
+ timestamp = timestamp,
+ value = value * Constants.MMOLL_TO_MGDL,
+ raw = 0.0,
+ noise = null,
+ trendArrow = GlucoseValue.TrendArrow.NONE,
+ sourceSensor = GlucoseValue.SourceSensor.INTELLIGO_NATIVE
+ )
+ else
+ calibrations.add(
+ CgmSourceTransaction.Calibration(
+ timestamp = timestamp,
+ value = value,
+ glucoseUnit = TherapyEvent.GlucoseUnit.MMOL
+ )
+ )
+ sp.putLong(R.string.key_last_processed_intelligo_timestamp, timestamp)
+ cr.moveToNext()
+ }
+ cr.close()
+
+ if (glucoseValues.isNotEmpty() || calibrations.isNotEmpty())
+ repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, calibrations, null))
+ .doOnError {
+ aapsLogger.error(LTag.DATABASE, "Error while saving values from IntelliGO App", it)
+ }
+ .blockingGet()
+ .also { savedValues ->
+ savedValues.inserted.forEach {
+ xDripBroadcast.send(it)
+ aapsLogger.debug(LTag.DATABASE, "Inserted bg $it")
+ }
+ savedValues.calibrationsInserted.forEach { calibration ->
+ calibration.glucose?.let { glucoseValue ->
+ uel.log(
+ UserEntry.Action.CALIBRATION,
+ UserEntry.Sources.Dexcom,
+ ValueWithUnit.Timestamp(calibration.timestamp),
+ ValueWithUnit.TherapyEventType(calibration.type),
+ ValueWithUnit.fromGlucoseUnit(glucoseValue, calibration.glucoseUnit.toString)
+ )
+ }
+ aapsLogger.debug(LTag.DATABASE, "Inserted calibration $calibration")
+ }
+ }
+ }
+ }
+
+ override fun shouldUploadToNs(glucoseValue: GlucoseValue): Boolean =
+ glucoseValue.sourceSensor == GlucoseValue.SourceSensor.INTELLIGO_NATIVE && sp.getBoolean(R.string.key_dexcomg5_nsupload, false)
+
+ companion object {
+
+ @Suppress("SpellCheckingInspection")
+ const val AUTHORITY = "alexpr.co.uk.infinivocgm.intelligo.cgm_db.CgmExternalProvider"
+
+ //const val AUTHORITY = "alexpr.co.uk.infinivocgm.cgm_db.CgmExternalProvider/"
+ const val TABLE_NAME = "CgmReading"
+ const val INTERVAL = 180000L // 3 min
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt
index fa729c18e4..13e70ab57f 100644
--- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt
+++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt
@@ -232,10 +232,10 @@ class CommandQueueImplementation @Inject constructor(
var carbsRunnable = Runnable { }
val originalCarbs = detailedBolusInfo.carbs
- if ((detailedBolusInfo.carbs > 0) &&
+ if ((detailedBolusInfo.carbs > 0) /*&&
(!activePlugin.activePump.pumpDescription.storesCarbInfo ||
detailedBolusInfo.carbsDuration != 0L ||
- (detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp) > dateUtil.now())
+ (detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp) > dateUtil.now())*/
) {
carbsRunnable = Runnable {
aapsLogger.debug(LTag.PUMPQUEUE, "Going to store carbs")
diff --git a/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt b/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt
index ee3d8e188c..edf8fac07c 100644
--- a/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt
+++ b/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt
@@ -8,6 +8,8 @@ import android.os.SystemClock
import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventPumpStatusChanged
+import info.nightscout.androidaps.extensions.safeDisable
+import info.nightscout.androidaps.extensions.safeEnable
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.Config
@@ -77,10 +79,8 @@ class QueueThread internal constructor(
pump.disconnect("watchdog")
SystemClock.sleep(1000)
(context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.let { bluetoothAdapter ->
- bluetoothAdapter.disable()
- SystemClock.sleep(1000)
- bluetoothAdapter.enable()
- SystemClock.sleep(1000)
+ bluetoothAdapter.safeDisable(1000)
+ bluetoothAdapter.safeEnable(1000)
}
//start over again once after watchdog barked
//Notification notification = new Notification(Notification.OLD_NSCLIENT, "Watchdog", Notification.URGENT);
diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/BTReceiver.kt b/app/src/main/java/info/nightscout/androidaps/receivers/BTReceiver.kt
index 1a034653fa..8d4a97c243 100644
--- a/app/src/main/java/info/nightscout/androidaps/receivers/BTReceiver.kt
+++ b/app/src/main/java/info/nightscout/androidaps/receivers/BTReceiver.kt
@@ -5,15 +5,17 @@ import android.content.Context
import android.content.Intent
import dagger.android.DaggerBroadcastReceiver
import info.nightscout.androidaps.events.EventBTChange
+import info.nightscout.androidaps.extensions.safeGetParcelableExtra
import info.nightscout.androidaps.plugins.bus.RxBus
import javax.inject.Inject
class BTReceiver : DaggerBroadcastReceiver() {
+
@Inject lateinit var rxBus: RxBus
override fun onReceive(context: Context, intent: Intent) {
super.onReceive(context, intent)
- val device: BluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) ?: return
+ val device = intent.safeGetParcelableExtra(BluetoothDevice.EXTRA_DEVICE, BluetoothDevice::class.java) ?: return
when (intent.action) {
BluetoothDevice.ACTION_ACL_CONNECTED ->
diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWHtmlLink.kt b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWHtmlLink.kt
index 73bb625537..0fcf650896 100644
--- a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWHtmlLink.kt
+++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWHtmlLink.kt
@@ -33,7 +33,7 @@ class SWHtmlLink(injector: HasAndroidInjector) : SWItem(injector, Type.HTML_LINK
val context = layout.context
l = TextView(context)
l?.id = View.generateViewId()
- l?.autoLinkMask = Linkify.ALL
+ l?.autoLinkMask = Linkify.WEB_URLS
if (textLabel != null) l?.text = textLabel else l?.setText(label!!)
layout.addView(l)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/XDripBroadcast.kt b/app/src/main/java/info/nightscout/androidaps/utils/XDripBroadcast.kt
index 0553ca7dde..aa67a1964a 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/XDripBroadcast.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/XDripBroadcast.kt
@@ -6,18 +6,19 @@ import android.os.Bundle
import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.androidaps.extensions.safeQueryBroadcastReceivers
import info.nightscout.androidaps.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.interfaces.ResourceHelper
+import info.nightscout.androidaps.receivers.Intents
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
-import info.nightscout.androidaps.receivers.Intents
-import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
import java.text.SimpleDateFormat
-import java.util.*
+import java.util.Locale
import javax.inject.Inject
import javax.inject.Singleton
@@ -41,13 +42,13 @@ class XDripBroadcast @Inject constructor(
intent.putExtras(bundle)
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
context.sendBroadcast(intent)
- val q = context.packageManager.queryBroadcastReceivers(intent, 0)
- return if (q.size < 1) {
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.xdripnotinstalled))
+ val q = context.packageManager.safeQueryBroadcastReceivers(intent, 0)
+ return if (q.isEmpty()) {
+ ToastUtils.errorToast(context, R.string.xdripnotinstalled)
aapsLogger.debug(rh.gs(R.string.xdripnotinstalled))
false
} else {
- ToastUtils.showToastInUiThread(context, rh.gs(R.string.calibrationsent))
+ ToastUtils.errorToast(context, R.string.calibrationsent)
aapsLogger.debug(rh.gs(R.string.calibrationsent))
true
}
@@ -74,8 +75,8 @@ class XDripBroadcast @Inject constructor(
val intent = Intent(Intents.XDRIP_PLUS_NS_EMULATOR)
intent.putExtras(bundle).addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
context.sendBroadcast(intent)
- val receivers = context.packageManager.queryBroadcastReceivers(intent, 0)
- if (receivers.size < 1) {
+ val receivers = context.packageManager.safeQueryBroadcastReceivers(intent, 0)
+ if (receivers.isEmpty()) {
//NSUpload.log.debug("No xDrip receivers found. ")
aapsLogger.debug(LTag.BGSOURCE, "No xDrip receivers found.")
} else {
@@ -150,7 +151,7 @@ class XDripBroadcast @Inject constructor(
}
private fun broadcast(intent: Intent) {
- context.packageManager.queryBroadcastReceivers(intent, 0).forEach { resolveInfo ->
+ context.packageManager.safeQueryBroadcastReceivers(intent, 0).forEach { resolveInfo ->
resolveInfo.activityInfo.packageName?.let {
intent.setPackage(it)
context.sendBroadcast(intent)
diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/CalculationWorkflow.kt b/app/src/main/java/info/nightscout/androidaps/workflow/CalculationWorkflow.kt
index ddae280577..60efbbcd1c 100644
--- a/app/src/main/java/info/nightscout/androidaps/workflow/CalculationWorkflow.kt
+++ b/app/src/main/java/info/nightscout/androidaps/workflow/CalculationWorkflow.kt
@@ -60,12 +60,13 @@ class CalculationWorkflow @Inject constructor(
private val overviewData: OverviewData
get() = (iobCobCalculator as IobCobCalculatorPlugin).overviewData
- enum class ProgressData(val pass: Int, val percentOfTotal: Int) {
+ enum class ProgressData(private val pass: Int, val percentOfTotal: Int) {
PREPARE_BASAL_DATA(0, 5),
PREPARE_TEMPORARY_TARGET_DATA(1, 5),
PREPARE_TREATMENTS_DATA(2, 5),
- IOB_COB_OREF(3, 75),
- PREPARE_IOB_AUTOSENS_DATA(4, 10);
+ IOB_COB_OREF(3, 74),
+ PREPARE_IOB_AUTOSENS_DATA(4, 10),
+ DRAW(5, 1);
fun finalPercent(progress: Int): Int {
var total = 0
diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/UpdateGraphWorker.kt b/app/src/main/java/info/nightscout/androidaps/workflow/UpdateGraphWorker.kt
index 3038afcd6b..f5294d6d7f 100644
--- a/app/src/main/java/info/nightscout/androidaps/workflow/UpdateGraphWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/workflow/UpdateGraphWorker.kt
@@ -7,6 +7,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewGraph
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress
import javax.inject.Inject
class UpdateGraphWorker(
@@ -26,6 +27,7 @@ class UpdateGraphWorker(
overviewPlugin.overviewBus.send(EventUpdateOverviewGraph("UpdateGraphWorker"))
else
rxBus.send(EventUpdateOverviewGraph("UpdateGraphWorker"))
+ rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.DRAW, 100, null))
return Result.success()
}
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/treatments_bolus_carbs_item.xml b/app/src/main/res/layout/treatments_bolus_carbs_item.xml
index a7b458b541..da663f09c2 100644
--- a/app/src/main/res/layout/treatments_bolus_carbs_item.xml
+++ b/app/src/main/res/layout/treatments_bolus_carbs_item.xml
@@ -271,6 +271,16 @@
+
+
diff --git a/app/src/main/res/values-cs-rCZ/strings.xml b/app/src/main/res/values-cs-rCZ/strings.xml
index 8336c1a0de..df7b441723 100644
--- a/app/src/main/res/values-cs-rCZ/strings.xml
+++ b/app/src/main/res/values-cs-rCZ/strings.xml
@@ -656,6 +656,8 @@
Získávat glykémie z aplikace Poctech
Glunovo
Získávat glykémie z aplikace Glunovo
+ Intelligo
+ Přijímat hodnoty z aplikace Intelligo
Přijímat hodnoty glykémií z Tomato aplikace (MiaoMiao zařízení)
Vysoký dočasný cíl zvýší senzitivitu
= 5.5]]>
diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml
index e8f55b0a79..05b3ec61db 100644
--- a/app/src/main/res/values-es-rES/strings.xml
+++ b/app/src/main/res/values-es-rES/strings.xml
@@ -656,6 +656,8 @@
Recibir los valores de glucosa de Poctech
Glunovo
Recibir los valores de glucosa de la aplicación Glunovo
+ Intelligo
+ Recibir los valores de glucosa de Intelligo
Recibir los valores de glucosa de Tomato App (MiaoMiao)
Objetivo temporal elevado aumenta sensibilidad
= 100]]>
diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml
index a166f7fd52..0994970072 100644
--- a/app/src/main/res/values-fr-rFR/strings.xml
+++ b/app/src/main/res/values-fr-rFR/strings.xml
@@ -657,6 +657,8 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Recevoir les glycémies depuis l\'app Poctech
Glunovo
Recevoir des valeurs de l\'application Glunovo
+ Intelligo
+ Recevoir des valeurs depuis l\'application Intelligo
Recevoir les valeurs de glycémie de l\'application Tomato (appareil MiaoMiao)
Cible temp. haute élève la sensibilité
= 100]]>
diff --git a/app/src/main/res/values-it-rIT/strings.xml b/app/src/main/res/values-it-rIT/strings.xml
index 4b4ccb5887..e7e348bc57 100644
--- a/app/src/main/res/values-it-rIT/strings.xml
+++ b/app/src/main/res/values-it-rIT/strings.xml
@@ -656,6 +656,8 @@
Ricevi valori glicemia da app Poctech
Glunovo
Ricevi valori glicemia da app Glunovo
+ Intelligo
+ Ricevi valori da app Intelligo
Ricevi valori glicemia da app Tomato (dispositivo MiaoMiao)
Temp-Target \"alto\" aumenta la sensibilità
= 100]]>
@@ -665,6 +667,7 @@
Quando viene rilevata resistenza, ridurre la glicemia target
La sensibilità aumenta il target
Quando viene rilevata sensibilità, aumentare la glicemia target
+ Rimuovi le voci \"AAPS avviato\"
Mostra invalidato
Nascondi invalidato
Rimuovi elementi
diff --git a/app/src/main/res/values-iw-rIL/strings.xml b/app/src/main/res/values-iw-rIL/strings.xml
index 438fa5b589..08e5005ad6 100644
--- a/app/src/main/res/values-iw-rIL/strings.xml
+++ b/app/src/main/res/values-iw-rIL/strings.xml
@@ -656,6 +656,8 @@
קבלת ערכי סוכר מיישום Poctech
Glunovo
קבלת ערכי סוכר מיישום Glunovo
+ Intelligo
+ קבלת ערכי סוכר מיישום Intelligo
קבלת ערכי סוכר מאפליקציית Tomato (התקן MiaoMiao)
ערך מטרה זמני גבוה מעלה את הרגישות
= 100]]>
diff --git a/app/src/main/res/values-no-rNO/strings.xml b/app/src/main/res/values-no-rNO/strings.xml
index 9641693ebc..d2f92a2003 100644
--- a/app/src/main/res/values-no-rNO/strings.xml
+++ b/app/src/main/res/values-no-rNO/strings.xml
@@ -656,6 +656,8 @@
Motta BS verdier fra Poctech app
Glunovo
Motta BS verdier fra Glunovo app
+ Intelligo
+ Motta BS-verdier fra Intelligo-app
Motta BS verdier fra Tomato app (MiaoMiao enhet)
Høy temp target øker sensitiviteten
= 100]]>
@@ -665,6 +667,7 @@
Hvis resistens oppdages vil det redusere BS målverdi
Sensitivitet øker BS målverdi
Når systemet oppdager økt insulinsensitivitet, vil BS målverdi økes
+ Fjern oppføringer startet av AAPS
Vis ugyldige oppføringer
Skjul ugyldige oppføringer
Fjern oppføringer
diff --git a/app/src/main/res/values-ru-rRU/strings.xml b/app/src/main/res/values-ru-rRU/strings.xml
index 0bf687cd4a..b67db7bab7 100644
--- a/app/src/main/res/values-ru-rRU/strings.xml
+++ b/app/src/main/res/values-ru-rRU/strings.xml
@@ -656,6 +656,8 @@
Получать данные гликемии от приложения Poctech
Приложение Glunovo
Получать данные гликемии от приложения Glunovo
+ Приложение Intelligo
+ Получать данные гликемии от приложения Intelligo
Получать значения ГК от приложения Tomato (устройство MiaoMiao)
Высокая врем. цель temptarget повышает чувствительность
= 100]]>
diff --git a/app/src/main/res/values-sk-rSK/strings.xml b/app/src/main/res/values-sk-rSK/strings.xml
index 6fd9a964c7..2049d01f4a 100644
--- a/app/src/main/res/values-sk-rSK/strings.xml
+++ b/app/src/main/res/values-sk-rSK/strings.xml
@@ -656,6 +656,8 @@
Získavať glykémie z aplikácie Poctech
Glunovo
Získavať glykémie z aplikácie Glunovo
+ Intelligo
+ Prijímať hodnoty z aplikácie Intelligo
Prijímať glykémie z aplikácie Tomato (zariadenie MiaoMiao)
Vysoký dočasný cieľ zvýši citlivosť
= 5.5]]>
diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml
index a75a61225e..582181e940 100644
--- a/app/src/main/res/values-tr-rTR/strings.xml
+++ b/app/src/main/res/values-tr-rTR/strings.xml
@@ -657,6 +657,8 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
Poctech uygulamasından KŞ değerlerini alır
Glunovo
Glunovo uygulamasından değerler alır
+ Intelligo
+ Intelligo uygulamasından değerler alır
KŞ değerlerini Tomato uygulamasından (MiaoMiao Cihazından) al
Yüksek geçici hedefler duyarlılığı artırır
= 100]]>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index de4abf23c9..069cdb3e2f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -801,6 +801,8 @@
Receive BG values from Poctech app
Glunovo
Receive values from Glunovo app
+ Intelligo
+ Receive values from Intelligo app
Receive BG values from Tomato app (MiaoMiao device)
high_temptarget_raises_sensitivity
low_temptarget_lowers_sensitivity
@@ -1126,6 +1128,8 @@
Recalculated data used
BG too close:\n%1$s\n%2$s
last_processed_glunovo_timestamp
+
+ last_processed_intelligo_timestamp
Identification (email, FB or Discord nick etc)
Identification not set in dev mode
dialog
diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
index b38aeded92..dbbb566b54 100644
--- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
+++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
@@ -121,7 +121,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener, MenuProvider {
true
}
- else -> false
+ else -> super.onContextItemSelected(item)
}
@SuppressLint("NotifyDataSetChanged")
diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.kt
index 783b9dace3..cdafc9c788 100644
--- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.kt
+++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/dialogs/EditEventDialog.kt
@@ -128,7 +128,7 @@ class EditEventDialog : DialogFragmentWithDate() {
// check for title
val title = binding.inputEventTitle.text?.toString() ?: return false
if (title.isEmpty()) {
- context?.let { ToastUtils.showToastInUiThread(it, R.string.automation_missing_task_name) }
+ context?.let { ToastUtils.errorToast(it, R.string.automation_missing_task_name) }
return false
}
event.title = title
@@ -137,12 +137,12 @@ class EditEventDialog : DialogFragmentWithDate() {
// check for at least one trigger
val con = event.trigger
if (con.size() == 0 && !event.userAction) {
- context?.let { ToastUtils.showToastInUiThread(it, R.string.automation_missing_trigger) }
+ context?.let { ToastUtils.errorToast(it, R.string.automation_missing_trigger) }
return false
}
// check for at least one action
if (event.actions.isEmpty()) {
- context?.let { ToastUtils.showToastInUiThread(it, R.string.automation_missing_action) }
+ context?.let { ToastUtils.errorToast(it, R.string.automation_missing_action) }
return false
}
// store
diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt
index 0461810d0d..6174cccc16 100644
--- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt
+++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionsTestBase.kt
@@ -31,6 +31,7 @@ ActionsTestBase : TestBaseWithProfile() {
private var suspended = false
override var lastRun: Loop.LastRun? = Loop.LastRun()
+ override var closedLoopEnabled: Constraint? = Constraint(true)
override val isSuspended: Boolean = suspended
override val isLGS: Boolean = false
override val isSuperBolus: Boolean = false
diff --git a/build.gradle b/build.gradle
index cc611b52b7..1010b0feb5 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,20 +3,20 @@
buildscript {
ext {
kotlin_version = '1.7.10'
- core_version = '1.8.0'
+ core_version = '1.9.0'
rxjava_version = '3.1.5'
rxandroid_version = '3.0.0'
rxkotlin_version = '3.0.1'
room_version = '2.4.3'
lifecycle_version = '2.5.1'
- dagger_version = '2.43'
+ dagger_version = '2.44'
coroutines_version = '1.6.4'
activity_version = '1.4.0'
fragmentktx_version = '1.4.1'
ormLite_version = '4.46'
gson_version = '2.9.1'
nav_version = '2.4.2'
- appcompat_version = '1.4.2'
+ appcompat_version = '1.5.1'
material_version = '1.6.1'
constraintlayout_version = '2.1.4'
preferencektx_version = '1.2.0'
@@ -26,7 +26,7 @@ buildscript {
work_version = '2.7.1'
tink_version = '1.5.0'
json_version = '20220320'
- joda_version = '2.11.0.1'
+ joda_version = '2.11.2'
junit_version = '4.13.2'
mockito_version = '4.4.0'
@@ -51,9 +51,9 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" } // jacoco 0.2
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.2.2'
+ classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.google.gms:google-services:4.3.13'
- classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
+ classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt b/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt
index 36eb63de96..b467d78c87 100644
--- a/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt
+++ b/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt
@@ -107,7 +107,8 @@ class DetailedBolusInfo {
Bolus(
timestamp = bolusTimestamp ?: timestamp,
amount = insulin,
- type = bolusType.toDBbBolusType()
+ type = bolusType.toDBbBolusType(),
+ notes = notes,
)
else null
@@ -116,7 +117,8 @@ class DetailedBolusInfo {
Carbs(
timestamp = carbsTimestamp ?: timestamp,
amount = carbs,
- duration = carbsDuration
+ duration = carbsDuration,
+ notes = notes,
)
else null
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/BluetoothAdapterExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/BluetoothAdapterExtension.kt
new file mode 100644
index 0000000000..b247800ef9
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/BluetoothAdapterExtension.kt
@@ -0,0 +1,36 @@
+package info.nightscout.androidaps.extensions
+
+import android.bluetooth.BluetoothAdapter
+import android.os.SystemClock
+
+/**
+ * @param waitMilliseconds if !=0 wait after enable()
+ * @param after Runnable to execute after enable()
+ *
+ * @return true if enable was executed or not necessary
+ */
+fun BluetoothAdapter.safeEnable(waitMilliseconds: Long = 0, after: Runnable? = null): Boolean =
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) false
+ else @Suppress("DEPRECATION") {
+ if (!isEnabled) {
+ val result = enable()
+ if (waitMilliseconds != 0L) SystemClock.sleep(waitMilliseconds)
+ after?.run()
+ result
+ } else true
+ }
+
+/**
+ * @param waitMilliseconds if !=0 wait after disable()
+ *
+ * @return true if disable was executed or not necessary
+ */
+fun BluetoothAdapter.safeDisable(waitMilliseconds: Long = 0): Boolean =
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) false
+ else @Suppress("DEPRECATION") {
+ if (isEnabled) {
+ val result = disable()
+ if (waitMilliseconds != 0L) SystemClock.sleep(waitMilliseconds)
+ result
+ } else true
+ }
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt
index 6c2df8d032..065b3ac2ef 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt
@@ -30,6 +30,7 @@ fun Bolus.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
.put("created_at", dateUtil.toISOString(timestamp))
.put("date", timestamp)
.put("type", type.name)
+ .put("notes", notes)
.put("isValid", isValid)
.put("isSMB", type == Bolus.Type.SMB).also {
if (interfaceIDs.pumpId != null) it.put("pumpId", interfaceIDs.pumpId)
@@ -55,6 +56,7 @@ fun bolusFromJson(jsonObject: JSONObject): Bolus? {
val amount = JsonHelper.safeGetDoubleAllowNull(jsonObject, "insulin") ?: return null
val type = Bolus.Type.fromString(JsonHelper.safeGetString(jsonObject, "type"))
val isValid = JsonHelper.safeGetBoolean(jsonObject, "isValid", true)
+ val notes = JsonHelper.safeGetStringAllowNull(jsonObject, "notes", null)
val id = JsonHelper.safeGetStringAllowNull(jsonObject, "_id", null) ?: return null
val pumpId = JsonHelper.safeGetLongAllowNull(jsonObject, "pumpId", null)
val pumpType = InterfaceIDs.PumpType.fromString(JsonHelper.safeGetStringAllowNull(jsonObject, "pumpType", null))
@@ -67,7 +69,8 @@ fun bolusFromJson(jsonObject: JSONObject): Bolus? {
timestamp = timestamp,
amount = amount,
type = type,
- isValid = isValid
+ notes = notes,
+ isValid = isValid,
).also {
it.interfaceIDs.nightscoutId = id
it.interfaceIDs.pumpId = pumpId
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/CarbsExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/CarbsExtension.kt
index b3c6e6ac81..2c01a65105 100644
--- a/core/src/main/java/info/nightscout/androidaps/extensions/CarbsExtension.kt
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/CarbsExtension.kt
@@ -11,6 +11,7 @@ fun Carbs.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
JSONObject()
.put("eventType", if (amount < 12) TherapyEvent.Type.CARBS_CORRECTION.text else TherapyEvent.Type.MEAL_BOLUS.text)
.put("carbs", amount)
+ .put("notes", notes)
.put("created_at", dateUtil.toISOString(timestamp))
.put("isValid", isValid)
.put("date", timestamp).also {
@@ -29,6 +30,7 @@ fun carbsFromNsIdForInvalidating(nsId: String): Carbs =
JSONObject()
.put("mills", 1)
.put("carbs", -1.0)
+ .put("notes", null)
.put("_id", nsId)
.put("isValid", false)
)!!
@@ -37,6 +39,7 @@ fun carbsFromJson(jsonObject: JSONObject): Carbs? {
val timestamp = JsonHelper.safeGetLongAllowNull(jsonObject, "mills", null) ?: return null
val duration = JsonHelper.safeGetLong(jsonObject, "duration")
val amount = JsonHelper.safeGetDoubleAllowNull(jsonObject, "carbs") ?: return null
+ val notes = JsonHelper.safeGetStringAllowNull(jsonObject, "notes", null)
val isValid = JsonHelper.safeGetBoolean(jsonObject, "isValid", true)
val id = JsonHelper.safeGetStringAllowNull(jsonObject, "_id", null) ?: return null
val pumpId = JsonHelper.safeGetLongAllowNull(jsonObject, "pumpId", null)
@@ -50,6 +53,7 @@ fun carbsFromJson(jsonObject: JSONObject): Carbs? {
timestamp = timestamp,
duration = duration,
amount = amount,
+ notes = notes,
isValid = isValid
).also {
it.interfaceIDs.nightscoutId = id
diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/IntentExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/IntentExtension.kt
new file mode 100644
index 0000000000..0390ef0ac5
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/extensions/IntentExtension.kt
@@ -0,0 +1,19 @@
+package info.nightscout.androidaps.extensions
+
+import android.content.Intent
+import java.io.Serializable
+
+/**
+ * Safe version of getParcelableExtra depending on Android version running
+ */
+fun Intent.safeGetParcelableExtra(name: String?, clazz: Class): T? =
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) getParcelableExtra(name, clazz)
+ else @Suppress("DEPRECATION") getParcelableExtra(name)
+
+/**
+ * Safe version of getSerializableExtra depending on Android version running
+ */
+@Suppress("UNCHECKED_CAST")
+fun Intent.safeGetSerializableExtra(name: String?, clazz: Class): T? =
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) getSerializableExtra(name, clazz)
+ else @Suppress("DEPRECATION") (getSerializableExtra(name) as T?)
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt
index fdf44f4661..284cb71ae7 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt
@@ -22,6 +22,7 @@ interface Loop {
}
var lastRun: LastRun?
+ var closedLoopEnabled: Constraint?
val isSuspended: Boolean
val isLGS: Boolean
val isSuperBolus: Boolean
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt
index e6d5eff434..eed259d3e8 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt
@@ -33,7 +33,7 @@ class PumpDescription() {
var basalMaximumRate = 0.0
var isRefillingCapable = false
var isBatteryReplaceable = false
- var storesCarbInfo = false
+ //var storesCarbInfo = false
var is30minBasalRatesCapable = false
var supportsTDDs = false
var needsManualTDDLoad = false
@@ -41,7 +41,7 @@ class PumpDescription() {
var isPatchPump = false
var useHardwareLink = false
- fun resetSettings() {
+ private fun resetSettings() {
isBolusCapable = true
bolusStep = 0.1
isExtendedBolusCapable = true
@@ -65,7 +65,7 @@ class PumpDescription() {
is30minBasalRatesCapable = false
isRefillingCapable = true
isBatteryReplaceable = true
- storesCarbInfo = false
+ //storesCarbInfo = false
supportsTDDs = false
needsManualTDDLoad = true
hasCustomUnreachableAlertCheck = false
@@ -101,7 +101,7 @@ class PumpDescription() {
basalMinimumRate = pumpType.baseBasalMinValue
isRefillingCapable = pumpCapability.hasCapability(PumpCapability.Refill)
isBatteryReplaceable = pumpCapability.hasCapability(PumpCapability.ReplaceBattery)
- storesCarbInfo = pumpCapability.hasCapability(PumpCapability.StoreCarbInfo)
+ //storesCarbInfo = pumpCapability.hasCapability(PumpCapability.StoreCarbInfo)
supportsTDDs = pumpCapability.hasCapability(PumpCapability.TDD)
needsManualTDDLoad = pumpCapability.hasCapability(PumpCapability.ManualTDDLoad)
is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min)
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefsFileContract.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefsFileContract.kt
index a56296aace..9fafc080f9 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefsFileContract.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefsFileContract.kt
@@ -4,6 +4,7 @@ import android.content.Context
import android.content.Intent
import androidx.activity.result.contract.ActivityResultContract
import androidx.fragment.app.FragmentActivity
+import info.nightscout.androidaps.extensions.safeGetParcelableExtra
import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity
class PrefsFileContract : ActivityResultContract() {
@@ -15,7 +16,7 @@ class PrefsFileContract : ActivityResultContract() {
override fun parseResult(resultCode: Int, intent: Intent?): PrefsFile? {
return when (resultCode) {
- FragmentActivity.RESULT_OK -> intent?.getParcelableExtra(OUTPUT_PARAM)
+ FragmentActivity.RESULT_OK -> intent?.safeGetParcelableExtra(OUTPUT_PARAM, PrefsFile::class.java)
else -> null
}
}
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt
index 2bc71881ef..33c753ec20 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt
@@ -114,7 +114,7 @@ class PrefImportListActivity : DaggerAppCompatActivity() {
finish()
return true
}
- return false
+ return super.onOptionsItemSelected(item)
}
override fun attachBaseContext(newBase: Context) {
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/ble/BlePreCheck.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/ble/BlePreCheck.kt
index 3d96e24bc4..6b82a07878 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/ble/BlePreCheck.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/ble/BlePreCheck.kt
@@ -7,14 +7,14 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.location.LocationManager
import android.os.Build
-import android.os.SystemClock
import android.provider.Settings
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import info.nightscout.androidaps.core.R
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog
+import info.nightscout.androidaps.extensions.safeEnable
import info.nightscout.androidaps.interfaces.ResourceHelper
+import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import javax.inject.Inject
import javax.inject.Singleton
@@ -54,10 +54,7 @@ class BlePreCheck @Inject constructor(
val bluetoothAdapter = (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter
// Ensures Bluetooth is available on the device and it is enabled. If not,
// displays a dialog requesting user permission to enable Bluetooth.
- if (bluetoothAdapter?.isEnabled != true) {
- bluetoothAdapter?.enable()
- SystemClock.sleep(3000)
- }
+ bluetoothAdapter?.safeEnable(3000)
if (bluetoothAdapter?.isEnabled != true) {
OKDialog.show(activity, rh.gs(R.string.message), rh.gs(R.string.ble_not_enabled))
return false
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpCapability.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpCapability.kt
index 5f9d9c0571..c2555efeac 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpCapability.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpCapability.kt
@@ -8,7 +8,7 @@ enum class PumpCapability {
BasalProfileSet, // isSetBasalProfileCapable
Refill, // isRefillingCapable
ReplaceBattery, // isBatteryReplaceable
- StoreCarbInfo, // storesCarbInfo
+ // StoreCarbInfo, // removed. incompatible with storing notes with carbs
TDD, // supportsTDDs
ManualTDDLoad, // needsManualTDDLoad
BasalRate30min, // is30minBasalRatesCapable
@@ -18,7 +18,8 @@ enum class PumpCapability {
VirtualPumpCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery)),
ComboCapabilities(arrayOf(Bolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, ManualTDDLoad)),
DanaCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, ManualTDDLoad)),
- DanaWithHistoryCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, StoreCarbInfo, TDD, ManualTDDLoad)),
+ //DanaWithHistoryCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, StoreCarbInfo, TDD, ManualTDDLoad)),
+ DanaWithHistoryCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, ManualTDDLoad)),
InsightCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, BasalRate30min)),
MedtronicCapabilities(arrayOf(Bolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD)),
OmnipodCapabilities(arrayOf(Bolus, TempBasal, BasalProfileSet, BasalRate30min)),
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/ToastUtils.kt b/core/src/main/java/info/nightscout/androidaps/utils/ToastUtils.kt
index 5d2ef2f6ae..b0fcf672d3 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/ToastUtils.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/ToastUtils.kt
@@ -10,11 +10,13 @@ import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.annotation.DrawableRes
+import androidx.annotation.StringRes
import androidx.appcompat.view.ContextThemeWrapper
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
+import info.nightscout.androidaps.utils.resources.getThemeColor
object ToastUtils {
@@ -27,10 +29,18 @@ object ToastUtils {
graphicalToast(ctx, string, R.drawable.ic_toast_warn, true)
}
+ fun warnToast(ctx: Context?, @StringRes id: Int) {
+ graphicalToast(ctx, ctx?.getString(id), R.drawable.ic_toast_warn, true)
+ }
+
fun infoToast(ctx: Context?, string: String?) {
graphicalToast(ctx, string, R.drawable.ic_toast_info, true)
}
+ fun infoToast(ctx: Context?, @StringRes id: Int) {
+ graphicalToast(ctx, ctx?.getString(id), R.drawable.ic_toast_info, true)
+ }
+
fun okToast(ctx: Context?, string: String?) {
graphicalToast(ctx, string, R.drawable.ic_toast_check, true)
}
@@ -39,6 +49,10 @@ object ToastUtils {
graphicalToast(ctx, string, R.drawable.ic_toast_error, true)
}
+ fun errorToast(ctx: Context?, @StringRes id: Int) {
+ graphicalToast(ctx, ctx?.getString(id), R.drawable.ic_toast_error, true)
+ }
+
fun graphicalToast(ctx: Context?, string: String?, @DrawableRes iconId: Int) {
graphicalToast(ctx, string, iconId, true)
}
@@ -63,7 +77,15 @@ object ToastUtils {
fun showToastInUiThread(ctx: Context?, string: String?) {
val mainThread = Handler(Looper.getMainLooper())
- mainThread.post { Toast.makeText(ctx, string, Toast.LENGTH_SHORT).show() }
+ mainThread.post {
+ val toast: Toast =
+ Toast.makeText(
+ ctx,
+ HtmlHelper.fromHtml("" + string + ""),
+ Toast.LENGTH_SHORT
+ )
+ toast.show()
+ }
}
fun showToastInUiThread(
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt b/core/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt
index f3b8083baa..16f32a7035 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt
@@ -23,7 +23,7 @@ object BiometricCheck {
ERROR_VENDOR,
ERROR_LOCKOUT_PERMANENT,
ERROR_USER_CANCELED -> {
- ToastUtils.showToastInUiThread(activity.baseContext, errString.toString())
+ ToastUtils.errorToast(activity.baseContext, errString.toString())
// fallback to master password
runOnUiThread {
passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
@@ -34,7 +34,7 @@ object BiometricCheck {
cancel?.run()
ERROR_NO_DEVICE_CREDENTIAL -> {
- ToastUtils.showToastInUiThread(activity.baseContext, errString.toString())
+ ToastUtils.errorToast(activity.baseContext, errString.toString())
// no pin set
// fallback to master password
runOnUiThread {
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt b/core/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt
index 9d03d04cbc..24b67debb7 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt
@@ -148,7 +148,7 @@ class PasswordCheck @Inject constructor(
.setNegativeButton(context.getString(R.string.cancel)
) { dialog, _ ->
val msg = if (pinInput) R.string.pin_not_changed else R.string.password_not_changed
- ToastUtils.infoToast(context, context.getString(msg))
+ ToastUtils.infoToast(context, msg)
cancel?.invoke()
dialog.cancel()
}
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/ui/NumberPicker.kt b/core/src/main/java/info/nightscout/androidaps/utils/ui/NumberPicker.kt
index 71d0b7c392..cb0da420a1 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/ui/NumberPicker.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/ui/NumberPicker.kt
@@ -3,6 +3,7 @@ package info.nightscout.androidaps.utils.ui
import android.annotation.SuppressLint
import android.app.Service
import android.content.Context
+import android.os.Build
import android.os.Handler
import android.os.Looper
import android.os.Message
@@ -146,14 +147,17 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
if (manager.isEnabled) {
val valueDescription = formatter?.format(currentValue)
- AccessibilityEvent.obtain().apply {
- eventType = AccessibilityEvent.TYPE_ANNOUNCEMENT
- className = javaClass.name
- packageName = context.packageName
- text.add(valueDescription)
- }.also {
- manager.sendAccessibilityEvent(it)
- }
+ @Suppress("DEPRECATION")
+ (if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) AccessibilityEvent()
+ else AccessibilityEvent.obtain())
+ .apply {
+ eventType = AccessibilityEvent.TYPE_ANNOUNCEMENT
+ className = javaClass.name
+ packageName = context.packageName
+ text.add(valueDescription)
+ }.also {
+ manager.sendAccessibilityEvent(it)
+ }
}
}
@@ -173,13 +177,13 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
currentValue = SafeParse.stringToDouble(binding.editText.text.toString())
if (currentValue > maxValue) {
currentValue = maxValue
- ToastUtils.showToastInUiThread(context, context.getString(R.string.youareonallowedlimit))
+ ToastUtils.warnToast(context, R.string.youareonallowedlimit)
updateEditText()
okButton?.visibility = VISIBLE
}
if (currentValue < minValue) {
currentValue = minValue
- ToastUtils.showToastInUiThread(context, context.getString(R.string.youareonallowedlimit))
+ ToastUtils.warnToast(context, R.string.youareonallowedlimit)
updateEditText()
okButton?.visibility = VISIBLE
}
@@ -216,11 +220,11 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
get() {
if (currentValue > maxValue) {
currentValue = maxValue
- ToastUtils.showToastInUiThread(context, context.getString(R.string.youareonallowedlimit))
+ ToastUtils.warnToast(context, R.string.youareonallowedlimit)
}
if (currentValue < minValue) {
currentValue = minValue
- ToastUtils.showToastInUiThread(context, context.getString(R.string.youareonallowedlimit))
+ ToastUtils.warnToast(context, R.string.youareonallowedlimit)
}
return currentValue
}
@@ -229,11 +233,11 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
currentValue = value
if (currentValue > maxValue) {
currentValue = maxValue
- ToastUtils.showToastInUiThread(context, context.getString(R.string.youareonallowedlimit))
+ ToastUtils.warnToast(context, R.string.youareonallowedlimit)
}
if (currentValue < minValue) {
currentValue = minValue
- ToastUtils.showToastInUiThread(context, context.getString(R.string.youareonallowedlimit))
+ ToastUtils.warnToast(context, R.string.youareonallowedlimit)
}
callValueChangedListener()
updateEditText()
@@ -248,7 +252,7 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
if (currentValue > maxValue) {
currentValue = maxValue
callValueChangedListener()
- ToastUtils.showToastInUiThread(context, context.getString(R.string.youareonallowedlimit))
+ ToastUtils.warnToast(context, R.string.youareonallowedlimit)
stopUpdating()
}
updateEditText()
@@ -259,7 +263,7 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
if (currentValue < minValue) {
currentValue = minValue
callValueChangedListener()
- ToastUtils.showToastInUiThread(context, context.getString(R.string.youareonallowedlimit))
+ ToastUtils.warnToast(context, R.string.youareonallowedlimit)
stopUpdating()
}
updateEditText()
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt b/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt
index 702b14e31c..c0857b6247 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt
@@ -73,6 +73,7 @@ class UserEntryPresentationHelper @Inject constructor(
Sources.PocTech -> R.drawable.ic_poctech
Sources.Tomato -> R.drawable.ic_sensor
Sources.Glunovo -> R.drawable.ic_glunovo
+ Sources.Intelligo -> R.drawable.ic_intelligo
Sources.Xdrip -> R.drawable.ic_blooddrop_48
Sources.LocalProfile -> R.drawable.ic_local_profile
Sources.Loop -> R.drawable.ic_loop_closed_white
diff --git a/core/src/main/res/drawable/ic_intelligo.xml b/core/src/main/res/drawable/ic_intelligo.xml
new file mode 100644
index 0000000000..6fe7de817b
--- /dev/null
+++ b/core/src/main/res/drawable/ic_intelligo.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/src/main/res/layout/toast.xml b/core/src/main/res/layout/toast.xml
index 8b79189760..a3831a8e83 100644
--- a/core/src/main/res/layout/toast.xml
+++ b/core/src/main/res/layout/toast.xml
@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:background="@drawable/toast_border_ok">
+ android:background="?attr/toastBackgroundColor">
diff --git a/core/src/main/res/values-es-rES/strings.xml b/core/src/main/res/values-es-rES/strings.xml
index 6e004b1947..8f609f9db3 100644
--- a/core/src/main/res/values-es-rES/strings.xml
+++ b/core/src/main/res/values-es-rES/strings.xml
@@ -31,6 +31,7 @@
%1$d min
Bomba ocupada
Error de conexión de la bomba
+ Límite permitido alcanzado
Objetivos
Cerrar
Por favor, espere…
@@ -39,6 +40,7 @@
STOP pulsado
Detener
Carbohidratos [g]
+ ¡Perfil inválido!
NINGÚN PERFIL ACTIVO
]]>
Fecha
@@ -51,6 +53,7 @@
Duración de la insulina activa
Ratio de insulina/carbohidratos
Factor de sensibilidad a la insulina
+ Tasa basal
Objetivo de glucosa en sangre
Iniciando...
Número de serie
@@ -137,6 +140,7 @@
Los códigos PIN no coinciden
Valores basales no alineados a las horas: %1$s
+ Valor basal cambiado al valor mínimo soportado: %1$s
Valor basal reemplazado por el valor máximo soportado: %1$s
/U
U/h
@@ -217,6 +221,7 @@
Esperando resultado
SMB
+ %1$d g carbohidratos adicionales necesarios en %2$d minutos
Estadísticas
TDD acumulada
@@ -228,6 +233,7 @@
# Días
Peso
Probablemente impreciso si se usan bolos para llenar/rellenar!
+ Datos caducados, por favor pulsa \"RECARGAR\"
Basal total
Basal diaria *2
@@ -391,6 +397,9 @@
»%1$s« está fuera del límite estricto
»%1$s« %2$.2f está fuera de los límites estrictos
Valor basal
+ La versión de NSClient no coincide con la versión de AndroidAPS. Por favor, actualízala.
+
+.
BOLO %1$.2f U
CARBOHIDRATOS %1$d g
diff --git a/core/src/main/res/values-fr-rFR/strings.xml b/core/src/main/res/values-fr-rFR/strings.xml
index ac6f8ca25a..58dcd6aa23 100644
--- a/core/src/main/res/values-fr-rFR/strings.xml
+++ b/core/src/main/res/values-fr-rFR/strings.xml
@@ -446,7 +446,7 @@
Aide pour ajuster le profil (SI, rapport G/I et débits de basal)
AT
Paramètres Autotune
- Changr le profil avec l\'automatisation
+ Changer le profil avec l\'automatisation
Si activé, Autotune mettra à jour automatiquement à jour le profil sélectionné et activera le profil calculé effectué à partir d\'une règle d\'automatisation.
Catégoriser UAM en tant que Basal
Activer uniquement si vous avez correctement saisi tous les glucides consommés, avec cette option, des hausses soudaines vues par Autotune seront utilisées pour modifier les débits de basal.
diff --git a/core/src/main/res/values-it-rIT/strings.xml b/core/src/main/res/values-it-rIT/strings.xml
index a7f4e0fd5e..2bfcb0f0be 100644
--- a/core/src/main/res/values-it-rIT/strings.xml
+++ b/core/src/main/res/values-it-rIT/strings.xml
@@ -31,6 +31,7 @@
%1$d min
Il micro è occupato
Errore connessione micro
+ Limite consentito raggiunto
Obiettivi
Chiudi
Attendi…
@@ -39,6 +40,7 @@
STOP PREMUTO
Stop
CHO
+ Profilo non valido!
NESSUN PROFILO IMPOSTATO
]]>
Data
@@ -51,6 +53,7 @@
Durata dell’azione dell’insulina
Rapporto Insulina-Carboidrati (I:C)
Fattore di sensibilità insulinica (ISF)
+ Velocità basale
Target glicemia
Inizializzazione...
Numero seriale
@@ -137,6 +140,7 @@
I PIN non coincidono
Valori basali non allineati alle ore: %1$s
+ Valore basale sostituito dal minimo valore supportato: %1$s
Valore basale sostituito dal massimo valore supportato: %1$s
/U
U/h
@@ -217,6 +221,7 @@
In attesa del risultato
SMB
+ %1$d g di CHO aggiuntivi richiesti entro %2$d minuti
Statistiche
TDD cumulativo
@@ -228,6 +233,7 @@
# Giorni
Peso
Probabilmente inaccurato se per il caricamento/riempimento si usano i boli al posto dell\'apposita funzione!
+ Dati vecchi, premi \"RICARICA\"
Basale originale totale
TBB * 2
@@ -391,6 +397,7 @@
»%1$s« è fuori dai limiti consentiti
»%1$s« %2$.2f è fuori dai limiti consentiti
Valore basale
+ La versione di NSClient non corrisponde alla versione di AndroidAPS. Aggiorna.
BOLO %1$.2f U
CHO %1$d g
diff --git a/core/src/main/res/values-night/colors.xml b/core/src/main/res/values-night/colors.xml
index 3b47049571..3821d1e840 100644
--- a/core/src/main/res/values-night/colors.xml
+++ b/core/src/main/res/values-night/colors.xml
@@ -109,7 +109,7 @@
#666666
- #ffffff
+ #000000
#77dd77
#ff0400
#FF8C00
diff --git a/core/src/main/res/values-night/styles.xml b/core/src/main/res/values-night/styles.xml
index dfd244db24..76ebef4e7d 100644
--- a/core/src/main/res/values-night/styles.xml
+++ b/core/src/main/res/values-night/styles.xml
@@ -95,6 +95,7 @@
- @color/defaultBackground
- @color/toastBase
+ - @color/buttonBackground
- @style/DialogTheme
- @style/DialogTheme
diff --git a/core/src/main/res/values-no-rNO/strings.xml b/core/src/main/res/values-no-rNO/strings.xml
index 6bc8659f74..c005ab5b90 100644
--- a/core/src/main/res/values-no-rNO/strings.xml
+++ b/core/src/main/res/values-no-rNO/strings.xml
@@ -31,6 +31,7 @@
%1$d min
Pumpen er opptatt
Tilkoblingsfeil til pumpe
+ Tillatt grense nådd
Opplæringsmål
Lukk
Vennligst vent…
@@ -39,6 +40,7 @@
STOPP trykket
Stopp
Karbohydrater
+ Ugyldig profil!
INGEN PROFIL VALGT
]]>
Dato
@@ -51,6 +53,7 @@
Insulinets virkningstid (DIA)
Insulin- til karbohydratfaktor
Insulin sensitivitetsfaktor (ISF)
+ Basalrate
Blodsukkermål
Starter opp...
Serienummer
@@ -137,6 +140,7 @@
PIN-kodene samsvarer ikke
Basal verdier er ikke angitt på hele timer: %1$s
+ Basalverdi erstattet med minste tillate verdi: %1$s
Basal verdi erstattet med høyeste tillate verdi: %1$s
/E
E/t
@@ -217,6 +221,7 @@
Venter på resultat
SMB
+ %1$d g ekstra karbohydrater kreves innen %2$d minutter
Statistikk
Akkumulert TDD
@@ -228,6 +233,7 @@
Antall dager
Vekt
Kan vise feil hvis bolus brukes for priming/fylling!
+ Gamle data. Vennligst trykk \"HENT\"
Total grunnbasal
TBB * 2
@@ -391,6 +397,7 @@
»%1$s« er utenfor lovlige grenseverdier
»%1$s« %2$.2f er utenfor lovlige grenseverdier
Basal verdi
+ NSClient-versjonen samsvarer ikke med AndroidAPS-versjonen. Vennligst oppdater.
BOLUS %1$.2f E
CARBS %1$d g
diff --git a/core/src/main/res/values-ru-rRU/strings.xml b/core/src/main/res/values-ru-rRU/strings.xml
index 1d16f4c8bc..ef3e02262c 100644
--- a/core/src/main/res/values-ru-rRU/strings.xml
+++ b/core/src/main/res/values-ru-rRU/strings.xml
@@ -31,6 +31,7 @@
%1$d мин
помпа занята
ошибка соединения
+ Разрешенный предел достигнут
Цели
Закрыть
Подождите…
@@ -39,6 +40,7 @@
нажат стоп
стоп
Углеводы
+ Недопустимый профиль!
ПРОФИЛЬ НЕ ЗАДАН
дата
@@ -51,6 +53,7 @@
Продолжительность действия инсулина
Соотношение инсулин/углеводы I: C
Фактор Чувствительности к Инсулину (ISF)
+ Базальная скорость
Целевая ГК
инициализация...
Серийный номер
@@ -137,6 +140,7 @@
PIN-коды не совпадают
Базальные значения не выровнены по часам: %1$s
+ Значение базала заменено минимальной поддерживаемой величиной: %1$s
Значение базала заменено максимальной поддерживаемой величиной: %1$s
/ед
ед/ч
@@ -217,6 +221,7 @@
Ожидание результата
Супер микро болюс SMB
+ Необходимо дополнительно %1$d г углеводов в течение %2$d минут
Статистика
накопительные TDD
@@ -228,6 +233,7 @@
количество дней
вес
возможны неточности если болюсы использовались для заполнения
+ Старые данные. Нажмите \"перезагрузка\"
общий базал
общий базал*2
@@ -391,6 +397,7 @@
»%1$s« за пределами жестких ограничений
»%1$s« %2$.2f за пределами жестких ограничений
Величина базала
+ Версия NSClient не совпадает с версией AndroidAPS. Обновите версию.
БОЛЮС %1$.2f ЕД
УГЛ %1$d г
diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml
index 5c5146e42d..49670026d9 100644
--- a/core/src/main/res/values/attrs.xml
+++ b/core/src/main/res/values/attrs.xml
@@ -65,6 +65,7 @@
+
diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml
index 27c6d20db9..e83c322785 100644
--- a/core/src/main/res/values/colors.xml
+++ b/core/src/main/res/values/colors.xml
@@ -111,7 +111,7 @@
#666666
- #ffffff
+ #000000
#77dd77
#ff0400
#FF8C00
diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml
index a471a947dc..318c420aa1 100644
--- a/core/src/main/res/values/styles.xml
+++ b/core/src/main/res/values/styles.xml
@@ -100,6 +100,7 @@
- @color/white
- @color/toastBase
+ - @color/colorLightGray
- @style/DialogTheme
- @style/DialogTheme
diff --git a/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
index 8d6807485d..5b9d401678 100644
--- a/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
+++ b/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
@@ -90,12 +90,13 @@ open class TestBaseWithProfile : TestBase() {
json.put("store", store)
return ProfileStore(profileInjector, json, dateUtil)
}
+
fun getInvalidProfileStore2(): ProfileStore {
val json = JSONObject()
val store = JSONObject()
store.put(TESTPROFILENAME, JSONObject(validProfileJSON))
store.put("invalid", JSONObject(invalidProfileJSON))
- json.put("defaultProfile", TESTPROFILENAME)
+ json.put("defaultProfile", TESTPROFILENAME + "invalid")
json.put("store", store)
return ProfileStore(profileInjector, json, dateUtil)
}
diff --git a/core/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt b/core/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt
index cd5f464d24..3c9b826862 100644
--- a/core/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt
+++ b/core/src/test/java/info/nightscout/androidaps/interfaces/ProfileStoreTest.kt
@@ -2,6 +2,7 @@ package info.nightscout.androidaps.interfaces
import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.data.PureProfile
+import org.json.JSONObject
import org.junit.Assert
import org.junit.Test
@@ -20,6 +21,7 @@ internal class ProfileStoreTest : TestBaseWithProfile() {
@Test
fun getDefaultProfileJsonTest() {
Assert.assertTrue(getValidProfileStore().getDefaultProfileJson()?.has("dia") ?: false)
+ Assert.assertEquals(null, getInvalidProfileStore2().getDefaultProfileJson())
}
@Test
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
index 3425dd25ad..b582e829fd 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
@@ -215,13 +215,13 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
}
}
} else {
- ToastUtils.INSTANCE.showToastInUiThread(context.getApplicationContext(), rh.gs(R.string.nobtadapter));
+ ToastUtils.INSTANCE.errorToast(context.getApplicationContext(), R.string.nobtadapter);
}
if (mBTDevice == null) {
- ToastUtils.INSTANCE.showToastInUiThread(context.getApplicationContext(), rh.gs(R.string.devicenotfound));
+ ToastUtils.INSTANCE.errorToast(context.getApplicationContext(), R.string.devicenotfound);
}
} else {
- ToastUtils.INSTANCE.errorToast(context, context.getString(R.string.needconnectpermission));
+ ToastUtils.INSTANCE.errorToast(context, R.string.needconnectpermission);
}
}
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
index cfc4e85911..964fe05fb8 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
@@ -146,7 +146,7 @@ class DanaRSPlugin @Inject constructor(
aapsLogger.debug(LTag.PUMP, "RS connect from: $reason")
if (danaRSService != null && mDeviceAddress != "" && mDeviceName != "") {
val success = danaRSService?.connect(reason, mDeviceAddress) ?: false
- if (!success) ToastUtils.showToastInUiThread(context, rh.gs(R.string.ble_not_supported_or_not_paired))
+ if (!success) ToastUtils.errorToast(context, R.string.ble_not_supported_or_not_paired)
}
}
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt b/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt
index 5f56ddc2b7..a6cface7dc 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt
@@ -24,6 +24,7 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.danars.R
import info.nightscout.androidaps.danars.databinding.DanarsBlescannerActivityBinding
import info.nightscout.androidaps.danars.events.EventDanaRSDeviceChange
+import info.nightscout.androidaps.extensions.safeEnable
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.shared.sharedPreferences.SP
@@ -62,7 +63,7 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
super.onResume()
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
- if (bluetoothAdapter?.isEnabled != true) bluetoothAdapter?.enable()
+ bluetoothAdapter?.safeEnable()
startScan()
} else {
ToastUtils.errorToast(context, context.getString(info.nightscout.androidaps.core.R.string.needconnectpermission))
@@ -180,20 +181,13 @@ class BLEScanActivity : NoSplashAppCompatActivity() {
if (other !is BluetoothDeviceItem) {
return false
}
- return stringEquals(device.address, other.device.address)
- }
-
- private fun stringEquals(arg1: String, arg2: String): Boolean {
- return try {
- arg1 == arg2
- } catch (e: Exception) {
- false
- }
+ return device.address == other.device.address
}
override fun hashCode(): Int = device.hashCode()
}
+ @Suppress("RegExpSimplifiable")
private fun isSNCheck(sn: String): Boolean {
val regex = "^([a-zA-Z]{3})([0-9]{5})([a-zA-Z]{2})$"
val p = Pattern.compile(regex)
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt b/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt
index 959a14aa3a..1da8076216 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt
@@ -158,7 +158,7 @@ class BLEComm @Inject internal constructor(
// assume pairing keys are invalid
val lastClearRequest = sp.getLong(R.string.key_rs_last_clear_key_request, 0)
if (lastClearRequest != 0L && dateUtil.isOlderThan(lastClearRequest, 5)) {
- ToastUtils.showToastInUiThread(context, R.string.invalidpairing)
+ ToastUtils.errorToast(context, R.string.invalidpairing)
danaRSPlugin.changePump()
removeBond()
} else if (lastClearRequest == 0L) {
@@ -175,7 +175,7 @@ class BLEComm @Inject internal constructor(
sp.remove(rh.gs(R.string.key_danars_v3_randompairingkey) + danaRSPlugin.mDeviceName)
sp.remove(rh.gs(R.string.key_danars_v3_pairingkey) + danaRSPlugin.mDeviceName)
sp.remove(rh.gs(R.string.key_danars_v3_randomsynckey) + danaRSPlugin.mDeviceName)
- ToastUtils.showToastInUiThread(context, R.string.invalidpairing)
+ ToastUtils.errorToast(context, R.string.invalidpairing)
danaRSPlugin.changePump()
} else if (lastClearRequest == 0L) {
aapsLogger.error("Clearing pairing keys postponed")
@@ -213,35 +213,12 @@ class BLEComm @Inject internal constructor(
@SuppressLint("MissingPermission")
@Synchronized fun close() {
- /*
- if (!encryptedDataRead && !encryptedCommandSent) {
- // there was no response from pump before started encryption
- // assume pairing is invalid
- val lastClearRequest = sp.getLong(R.string.key_rs_last_clear_key_request, 0)
- if (lastClearRequest != 0L && dateUtil.isOlderThan(lastClearRequest, 5)) {
- ToastUtils.showToastInUiThread(context, R.string.invalidpairing)
- danaRSPlugin.changePump()
- sp.getStringOrNull(R.string.key_danars_address, null)?.let { address ->
- bluetoothAdapter?.getRemoteDevice(address)?.let { device ->
- try {
- aapsLogger.debug(LTag.PUMPBTCOMM, "Removing bond")
- device::class.java.getMethod("removeBond").invoke(device)
- } catch (e: Exception) {
- aapsLogger.error("Removing bond has been failed. ${e.message}")
- }
- }
- }
- } else if (lastClearRequest == 0L) {
- aapsLogger.error("Clearing pairing keys postponed")
- sp.putLong(R.string.key_rs_last_clear_key_request, dateUtil.now())
- }
- }
- */
aapsLogger.debug(LTag.PUMPBTCOMM, "BluetoothAdapter close")
bluetoothGatt?.close()
bluetoothGatt = null
}
+ @Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
private val mGattCallback: BluetoothGattCallback = object : BluetoothGattCallback() {
override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) {
onConnectionStateChangeSynchronized(gatt, newState) // call it synchronized
@@ -289,6 +266,7 @@ class BLEComm @Inject internal constructor(
}
}
+ @Suppress("DEPRECATION")
@SuppressLint("MissingPermission")
@Synchronized
private fun setCharacteristicNotification(characteristic: BluetoothGattCharacteristic?, enabled: Boolean) {
@@ -309,6 +287,7 @@ class BLEComm @Inject internal constructor(
}
}
+ @Suppress("DEPRECATION")
@SuppressLint("MissingPermission")
@Synchronized
private fun writeCharacteristicNoResponse(characteristic: BluetoothGattCharacteristic, data: ByteArray) {
diff --git a/database/schemas/info.nightscout.androidaps.database.AppDatabase/22.json b/database/schemas/info.nightscout.androidaps.database.AppDatabase/22.json
new file mode 100644
index 0000000000..93af25de94
--- /dev/null
+++ b/database/schemas/info.nightscout.androidaps.database.AppDatabase/22.json
@@ -0,0 +1,3605 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 22,
+ "identityHash": "09121464fb795b3c37bb1c2c2c3ea481",
+ "entities": [
+ {
+ "tableName": "apsResults",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `algorithm` TEXT NOT NULL, `glucoseStatusJson` TEXT NOT NULL, `currentTempJson` TEXT NOT NULL, `iobDataJson` TEXT NOT NULL, `profileJson` TEXT NOT NULL, `autosensDataJson` TEXT, `mealDataJson` TEXT NOT NULL, `isMicroBolusAllowed` INTEGER, `resultJson` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `apsResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "algorithm",
+ "columnName": "algorithm",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseStatusJson",
+ "columnName": "glucoseStatusJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "currentTempJson",
+ "columnName": "currentTempJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "iobDataJson",
+ "columnName": "iobDataJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileJson",
+ "columnName": "profileJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "autosensDataJson",
+ "columnName": "autosensDataJson",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "mealDataJson",
+ "columnName": "mealDataJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isMicroBolusAllowed",
+ "columnName": "isMicroBolusAllowed",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "resultJson",
+ "columnName": "resultJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_apsResults_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResults_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_apsResults_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResults_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "apsResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "boluses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `amount` REAL NOT NULL, `type` TEXT NOT NULL, `notes` TEXT, `isBasalInsulin` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, `insulinLabel` TEXT, `insulinEndTime` INTEGER, `peak` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "notes",
+ "columnName": "notes",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "isBasalInsulin",
+ "columnName": "isBasalInsulin",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinLabel",
+ "columnName": "insulinLabel",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinEndTime",
+ "columnName": "insulinEndTime",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.peak",
+ "columnName": "peak",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_boluses_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_boluses_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_boluses_temporaryId",
+ "unique": false,
+ "columnNames": [
+ "temporaryId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_temporaryId` ON `${TABLE_NAME}` (`temporaryId`)"
+ },
+ {
+ "name": "index_boluses_pumpId",
+ "unique": false,
+ "columnNames": [
+ "pumpId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_pumpId` ON `${TABLE_NAME}` (`pumpId`)"
+ },
+ {
+ "name": "index_boluses_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_boluses_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_boluses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_boluses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_boluses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "bolusCalculatorResults",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `targetBGLow` REAL NOT NULL, `targetBGHigh` REAL NOT NULL, `isf` REAL NOT NULL, `ic` REAL NOT NULL, `bolusIOB` REAL NOT NULL, `wasBolusIOBUsed` INTEGER NOT NULL, `basalIOB` REAL NOT NULL, `wasBasalIOBUsed` INTEGER NOT NULL, `glucoseValue` REAL NOT NULL, `wasGlucoseUsed` INTEGER NOT NULL, `glucoseDifference` REAL NOT NULL, `glucoseInsulin` REAL NOT NULL, `glucoseTrend` REAL NOT NULL, `wasTrendUsed` INTEGER NOT NULL, `trendInsulin` REAL NOT NULL, `cob` REAL NOT NULL, `wasCOBUsed` INTEGER NOT NULL, `cobInsulin` REAL NOT NULL, `carbs` REAL NOT NULL, `wereCarbsUsed` INTEGER NOT NULL, `carbsInsulin` REAL NOT NULL, `otherCorrection` REAL NOT NULL, `wasSuperbolusUsed` INTEGER NOT NULL, `superbolusInsulin` REAL NOT NULL, `wasTempTargetUsed` INTEGER NOT NULL, `totalInsulin` REAL NOT NULL, `percentageCorrection` INTEGER NOT NULL, `profileName` TEXT NOT NULL, `note` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `bolusCalculatorResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBGLow",
+ "columnName": "targetBGLow",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBGHigh",
+ "columnName": "targetBGHigh",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isf",
+ "columnName": "isf",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "ic",
+ "columnName": "ic",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bolusIOB",
+ "columnName": "bolusIOB",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasBolusIOBUsed",
+ "columnName": "wasBolusIOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalIOB",
+ "columnName": "basalIOB",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasBasalIOBUsed",
+ "columnName": "wasBasalIOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseValue",
+ "columnName": "glucoseValue",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasGlucoseUsed",
+ "columnName": "wasGlucoseUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseDifference",
+ "columnName": "glucoseDifference",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseInsulin",
+ "columnName": "glucoseInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseTrend",
+ "columnName": "glucoseTrend",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasTrendUsed",
+ "columnName": "wasTrendUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trendInsulin",
+ "columnName": "trendInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cob",
+ "columnName": "cob",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasCOBUsed",
+ "columnName": "wasCOBUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "cobInsulin",
+ "columnName": "cobInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbs",
+ "columnName": "carbs",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wereCarbsUsed",
+ "columnName": "wereCarbsUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbsInsulin",
+ "columnName": "carbsInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "otherCorrection",
+ "columnName": "otherCorrection",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasSuperbolusUsed",
+ "columnName": "wasSuperbolusUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "superbolusInsulin",
+ "columnName": "superbolusInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "wasTempTargetUsed",
+ "columnName": "wasTempTargetUsed",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalInsulin",
+ "columnName": "totalInsulin",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "percentageCorrection",
+ "columnName": "percentageCorrection",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileName",
+ "columnName": "profileName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "note",
+ "columnName": "note",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_bolusCalculatorResults_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_bolusCalculatorResults_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ },
+ {
+ "name": "index_bolusCalculatorResults_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_bolusCalculatorResults_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_bolusCalculatorResults_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "bolusCalculatorResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "carbs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `amount` REAL NOT NULL, `notes` TEXT, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `carbs`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "notes",
+ "columnName": "notes",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_carbs_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_carbs_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_carbs_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_carbs_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_carbs_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_carbs_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "carbs",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "effectiveProfileSwitches",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `basalBlocks` TEXT NOT NULL, `isfBlocks` TEXT NOT NULL, `icBlocks` TEXT NOT NULL, `targetBlocks` TEXT NOT NULL, `glucoseUnit` TEXT NOT NULL, `originalProfileName` TEXT NOT NULL, `originalCustomizedName` TEXT NOT NULL, `originalTimeshift` INTEGER NOT NULL, `originalPercentage` INTEGER NOT NULL, `originalDuration` INTEGER NOT NULL, `originalEnd` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, `insulinLabel` TEXT NOT NULL, `insulinEndTime` INTEGER NOT NULL, `peak` INTEGER NOT NULL, FOREIGN KEY(`referenceId`) REFERENCES `effectiveProfileSwitches`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalBlocks",
+ "columnName": "basalBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isfBlocks",
+ "columnName": "isfBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "icBlocks",
+ "columnName": "icBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBlocks",
+ "columnName": "targetBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseUnit",
+ "columnName": "glucoseUnit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalProfileName",
+ "columnName": "originalProfileName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalCustomizedName",
+ "columnName": "originalCustomizedName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalTimeshift",
+ "columnName": "originalTimeshift",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalPercentage",
+ "columnName": "originalPercentage",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalDuration",
+ "columnName": "originalDuration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "originalEnd",
+ "columnName": "originalEnd",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinLabel",
+ "columnName": "insulinLabel",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinEndTime",
+ "columnName": "insulinEndTime",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.peak",
+ "columnName": "peak",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_effectiveProfileSwitches_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_effectiveProfileSwitches_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_effectiveProfileSwitches_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ },
+ {
+ "name": "index_effectiveProfileSwitches_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_effectiveProfileSwitches_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "effectiveProfileSwitches",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "extendedBoluses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `amount` REAL NOT NULL, `isEmulatingTempBasal` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `extendedBoluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "amount",
+ "columnName": "amount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isEmulatingTempBasal",
+ "columnName": "isEmulatingTempBasal",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_extendedBoluses_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_extendedBoluses_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_extendedBoluses_endId",
+ "unique": false,
+ "columnNames": [
+ "endId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_endId` ON `${TABLE_NAME}` (`endId`)"
+ },
+ {
+ "name": "index_extendedBoluses_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_extendedBoluses_pumpId",
+ "unique": false,
+ "columnNames": [
+ "pumpId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_pumpId` ON `${TABLE_NAME}` (`pumpId`)"
+ },
+ {
+ "name": "index_extendedBoluses_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_extendedBoluses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_extendedBoluses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_extendedBoluses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "extendedBoluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "glucoseValues",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `raw` REAL, `value` REAL NOT NULL, `trendArrow` TEXT NOT NULL, `noise` REAL, `sourceSensor` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `glucoseValues`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "raw",
+ "columnName": "raw",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "value",
+ "columnName": "value",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trendArrow",
+ "columnName": "trendArrow",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "noise",
+ "columnName": "noise",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "sourceSensor",
+ "columnName": "sourceSensor",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_glucoseValues_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_glucoseValues_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_glucoseValues_sourceSensor",
+ "unique": false,
+ "columnNames": [
+ "sourceSensor"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_sourceSensor` ON `${TABLE_NAME}` (`sourceSensor`)"
+ },
+ {
+ "name": "index_glucoseValues_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_glucoseValues_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_glucoseValues_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "glucoseValues",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "profileSwitches",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `basalBlocks` TEXT NOT NULL, `isfBlocks` TEXT NOT NULL, `icBlocks` TEXT NOT NULL, `targetBlocks` TEXT NOT NULL, `glucoseUnit` TEXT NOT NULL, `profileName` TEXT NOT NULL, `timeshift` INTEGER NOT NULL, `percentage` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, `insulinLabel` TEXT NOT NULL, `insulinEndTime` INTEGER NOT NULL, `peak` INTEGER NOT NULL, FOREIGN KEY(`referenceId`) REFERENCES `profileSwitches`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalBlocks",
+ "columnName": "basalBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isfBlocks",
+ "columnName": "isfBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "icBlocks",
+ "columnName": "icBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "targetBlocks",
+ "columnName": "targetBlocks",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "glucoseUnit",
+ "columnName": "glucoseUnit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "profileName",
+ "columnName": "profileName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timeshift",
+ "columnName": "timeshift",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "percentage",
+ "columnName": "percentage",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinLabel",
+ "columnName": "insulinLabel",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.insulinEndTime",
+ "columnName": "insulinEndTime",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "insulinConfiguration.peak",
+ "columnName": "peak",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_profileSwitches_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_profileSwitches_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ },
+ {
+ "name": "index_profileSwitches_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_profileSwitches_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_profileSwitches_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_profileSwitches_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "profileSwitches",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "temporaryBasals",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `type` TEXT NOT NULL, `isAbsolute` INTEGER NOT NULL, `rate` REAL NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `temporaryBasals`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAbsolute",
+ "columnName": "isAbsolute",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "rate",
+ "columnName": "rate",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_temporaryBasals_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_temporaryBasals_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_temporaryBasals_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_temporaryBasals_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_temporaryBasals_endId",
+ "unique": false,
+ "columnNames": [
+ "endId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_endId` ON `${TABLE_NAME}` (`endId`)"
+ },
+ {
+ "name": "index_temporaryBasals_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_temporaryBasals_temporaryId",
+ "unique": false,
+ "columnNames": [
+ "temporaryId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_temporaryId` ON `${TABLE_NAME}` (`temporaryId`)"
+ },
+ {
+ "name": "index_temporaryBasals_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_temporaryBasals_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryBasals_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "temporaryBasals",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "temporaryTargets",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `reason` TEXT NOT NULL, `highTarget` REAL NOT NULL, `lowTarget` REAL NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `temporaryTargets`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "reason",
+ "columnName": "reason",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "highTarget",
+ "columnName": "highTarget",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lowTarget",
+ "columnName": "lowTarget",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_temporaryTargets_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_temporaryTargets_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_temporaryTargets_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_temporaryTargets_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_temporaryTargets_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_temporaryTargets_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "temporaryTargets",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "therapyEvents",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `type` TEXT NOT NULL, `note` TEXT, `enteredBy` TEXT, `glucose` REAL, `glucoseType` TEXT, `glucoseUnit` TEXT NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `therapyEvents`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "type",
+ "columnName": "type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "note",
+ "columnName": "note",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "enteredBy",
+ "columnName": "enteredBy",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "glucose",
+ "columnName": "glucose",
+ "affinity": "REAL",
+ "notNull": false
+ },
+ {
+ "fieldPath": "glucoseType",
+ "columnName": "glucoseType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "glucoseUnit",
+ "columnName": "glucoseUnit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_therapyEvents_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_therapyEvents_type",
+ "unique": false,
+ "columnNames": [
+ "type"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_type` ON `${TABLE_NAME}` (`type`)"
+ },
+ {
+ "name": "index_therapyEvents_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_therapyEvents_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_therapyEvents_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_therapyEvents_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_therapyEvents_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "therapyEvents",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "totalDailyDoses",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `basalAmount` REAL NOT NULL, `bolusAmount` REAL NOT NULL, `totalAmount` REAL NOT NULL, `carbs` REAL NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `totalDailyDoses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "basalAmount",
+ "columnName": "basalAmount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bolusAmount",
+ "columnName": "bolusAmount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalAmount",
+ "columnName": "totalAmount",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbs",
+ "columnName": "carbs",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_totalDailyDoses_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_totalDailyDoses_pumpId",
+ "unique": false,
+ "columnNames": [
+ "pumpId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_pumpId` ON `${TABLE_NAME}` (`pumpId`)"
+ },
+ {
+ "name": "index_totalDailyDoses_pumpType",
+ "unique": false,
+ "columnNames": [
+ "pumpType"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_pumpType` ON `${TABLE_NAME}` (`pumpType`)"
+ },
+ {
+ "name": "index_totalDailyDoses_pumpSerial",
+ "unique": false,
+ "columnNames": [
+ "pumpSerial"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_pumpSerial` ON `${TABLE_NAME}` (`pumpSerial`)"
+ },
+ {
+ "name": "index_totalDailyDoses_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_totalDailyDoses_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_totalDailyDoses_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_totalDailyDoses_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "totalDailyDoses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "apsResultLinks",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `apsResultId` INTEGER NOT NULL, `smbId` INTEGER, `tbrId` INTEGER, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`apsResultId`) REFERENCES `apsResults`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`smbId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`tbrId`) REFERENCES `temporaryBasals`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`referenceId`) REFERENCES `apsResultLinks`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "apsResultId",
+ "columnName": "apsResultId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "smbId",
+ "columnName": "smbId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "tbrId",
+ "columnName": "tbrId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_apsResultLinks_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_apsResultLinks_apsResultId",
+ "unique": false,
+ "columnNames": [
+ "apsResultId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_apsResultId` ON `${TABLE_NAME}` (`apsResultId`)"
+ },
+ {
+ "name": "index_apsResultLinks_smbId",
+ "unique": false,
+ "columnNames": [
+ "smbId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_smbId` ON `${TABLE_NAME}` (`smbId`)"
+ },
+ {
+ "name": "index_apsResultLinks_tbrId",
+ "unique": false,
+ "columnNames": [
+ "tbrId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_apsResultLinks_tbrId` ON `${TABLE_NAME}` (`tbrId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "apsResults",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "apsResultId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "smbId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "temporaryBasals",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "tbrId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "apsResultLinks",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "multiwaveBolusLinks",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `bolusId` INTEGER NOT NULL, `extendedBolusId` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`bolusId`) REFERENCES `boluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`extendedBolusId`) REFERENCES `extendedBoluses`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`referenceId`) REFERENCES `multiwaveBolusLinks`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "bolusId",
+ "columnName": "bolusId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "extendedBolusId",
+ "columnName": "extendedBolusId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_multiwaveBolusLinks_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_multiwaveBolusLinks_bolusId",
+ "unique": false,
+ "columnNames": [
+ "bolusId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_bolusId` ON `${TABLE_NAME}` (`bolusId`)"
+ },
+ {
+ "name": "index_multiwaveBolusLinks_extendedBolusId",
+ "unique": false,
+ "columnNames": [
+ "extendedBolusId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_multiwaveBolusLinks_extendedBolusId` ON `${TABLE_NAME}` (`extendedBolusId`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "boluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "bolusId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "extendedBoluses",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "extendedBolusId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "multiwaveBolusLinks",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "preferenceChanges",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `key` TEXT NOT NULL, `value` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "key",
+ "columnName": "key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "value",
+ "columnName": "value",
+ "affinity": "TEXT",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "versionChanges",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `versionCode` INTEGER NOT NULL, `versionName` TEXT NOT NULL, `gitRemote` TEXT, `commitHash` TEXT)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "versionCode",
+ "columnName": "versionCode",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "versionName",
+ "columnName": "versionName",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "gitRemote",
+ "columnName": "gitRemote",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "commitHash",
+ "columnName": "commitHash",
+ "affinity": "TEXT",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "userEntry",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `action` TEXT NOT NULL, `source` TEXT NOT NULL, `note` TEXT NOT NULL, `values` TEXT NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "action",
+ "columnName": "action",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "source",
+ "columnName": "source",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "note",
+ "columnName": "note",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "values",
+ "columnName": "values",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_userEntry_source",
+ "unique": false,
+ "columnNames": [
+ "source"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_userEntry_source` ON `${TABLE_NAME}` (`source`)"
+ },
+ {
+ "name": "index_userEntry_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_userEntry_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "foods",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `name` TEXT NOT NULL, `category` TEXT, `subCategory` TEXT, `portion` REAL NOT NULL, `carbs` INTEGER NOT NULL, `fat` INTEGER, `protein` INTEGER, `energy` INTEGER, `unit` TEXT NOT NULL, `gi` INTEGER, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `foods`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "category",
+ "columnName": "category",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "subCategory",
+ "columnName": "subCategory",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "portion",
+ "columnName": "portion",
+ "affinity": "REAL",
+ "notNull": true
+ },
+ {
+ "fieldPath": "carbs",
+ "columnName": "carbs",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "fat",
+ "columnName": "fat",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "protein",
+ "columnName": "protein",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "energy",
+ "columnName": "energy",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "unit",
+ "columnName": "unit",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "gi",
+ "columnName": "gi",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_foods_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_foods_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_foods_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_foods_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_foods_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "foods",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "deviceStatus",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `device` TEXT, `pump` TEXT, `enacted` TEXT, `suggested` TEXT, `iob` TEXT, `uploaderBattery` INTEGER NOT NULL, `configuration` TEXT, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "device",
+ "columnName": "device",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "pump",
+ "columnName": "pump",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "enacted",
+ "columnName": "enacted",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "suggested",
+ "columnName": "suggested",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "iob",
+ "columnName": "iob",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "uploaderBattery",
+ "columnName": "uploaderBattery",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "configuration",
+ "columnName": "configuration",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_deviceStatus_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_deviceStatus_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_deviceStatus_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_deviceStatus_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_deviceStatus_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_deviceStatus_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": []
+ },
+ {
+ "tableName": "offlineEvents",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `version` INTEGER NOT NULL, `dateCreated` INTEGER NOT NULL, `isValid` INTEGER NOT NULL, `referenceId` INTEGER, `timestamp` INTEGER NOT NULL, `utcOffset` INTEGER NOT NULL, `reason` TEXT NOT NULL, `duration` INTEGER NOT NULL, `nightscoutSystemId` TEXT, `nightscoutId` TEXT, `pumpType` TEXT, `pumpSerial` TEXT, `temporaryId` INTEGER, `pumpId` INTEGER, `startId` INTEGER, `endId` INTEGER, FOREIGN KEY(`referenceId`) REFERENCES `offlineEvents`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "version",
+ "columnName": "version",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateCreated",
+ "columnName": "dateCreated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isValid",
+ "columnName": "isValid",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "referenceId",
+ "columnName": "referenceId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "utcOffset",
+ "columnName": "utcOffset",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "reason",
+ "columnName": "reason",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutSystemId",
+ "columnName": "nightscoutSystemId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.nightscoutId",
+ "columnName": "nightscoutId",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpType",
+ "columnName": "pumpType",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpSerial",
+ "columnName": "pumpSerial",
+ "affinity": "TEXT",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.temporaryId",
+ "columnName": "temporaryId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.pumpId",
+ "columnName": "pumpId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.startId",
+ "columnName": "startId",
+ "affinity": "INTEGER",
+ "notNull": false
+ },
+ {
+ "fieldPath": "interfaceIDs_backing.endId",
+ "columnName": "endId",
+ "affinity": "INTEGER",
+ "notNull": false
+ }
+ ],
+ "primaryKey": {
+ "columnNames": [
+ "id"
+ ],
+ "autoGenerate": true
+ },
+ "indices": [
+ {
+ "name": "index_offlineEvents_id",
+ "unique": false,
+ "columnNames": [
+ "id"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_offlineEvents_id` ON `${TABLE_NAME}` (`id`)"
+ },
+ {
+ "name": "index_offlineEvents_isValid",
+ "unique": false,
+ "columnNames": [
+ "isValid"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_offlineEvents_isValid` ON `${TABLE_NAME}` (`isValid`)"
+ },
+ {
+ "name": "index_offlineEvents_nightscoutId",
+ "unique": false,
+ "columnNames": [
+ "nightscoutId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_offlineEvents_nightscoutId` ON `${TABLE_NAME}` (`nightscoutId`)"
+ },
+ {
+ "name": "index_offlineEvents_referenceId",
+ "unique": false,
+ "columnNames": [
+ "referenceId"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_offlineEvents_referenceId` ON `${TABLE_NAME}` (`referenceId`)"
+ },
+ {
+ "name": "index_offlineEvents_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_offlineEvents_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "offlineEvents",
+ "onDelete": "NO ACTION",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "referenceId"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ }
+ ],
+ "views": [],
+ "setupQueries": [
+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '09121464fb795b3c37bb1c2c2c3ea481')"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt b/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt
index 948aa705d6..58fc350cec 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt
@@ -6,7 +6,7 @@ import androidx.room.TypeConverters
import info.nightscout.androidaps.database.daos.*
import info.nightscout.androidaps.database.entities.*
-const val DATABASE_VERSION = 21
+const val DATABASE_VERSION = 22
@Database(version = DATABASE_VERSION,
entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
diff --git a/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt b/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt
index 4f2b1be88d..a7093c55bb 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt
@@ -27,6 +27,7 @@ open class DatabaseModule {
// .addMigrations(migration7to8)
// .addMigrations(migration11to12)
.addMigrations(migration20to21)
+ .addMigrations(migration21to22)
.addCallback(object : Callback() {
override fun onOpen(db: SupportSQLiteDatabase) {
super.onOpen(db)
@@ -34,6 +35,7 @@ open class DatabaseModule {
}
})
.fallbackToDestructiveMigration()
+ .fallbackToDestructiveMigrationOnDowngrade()
.build()
@Qualifier
@@ -69,4 +71,13 @@ open class DatabaseModule {
}
}
+ private val migration21to22 = object : Migration(21,22) {
+ override fun migrate(database: SupportSQLiteDatabase) {
+ database.execSQL("ALTER TABLE `carbs` ADD COLUMN `notes` TEXT")
+ database.execSQL("ALTER TABLE `boluses` ADD COLUMN `notes` TEXT")
+ // Custom indexes must be dropped on migration to pass room schema checking after upgrade
+ dropCustomIndexes(database)
+ }
+ }
+
}
\ No newline at end of file
diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/GlucoseValueDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/GlucoseValueDao.kt
index 4423868aca..e5cc439a0b 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/daos/GlucoseValueDao.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/daos/GlucoseValueDao.kt
@@ -16,7 +16,7 @@ internal interface GlucoseValueDao : TraceableDao {
@Query("DELETE FROM $TABLE_GLUCOSE_VALUES")
override fun deleteAllEntries()
- @Query("SELECT * FROM $TABLE_GLUCOSE_VALUES WHERE isValid = 1 AND referenceId IS NULL ORDER BY id DESC limit 1")
+ @Query("SELECT * FROM $TABLE_GLUCOSE_VALUES WHERE isValid = 1 AND referenceId IS NULL ORDER BY timestamp DESC limit 1")
fun getLast(): Maybe
@Query("SELECT id FROM $TABLE_GLUCOSE_VALUES ORDER BY id DESC limit 1")
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt
index 5e7538bbb2..1feec1c287 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt
@@ -44,6 +44,7 @@ data class Bolus(
override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(),
var amount: Double,
var type: Type,
+ var notes: String? = null,
var isBasalInsulin: Boolean = false,
@Embedded
var insulinConfiguration: InsulinConfiguration? = null
@@ -55,6 +56,7 @@ data class Bolus(
utcOffset == other.utcOffset &&
amount == other.amount &&
type == other.type &&
+ notes == other.notes &&
isBasalInsulin == other.isBasalInsulin
fun onlyNsIdAdded(previous: Bolus): Boolean =
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/Carbs.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/Carbs.kt
index 9e9d703dfa..9d55e4ad6c 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/Carbs.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/Carbs.kt
@@ -35,7 +35,8 @@ data class Carbs(
override var timestamp: Long,
override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(),
override var duration: Long, // in milliseconds
- var amount: Double
+ var amount: Double,
+ var notes: String? = null
) : TraceableDBEntry, DBEntryWithTimeAndDuration {
private fun contentEqualsTo(other: Carbs): Boolean =
@@ -43,6 +44,7 @@ data class Carbs(
timestamp == other.timestamp &&
utcOffset == other.utcOffset &&
amount == other.amount &&
+ notes == other.notes &&
duration == other.duration
fun onlyNsIdAdded(previous: Carbs): Boolean =
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/GlucoseValue.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/GlucoseValue.kt
index 00979a554c..5906caad5b 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/GlucoseValue.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/GlucoseValue.kt
@@ -109,6 +109,7 @@ data class GlucoseValue(
LIBRE_2_NATIVE("Libre2"),
POCTECH_NATIVE("Poctech"),
GLUNOVO_NATIVE("Glunovo"),
+ INTELLIGO_NATIVE("Intelligo"),
MM_600_SERIES("MM600Series"),
EVERSENSE("Eversense"),
AIDEX("GlucoRx Aidex"),
diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
index b239cba5e1..ebe656be4e 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
@@ -149,6 +149,7 @@ data class UserEntry(
PocTech,
Tomato,
Glunovo,
+ Intelligo,
Xdrip,
LocalProfile, //From LocalProfile plugin
Loop, //From Loop plugin
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateBolusTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateBolusTransaction.kt
index d7df6bedb3..25fe10c062 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateBolusTransaction.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateBolusTransaction.kt
@@ -15,6 +15,7 @@ class InsertOrUpdateBolusTransaction(
timestamp: Long,
amount: Double,
type: Bolus.Type,
+ notes: String? = null,
isBasalInsulin: Boolean = false,
insulinConfiguration: InsulinConfiguration? = null,
interfaceIDs_backing: InterfaceIDs? = null
@@ -22,6 +23,7 @@ class InsertOrUpdateBolusTransaction(
timestamp = timestamp,
amount = amount,
type = type,
+ notes = notes,
isBasalInsulin = isBasalInsulin,
insulinConfiguration = insulinConfiguration,
interfaceIDs_backing = interfaceIDs_backing
diff --git a/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateCarbsTransaction.kt b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateCarbsTransaction.kt
index 2cf4406206..8f84cfb0ec 100644
--- a/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateCarbsTransaction.kt
+++ b/database/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateCarbsTransaction.kt
@@ -14,11 +14,13 @@ class InsertOrUpdateCarbsTransaction(
timestamp: Long,
amount: Double,
duration: Long,
+ notes: String,
interfaceIDs_backing: InterfaceIDs? = null
) : this(Carbs(
timestamp = timestamp,
amount = amount,
duration = duration,
+ notes = notes,
interfaceIDs_backing = interfaceIDs_backing
))
diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt
index 4bd3d07f22..d6f144209b 100644
--- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt
+++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/DiaconnG8Plugin.kt
@@ -131,7 +131,7 @@ class DiaconnG8Plugin @Inject constructor(
aapsLogger.debug(LTag.PUMP, "Diaconn G8 connect from: $reason")
if(diaconnG8Service != null && mDeviceAddress != "" && mDeviceName != "") {
val success = diaconnG8Service?.connect(reason, mDeviceAddress) ?: false
- if(!success) ToastUtils.showToastInUiThread(context, rh.gs(R.string.ble_not_supported))
+ if(!success) ToastUtils.errorToast(context, R.string.ble_not_supported)
}
}
diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt
index 05fbebeaf1..1dc392ba5b 100644
--- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt
+++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt
@@ -27,10 +27,11 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.diaconn.R
import info.nightscout.androidaps.diaconn.databinding.DiaconnG8BlescannerActivityBinding
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8DeviceChange
+import info.nightscout.androidaps.extensions.safeEnable
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.shared.sharedPreferences.SP
-import java.util.*
+import java.util.UUID
import javax.inject.Inject
class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
@@ -67,7 +68,7 @@ class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED) {
bluetoothAdapter?.let { bluetoothAdapter ->
- if (!bluetoothAdapter.isEnabled) bluetoothAdapter.enable()
+ bluetoothAdapter.safeEnable()
bluetoothLeScanner = bluetoothAdapter.bluetoothLeScanner
startScan()
}
diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/packet/BigLogInquireResponsePacket.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/packet/BigLogInquireResponsePacket.kt
index a646a6baa6..d216f5eb0e 100644
--- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/packet/BigLogInquireResponsePacket.kt
+++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/packet/BigLogInquireResponsePacket.kt
@@ -1,6 +1,7 @@
package info.nightscout.androidaps.diaconn.packet
import android.content.Context
+import android.content.pm.PackageManager
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
@@ -13,24 +14,50 @@ import info.nightscout.androidaps.diaconn.api.PumpLogDto
import info.nightscout.androidaps.diaconn.common.RecordTypes
import info.nightscout.androidaps.diaconn.database.DiaconnHistoryRecord
import info.nightscout.androidaps.diaconn.database.DiaconnHistoryRecordDao
-import info.nightscout.androidaps.diaconn.pumplog.*
+import info.nightscout.androidaps.diaconn.pumplog.LOG_ALARM_BATTERY
+import info.nightscout.androidaps.diaconn.pumplog.LOG_ALARM_BLOCK
+import info.nightscout.androidaps.diaconn.pumplog.LOG_ALARM_SHORTAGE
+import info.nightscout.androidaps.diaconn.pumplog.LOG_CHANGE_INJECTOR_SUCCESS
+import info.nightscout.androidaps.diaconn.pumplog.LOG_CHANGE_NEEDLE_SUCCESS
+import info.nightscout.androidaps.diaconn.pumplog.LOG_CHANGE_TUBE_SUCCESS
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECTION_1DAY
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECTION_1DAY_BASAL
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECTION_1HOUR_BASAL
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECTION_DUAL_NORMAL
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_DUAL_FAIL
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_DUAL_SUCCESS
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_MEAL_FAIL
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_MEAL_SUCCESS
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_NORMAL_FAIL
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_NORMAL_SUCCESS
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_SQUARE_FAIL
+import info.nightscout.androidaps.diaconn.pumplog.LOG_INJECT_SQUARE_SUCCESS
+import info.nightscout.androidaps.diaconn.pumplog.LOG_RESET_SYS_V3
+import info.nightscout.androidaps.diaconn.pumplog.LOG_SET_DUAL_INJECTION
+import info.nightscout.androidaps.diaconn.pumplog.LOG_SET_SQUARE_INJECTION
+import info.nightscout.androidaps.diaconn.pumplog.LOG_SUSPEND_RELEASE_V2
+import info.nightscout.androidaps.diaconn.pumplog.LOG_SUSPEND_V2
+import info.nightscout.androidaps.diaconn.pumplog.LOG_TB_START_V3
+import info.nightscout.androidaps.diaconn.pumplog.LOG_TB_STOP_V3
+import info.nightscout.androidaps.diaconn.pumplog.PumplogUtil
import info.nightscout.androidaps.events.EventPumpStatusChanged
+import info.nightscout.androidaps.extensions.safeGetPackageInfo
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.PumpDescription
import info.nightscout.androidaps.interfaces.PumpSync
+import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
import info.nightscout.androidaps.utils.T
-import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.shared.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
import org.apache.commons.lang3.time.DateUtils
import org.joda.time.DateTime
import retrofit2.Call
import retrofit2.Response
-import java.util.*
+import java.util.UUID
import javax.inject.Inject
/**
@@ -39,6 +66,7 @@ import javax.inject.Inject
class BigLogInquireResponsePacket(
injector: HasAndroidInjector
) : DiaconnG8Packet(injector) {
+
@Inject lateinit var rxBus: RxBus
@Inject lateinit var rh: ResourceHelper
@Inject lateinit var activePlugin: ActivePlugin
@@ -53,6 +81,7 @@ class BigLogInquireResponsePacket(
var result = 0// 조회결과
private var pumpDesc = PumpDescription(PumpType.DIACONN_G8)
+
init {
msgType = 0xb2.toByte()
aapsLogger.debug(LTag.PUMPCOMM, "BigLogInquireResponsePacket init")
@@ -67,24 +96,24 @@ class BigLogInquireResponsePacket(
} else failed = false
val bufferData = prefixDecode(data) // 데이타 영역 15바이트 버퍼
- val result2 = getByteToInt(bufferData) // 조회결과 1 byte
- if(!isSuccInquireResponseResult(result2)) {
+ val result2 = getByteToInt(bufferData) // 조회결과 1 byte
+ if (!isSuccInquireResponseResult(result2)) {
failed = true
return
}
val logLength = getByteToInt(bufferData) // 로그의 갯수. 1byte
- // initalize
- val dailyMaxvalInfo = mutableMapOf>()
- dailyMaxvalInfo[""] = mutableMapOf()
- val pumpLogs : MutableList = mutableListOf()
+ // initialize
+ val dailyMaxValInfo = mutableMapOf>()
+ dailyMaxValInfo[""] = mutableMapOf()
+ val pumpLogs: MutableList = mutableListOf()
- // 15 byte를 로그갯수만큼 돌기.
- for(i in 0 until logLength) {
- val wrapingCount = getByteToInt(bufferData) // 1byte
- val logNum = getShortToInt(bufferData) // 2byte
+ // 15 byte 를 로그갯수만큼 돌기.
+ for (i in 0 until logLength) {
+ val wrappingCount = getByteToInt(bufferData) // 1byte
+ val logNum = getShortToInt(bufferData) // 2byte
// log Data Parsing
- val logdata = byteArrayOf(
+ val logData = byteArrayOf(
PumplogUtil.getByte(bufferData),
PumplogUtil.getByte(bufferData),
PumplogUtil.getByte(bufferData),
@@ -99,17 +128,17 @@ class BigLogInquireResponsePacket(
PumplogUtil.getByte(bufferData)
)
// process Log to DB
- val logDataToHexString = toNarrowHex(logdata)
- val pumplogKind: Byte = PumplogUtil.getKind(logDataToHexString)
+ val logDataToHexString = toNarrowHex(logData)
+ val pumpLogKind: Byte = PumplogUtil.getKind(logDataToHexString)
var status: String
val diaconnG8HistoryRecord = DiaconnHistoryRecord(0)
- if(diaconnG8Pump.isPlatformUploadStarted){
+ if (diaconnG8Pump.isPlatformUploadStarted) {
// Diaconn Platform upload start
aapsLogger.debug(LTag.PUMPCOMM, "make api upload parameter")
val pumpLog = PumpLog(
pumplog_no = logNum.toLong(),
- pumplog_wrapping_count = wrapingCount,
+ pumplog_wrapping_count = wrappingCount,
pumplog_data = logDataToHexString,
act_type = "1"
)
@@ -118,12 +147,12 @@ class BigLogInquireResponsePacket(
} else {
// APS Local history sync start
- diaconnG8Pump.apsWrappingCount = wrapingCount
- diaconnG8Pump.apslastLogNum = logNum
+ diaconnG8Pump.apsWrappingCount = wrappingCount
+ diaconnG8Pump.apslastLogNum = logNum
- when(pumplogKind) {
+ when (pumpLogKind) {
- LOG_INJECT_MEAL_SUCCESS.LOG_KIND -> {
+ LOG_INJECT_MEAL_SUCCESS.LOG_KIND -> {
val logItem = LOG_INJECT_MEAL_SUCCESS.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -135,26 +164,30 @@ class BigLogInquireResponsePacket(
type = detailedBolusInfo?.bolusType,
pumpId = logDateTime,
pumpType = PumpType.DIACONN_G8,
- pumpSerial = diaconnG8Pump.serialNo.toString())
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT MEALBOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
+ pumpSerial = diaconnG8Pump.serialNo.toString()
+ )
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT MEAL_BOLUS ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Bolus: ${logItem.injectAmount / 100.0}U "
+ )
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
- diaconnG8HistoryRecord.duration = logItem.getInjectTime()
+ diaconnG8HistoryRecord.duration = logItem.getInjectTime()
diaconnG8HistoryRecord.bolusType = "M" // meal bolus
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logmealsuccess)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
if (!newRecord && detailedBolusInfo != null) {
// detailedInfo can be from another similar record. Reinsert
detailedBolusInfoStorage.add(detailedBolusInfo)
}
- status = "MEALBOLUSSUCCESS" + dateUtil.timeString(logDateTime)
+ status = "MEAL_BOLUS_SUCCESS" + dateUtil.timeString(logDateTime)
}
- LOG_INJECT_MEAL_FAIL.LOG_KIND -> {
+ LOG_INJECT_MEAL_FAIL.LOG_KIND -> {
val logItem = LOG_INJECT_MEAL_FAIL.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -166,8 +199,12 @@ class BigLogInquireResponsePacket(
type = detailedBolusInfo?.bolusType,
pumpId = logDateTime,
pumpType = PumpType.DIACONN_G8,
- pumpSerial = diaconnG8Pump.serialNo.toString())
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT MEALBOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
+ pumpSerial = diaconnG8Pump.serialNo.toString()
+ )
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT MEAL_BOLUS ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Bolus: ${logItem.injectAmount / 100.0}U "
+ )
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.value = if ((logItem.injectAmount / 100.0) < 0) 0.0 else (logItem.injectAmount / 100.0)
@@ -175,17 +212,17 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.bolusType = "M" // Meal bolus
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logmealfail)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
if (!newRecord && detailedBolusInfo != null) {
// detailedInfo can be from another similar record. Reinsert
detailedBolusInfoStorage.add(detailedBolusInfo)
}
- status = "MEALBOLUSFAIL " + dateUtil.timeString(logDateTime)
+ status = "MEAL_BOLUS_FAIL " + dateUtil.timeString(logDateTime)
}
- LOG_INJECT_NORMAL_SUCCESS.LOG_KIND -> {
+ LOG_INJECT_NORMAL_SUCCESS.LOG_KIND -> {
val logItem = LOG_INJECT_NORMAL_SUCCESS.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
@@ -198,8 +235,12 @@ class BigLogInquireResponsePacket(
type = detailedBolusInfo?.bolusType,
pumpId = logDateTime,
pumpType = PumpType.DIACONN_G8,
- pumpSerial = diaconnG8Pump.serialNo.toString())
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
+ pumpSerial = diaconnG8Pump.serialNo.toString()
+ )
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumpLogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U "
+ )
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
@@ -207,17 +248,17 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.bolusType = "B" // bolus
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logsuccess)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
if (!newRecord && detailedBolusInfo != null) {
// detailedInfo can be from another similar record. Reinsert
detailedBolusInfoStorage.add(detailedBolusInfo)
}
- status = "BOLUSSUCCESS" + dateUtil.timeString(logDateTime)
+ status = "BOLUS_SUCCESS" + dateUtil.timeString(logDateTime)
}
- LOG_INJECT_NORMAL_FAIL.LOG_KIND -> {
+ LOG_INJECT_NORMAL_FAIL.LOG_KIND -> {
val logItem = LOG_INJECT_NORMAL_FAIL.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -231,27 +272,31 @@ class BigLogInquireResponsePacket(
type = detailedBolusInfo?.bolusType,
pumpId = logDateTime,
pumpType = PumpType.DIACONN_G8,
- pumpSerial = diaconnG8Pump.serialNo.toString())
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
+ pumpSerial = diaconnG8Pump.serialNo.toString()
+ )
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumpLogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U "
+ )
// Diaconn History Process
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.value = if ((logItem.injectAmount / 100.0) < 0) 0.0 else (logItem.injectAmount / 100.0)
diaconnG8HistoryRecord.duration = logItem.getInjectTime()
diaconnG8HistoryRecord.bolusType = "B" // bolus
- diaconnG8HistoryRecord.stringValue = getReasonName(pumplogKind, logItem.reason)
+ diaconnG8HistoryRecord.stringValue = getReasonName(pumpLogKind, logItem.reason)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
if (!newRecord && detailedBolusInfo != null) {
// detailedInfo can be from another similar record. Reinsert
detailedBolusInfoStorage.add(detailedBolusInfo)
}
- status = "BOLUSFAIL " + dateUtil.timeString(logDateTime)
+ status = "BOLUS_FAIL " + dateUtil.timeString(logDateTime)
}
- LOG_SET_SQUARE_INJECTION.LOG_KIND -> {
+ LOG_SET_SQUARE_INJECTION.LOG_KIND -> {
val logItem = LOG_SET_SQUARE_INJECTION.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -263,8 +308,12 @@ class BigLogInquireResponsePacket(
isEmulatingTB = false,
pumpId = logDateTime,
pumpType = PumpType.DIACONN_G8,
- pumpSerial = diaconnG8Pump.serialNo.toString())
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTART (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.setAmount / 100.0 + "U Duration: " + logItem.getInjectTime() * 10 + "min")
+ pumpSerial = diaconnG8Pump.serialNo.toString()
+ )
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT EXTENDED_START ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Amount: ${logItem.setAmount / 100.0}U Duration: ${logItem.getInjectTime() * 10}min"
+ )
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.value = logItem.setAmount / 100.0
@@ -272,13 +321,13 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logsquarestart)
diaconnG8HistoryRecord.bolusType = "E" // Extended
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "EXTENDEDBOLUSSTART " + dateUtil.timeString(logDateTime)
+ status = "EXTENDED_BOLUS_START " + dateUtil.timeString(logDateTime)
}
- LOG_INJECT_SQUARE_SUCCESS.LOG_KIND -> {
+ LOG_INJECT_SQUARE_SUCCESS.LOG_KIND -> {
val logItem = LOG_INJECT_SQUARE_SUCCESS.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -289,13 +338,13 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logsquaresuccess)
diaconnG8HistoryRecord.bolusType = "E" // Extended
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "EXTENDEDBOLUSEND " + dateUtil.timeString(logDateTime)
+ status = "EXTENDED_BOLUS_END " + dateUtil.timeString(logDateTime)
}
- LOG_INJECT_SQUARE_FAIL.LOG_KIND -> {
+ LOG_INJECT_SQUARE_FAIL.LOG_KIND -> {
val logItem = LOG_INJECT_SQUARE_FAIL.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -304,22 +353,26 @@ class BigLogInquireResponsePacket(
timestamp = logDateTime,
endPumpId = logDateTime,
pumpType = PumpType.DIACONN_G8,
- pumpSerial = diaconnG8Pump.serialNo.toString())
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTOP (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Delivered: " + logItem.injectAmount / 100.0 + "U RealDuration: " + logItem.getInjectTime() + "min")
+ pumpSerial = diaconnG8Pump.serialNo.toString()
+ )
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT EXTENDED_STOP ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Delivered: ${logItem.injectAmount / 100.0}U RealDuration: ${logItem.getInjectTime()}min"
+ )
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
diaconnG8HistoryRecord.duration = logItem.getInjectTime()
- diaconnG8HistoryRecord.stringValue = getReasonName(pumplogKind, logItem.reason)
+ diaconnG8HistoryRecord.stringValue = getReasonName(pumpLogKind, logItem.reason)
diaconnG8HistoryRecord.bolusType = "E"
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "EXTENDEDBOLUSFAIL " + dateUtil.timeString(logDateTime)
+ status = "EXTENDED_BOLUS_FAIL " + dateUtil.timeString(logDateTime)
}
- LOG_SET_DUAL_INJECTION.LOG_KIND -> {
+ LOG_SET_DUAL_INJECTION.LOG_KIND -> {
val logItem = LOG_SET_DUAL_INJECTION.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -333,8 +386,12 @@ class BigLogInquireResponsePacket(
isEmulatingTB = false,
pumpId = logDateTime,
pumpType = PumpType.DIACONN_G8,
- pumpSerial = diaconnG8Pump.serialNo.toString())
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTART (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.setSquareAmount / 100.0 + "U Duration: " + logItem.getInjectTime() * 10 + "min")
+ pumpSerial = diaconnG8Pump.serialNo.toString()
+ )
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT EXTENDED_START ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Amount: ${logItem.setSquareAmount / 100.0}U Duration: ${logItem.getInjectTime() * 10}min"
+ )
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.value = logItem.setSquareAmount / 100.0
@@ -342,14 +399,14 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logdualsquarestart)
diaconnG8HistoryRecord.bolusType = "D" // Extended
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "DUALEXTENTEDSTART " + dateUtil.timeString(logDateTime)
+ status = "DUAL_EXTENDED_START " + dateUtil.timeString(logDateTime)
}
- LOG_INJECTION_DUAL_NORMAL.LOG_KIND -> {
+ LOG_INJECTION_DUAL_NORMAL.LOG_KIND -> {
val logItem = LOG_INJECTION_DUAL_NORMAL.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -361,8 +418,12 @@ class BigLogInquireResponsePacket(
type = detailedBolusInfo?.bolusType,
pumpId = logDateTime,
pumpType = PumpType.DIACONN_G8,
- pumpSerial = diaconnG8Pump.serialNo.toString())
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT DUALBOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U Duration: " + logItem.getInjectTime() + "min")
+ pumpSerial = diaconnG8Pump.serialNo.toString()
+ )
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT DUAL_BOLUS ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Bolus: ${logItem.injectAmount / 100.0}U Duration: ${logItem.getInjectTime()}min"
+ )
diaconnG8Pump.lastBolusAmount = logItem.injectAmount / 100.0
diaconnG8Pump.lastBolusTime = logDateTime
@@ -375,17 +436,17 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.bolusType = "D" // bolus
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logdualnormalsuccess)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
if (!newRecord && detailedBolusInfo != null) {
// detailedInfo can be from another similar record. Reinsert
detailedBolusInfoStorage.add(detailedBolusInfo)
}
- status = "DUALBOLUS" + dateUtil.timeString(logDateTime)
+ status = "DUAL_BOLUS" + dateUtil.timeString(logDateTime)
}
- LOG_INJECT_DUAL_SUCCESS.LOG_KIND -> {
+ LOG_INJECT_DUAL_SUCCESS.LOG_KIND -> {
val logItem = LOG_INJECT_DUAL_SUCCESS.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -398,13 +459,13 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.bolusType = "D"
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logdualsquaresuccess)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "DUALBOLUS SQUARESUCCESS " + dateUtil.timeString(logDateTime)
+ status = "DUAL_BOLUS_SQUARE_SUCCESS " + dateUtil.timeString(logDateTime)
}
- LOG_INJECT_DUAL_FAIL.LOG_KIND -> {
+ LOG_INJECT_DUAL_FAIL.LOG_KIND -> {
val logItem = LOG_INJECT_DUAL_FAIL.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -413,23 +474,27 @@ class BigLogInquireResponsePacket(
timestamp = logDateTime,
endPumpId = logDateTime,
pumpType = PumpType.DIACONN_G8,
- pumpSerial = diaconnG8Pump.serialNo.toString())
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTOP (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Delivered: " + logItem.injectSquareAmount / 100.0 + "U RealDuration: " + logItem.getInjectTime() + "min")
+ pumpSerial = diaconnG8Pump.serialNo.toString()
+ )
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT EXTENDED_STOP ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Delivered: ${logItem.injectSquareAmount / 100.0}U RealDuration: ${logItem.getInjectTime()}min"
+ )
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.value = logItem.injectNormAmount / 100.0 + logItem.injectSquareAmount / 100.0
diaconnG8HistoryRecord.duration = logItem.getInjectTime()
diaconnG8HistoryRecord.bolusType = "D"
- diaconnG8HistoryRecord.stringValue = getReasonName(pumplogKind, logItem.reason)
+ diaconnG8HistoryRecord.stringValue = getReasonName(pumpLogKind, logItem.reason)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "DUALBOLUS FAIL " + dateUtil.timeString(logDateTime)
+ status = "DUAL_BOLUS FAIL " + dateUtil.timeString(logDateTime)
}
- LOG_INJECTION_1HOUR_BASAL.LOG_KIND -> {
+ LOG_INJECTION_1HOUR_BASAL.LOG_KIND -> {
val logItem = LOG_INJECTION_1HOUR_BASAL.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -439,13 +504,13 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.value = logItem.beforeAmount / 100.0
diaconnG8HistoryRecord.stringValue = "TB before: ${logItem.beforeAmount / 100.0} / TB after: ${logItem.afterAmount / 100.0}"
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
status = "1HOUR BASAL " + dateUtil.dateAndTimeString(logDateTime)
}
- LOG_SUSPEND_V2.LOG_KIND -> {
+ LOG_SUSPEND_V2.LOG_KIND -> {
val logItem = LOG_SUSPEND_V2.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -454,13 +519,13 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_lgosuspend, logItem.getBasalPattern())
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
status = "SUSPEND " + dateUtil.timeString(logDateTime)
}
- LOG_SUSPEND_RELEASE_V2.LOG_KIND -> {
+ LOG_SUSPEND_RELEASE_V2.LOG_KIND -> {
val logItem = LOG_SUSPEND_RELEASE_V2.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -469,10 +534,10 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_lgorelease, logItem.getBasalPattern())
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "SUSPENDRELEASE " + dateUtil.timeString(logDateTime)
+ status = "SUSPEND_RELEASE " + dateUtil.timeString(logDateTime)
}
LOG_CHANGE_INJECTOR_SUCCESS.LOG_KIND -> {
@@ -488,20 +553,23 @@ class BigLogInquireResponsePacket(
pumpType = PumpType.DIACONN_G8,
pumpSerial = diaconnG8Pump.serialNo.toString()
)
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT INSULINCHANGE(" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.remainAmount / 100.0 + "U")
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT INSULIN_CHANGE($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Amount: ${logItem.remainAmount / 100.0}U"
+ )
}
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_REFILL
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.value = logItem.remainAmount / 100.0
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_loginjectorprime, logItem.primeAmount / 100.0)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "INSULINCHANGE " + dateUtil.timeString(logDateTime)
+ status = "INSULIN_CHANGE " + dateUtil.timeString(logDateTime)
}
- LOG_CHANGE_TUBE_SUCCESS.LOG_KIND -> {
+ LOG_CHANGE_TUBE_SUCCESS.LOG_KIND -> {
val logItem = LOG_CHANGE_TUBE_SUCCESS.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -515,7 +583,10 @@ class BigLogInquireResponsePacket(
pumpType = PumpType.DIACONN_G8,
pumpSerial = diaconnG8Pump.serialNo.toString()
)
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT TUBECHANGE(" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.primeAmount / 100.0 + "U")
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT TUBE_CHANGE($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Amount: ${logItem.primeAmount / 100.0}U"
+ )
}
@@ -524,13 +595,13 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.value = logItem.remainAmount / 100.0
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logtubeprime, logItem.primeAmount / 100.0)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "TUBECHANGE " + dateUtil.timeString(logDateTime)
+ status = "TUBE_CHANGE " + dateUtil.timeString(logDateTime)
}
- LOG_INJECTION_1DAY.LOG_KIND -> { // Daily Bolus Log
+ LOG_INJECTION_1DAY.LOG_KIND -> { // Daily Bolus Log
val logItem = LOG_INJECTION_1DAY.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -543,12 +614,12 @@ class BigLogInquireResponsePacket(
val recordDateStr = "" + diaconnG8HistoryRecord.timestamp
var recordMap: MutableMap = mutableMapOf("dummy" to 0.0)
- if (dailyMaxvalInfo.containsKey(recordDateStr)) {
- recordMap = dailyMaxvalInfo[recordDateStr]!!
+ if (dailyMaxValInfo.containsKey(recordDateStr)) {
+ recordMap = dailyMaxValInfo[recordDateStr]!!
} else {
recordMap["bolus"] = 0.0
recordMap["basal"] = 0.0
- dailyMaxvalInfo[recordDateStr] = recordMap
+ dailyMaxValInfo[recordDateStr] = recordMap
}
if (diaconnG8HistoryRecord.dailyBolus > recordMap["bolus"]!!) {
@@ -561,7 +632,7 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.dailyBasal = recordMap["basal"]!!
}
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
@@ -576,10 +647,10 @@ class BigLogInquireResponsePacket(
diaconnG8Pump.serialNo.toString()
)
- status = "DAILYBOLUS " + dateUtil.timeString(logDateTime)
+ status = "DAILY_BOLUS " + dateUtil.timeString(logDateTime)
}
- LOG_INJECTION_1DAY_BASAL.LOG_KIND -> { // Daily Basal Log
+ LOG_INJECTION_1DAY_BASAL.LOG_KIND -> { // Daily Basal Log
val logItem = LOG_INJECTION_1DAY_BASAL.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -592,12 +663,12 @@ class BigLogInquireResponsePacket(
val recordDateStr = "" + diaconnG8HistoryRecord.timestamp
var recordMap: MutableMap = mutableMapOf("dummy" to 0.0)
- if (dailyMaxvalInfo.containsKey(recordDateStr)) {
- recordMap = dailyMaxvalInfo[recordDateStr]!!
+ if (dailyMaxValInfo.containsKey(recordDateStr)) {
+ recordMap = dailyMaxValInfo[recordDateStr]!!
} else {
recordMap["bolus"] = 0.0
recordMap["basal"] = 0.0
- dailyMaxvalInfo[recordDateStr] = recordMap
+ dailyMaxValInfo[recordDateStr] = recordMap
}
if (diaconnG8HistoryRecord.dailyBasal > recordMap["basal"]!!) {
@@ -610,7 +681,7 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.dailyBolus = recordMap["bolus"]!!
}
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
@@ -625,11 +696,10 @@ class BigLogInquireResponsePacket(
// diaconnG8Pump.serialNo.toString()
// )
-
- status = "DAILYBASAL " + dateUtil.timeString(logDateTime)
+ status = "DAILY_BASAL " + dateUtil.timeString(logDateTime)
}
- LOG_CHANGE_NEEDLE_SUCCESS.LOG_KIND -> {
+ LOG_CHANGE_NEEDLE_SUCCESS.LOG_KIND -> {
val logItem = LOG_CHANGE_NEEDLE_SUCCESS.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -642,7 +712,10 @@ class BigLogInquireResponsePacket(
pumpType = PumpType.DIACONN_G8,
pumpSerial = diaconnG8Pump.serialNo.toString()
)
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT NEEDLECHANGE(" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.remainAmount / 100.0 + "U")
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT NEEDLE_CHANGE($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Amount: ${logItem.remainAmount / 100.0}U"
+ )
}
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_REFILL
@@ -650,13 +723,13 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.value = logItem.remainAmount / 100.0
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logneedleprime, logItem.primeAmount / 100.0)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "NEEDLECHANGE " + dateUtil.timeString(logDateTime)
+ status = "NEEDLE_CHANGE " + dateUtil.timeString(logDateTime)
}
- LOG_TB_START_V3.LOG_KIND -> {
+ LOG_TB_START_V3.LOG_KIND -> {
val logItem = LOG_TB_START_V3.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
@@ -681,22 +754,26 @@ class BigLogInquireResponsePacket(
type = temporaryBasalInfo?.type,
pumpId = logDateTime,
pumpType = PumpType.DIACONN_G8,
- pumpSerial = diaconnG8Pump.serialNo.toString())
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT TEMPSTART (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Ratio: " + absoluteRate + "U Duration: " + logItem.tbTime * 15 + "min")
+ pumpSerial = diaconnG8Pump.serialNo.toString()
+ )
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT TEMP_START ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) Ratio: ${absoluteRate}U Duration: ${logItem.tbTime * 15}min"
+ )
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_TB
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.duration = logItem.tbTime * 15
diaconnG8HistoryRecord.value = absoluteRate
- diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logtempstart)
+ diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logtempstart)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "TEMPSTART " + dateUtil.timeString(logDateTime)
+ status = "TEMP_START " + dateUtil.timeString(logDateTime)
}
- LOG_TB_STOP_V3.LOG_KIND -> {
+ LOG_TB_STOP_V3.LOG_KIND -> {
val logItem = LOG_TB_STOP_V3.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -714,22 +791,23 @@ class BigLogInquireResponsePacket(
timestamp = logDateTime,
endPumpId = dateUtil.now(),
pumpType = PumpType.DIACONN_G8,
- pumpSerial = diaconnG8Pump.serialNo.toString())
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT TEMPSTOP (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")")
+ pumpSerial = diaconnG8Pump.serialNo.toString()
+ )
+ aapsLogger.debug(LTag.PUMPCOMM, "${if (newRecord) "**NEW** " else ""}EVENT TEMP_STOP ($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime)")
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_TB
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.value = absoluteRate
- diaconnG8HistoryRecord.stringValue = getReasonName(pumplogKind, logItem.reason)
+ diaconnG8HistoryRecord.stringValue = getReasonName(pumpLogKind, logItem.reason)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "TEMPSTOP " + dateUtil.timeString(logDateTime)
+ status = "TEMP_STOP " + dateUtil.timeString(logDateTime)
}
- LOG_ALARM_BATTERY.LOG_KIND -> { // BATTERY SHORTAGE ALARM
+ LOG_ALARM_BATTERY.LOG_KIND -> { // BATTERY SHORTAGE ALARM
val logItem = LOG_ALARM_BATTERY.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
@@ -739,13 +817,13 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logbatteryshorage)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "BATTERYALARM " + dateUtil.timeString(logDateTime)
+ status = "BATTERY_ALARM " + dateUtil.timeString(logDateTime)
}
- LOG_ALARM_BLOCK.LOG_KIND -> { // INJECTION BLOCKED ALARM
+ LOG_ALARM_BLOCK.LOG_KIND -> { // INJECTION BLOCKED ALARM
val logItem = LOG_ALARM_BLOCK.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
@@ -755,15 +833,15 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_ALARM
diaconnG8HistoryRecord.timestamp = logDateTime
diaconnG8HistoryRecord.value = logItem.amount / 100.0
- diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logalarmblock, getReasonName(pumplogKind, logItem.reason))
+ diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_logalarmblock, getReasonName(pumpLogKind, logItem.reason))
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "BLOCKALARM " + dateUtil.timeString(logDateTime)
+ status = "BLOCK_ALARM " + dateUtil.timeString(logDateTime)
}
- LOG_ALARM_SHORTAGE.LOG_KIND -> { // INSULIN SHORTAGE ALARM
+ LOG_ALARM_SHORTAGE.LOG_KIND -> { // INSULIN SHORTAGE ALARM
val logItem = LOG_ALARM_SHORTAGE.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
@@ -775,13 +853,13 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.value = logItem.remain.toDouble()
diaconnG8HistoryRecord.stringValue = rh.gs(R.string.diaconn_g8_loginsulinshorage)
diaconnG8HistoryRecord.lognum = logNum
- diaconnG8HistoryRecord.wrappingCount = wrapingCount
+ diaconnG8HistoryRecord.wrappingCount = wrappingCount
diaconnG8HistoryRecord.pumpUid = diaconnG8Pump.pumpUid
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
- status = "SHORTAGEALARM " + dateUtil.timeString(logDateTime)
+ status = "SHORT_AGE_ALARM " + dateUtil.timeString(logDateTime)
}
- LOG_RESET_SYS_V3.LOG_KIND -> {
+ LOG_RESET_SYS_V3.LOG_KIND -> {
val logItem = LOG_RESET_SYS_V3.parse(logDataToHexString)
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
@@ -790,7 +868,7 @@ class BigLogInquireResponsePacket(
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_ALARM
diaconnG8HistoryRecord.timestamp = logDateTime
- diaconnG8HistoryRecord.stringValue = getReasonName(pumplogKind, logItem.reason)
+ diaconnG8HistoryRecord.stringValue = getReasonName(pumpLogKind, logItem.reason)
diaconnHistoryRecordDao.createOrUpdate(diaconnG8HistoryRecord)
if (logItem.reason == 3.toByte()) {
if (sp.getBoolean(R.string.key_diaconn_g8_logbatterychange, true)) {
@@ -801,13 +879,16 @@ class BigLogInquireResponsePacket(
pumpType = PumpType.DIACONN_G8,
pumpSerial = diaconnG8Pump.serialNo.toString()
)
- aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BATTERYCHANGE(" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " remainAmount: " + logItem.batteryRemain.toInt() + "%")
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "${if (newRecord) "**NEW** " else ""}EVENT BATTERY_CHANGE($pumpLogKind) ${dateUtil.dateAndTimeString(logDateTime)} ($logDateTime) remainAmount: ${logItem.batteryRemain.toInt()}%"
+ )
}
}
status = "RESET " + dateUtil.timeString(logDateTime)
}
- else -> {
+ else -> {
status = rh.gs(R.string.diaconn_g8_logsyncinprogress)
rxBus.send(EventPumpStatusChanged(status))
continue
@@ -819,9 +900,9 @@ class BigLogInquireResponsePacket(
}
// 플랫폼 동기화이면,
- if(diaconnG8Pump.isPlatformUploadStarted){
+ if (diaconnG8Pump.isPlatformUploadStarted) {
aapsLogger.debug(LTag.PUMPCOMM, "Diaconn api upload start!!")
- var appUid:String = sp.getString(R.string.key_diaconn_g8_appuid, "")
+ var appUid: String = sp.getString(R.string.key_diaconn_g8_appuid, "")
if (appUid.isEmpty()) {
appUid = UUID.randomUUID().toString()
sp.putString(R.string.key_diaconn_g8_appuid, appUid)
@@ -831,7 +912,8 @@ class BigLogInquireResponsePacket(
val api = retrofit?.create(DiaconnApiService::class.java)
val pumpLogDto = PumpLogDto(
app_uid = appUid,
- app_version = context.packageManager.getPackageInfo(context.packageName, 0).versionName,
+ app_version = context.packageManager.safeGetPackageInfo(context.packageName, 0)
+ .versionName,
pump_uid = diaconnG8Pump.pumpUid,
pump_version = diaconnG8Pump.pumpVersion,
incarnation_num = diaconnG8Pump.pumpIncarnationNum,
@@ -841,18 +923,19 @@ class BigLogInquireResponsePacket(
api?.uploadPumpLogs(pumpLogDto)?.enqueue(
object : retrofit2.Callback {
override fun onResponse(call: Call, response: Response) {
- if(response.body()?.ok == true) {
+ if (response.body()?.ok == true) {
aapsLogger.debug(LTag.PUMPCOMM, "logs upload Success")
}
}
+
override fun onFailure(call: Call, t: Throwable) {
- aapsLogger.error(LTag.PUMPCOMM, "api uploadPumplogs failed")
+ aapsLogger.error(LTag.PUMPCOMM, "api uploadPumpLogs failed")
diaconnG8Pump.isPumpLogUploadFailed = true
t.printStackTrace()
}
}
)
- } catch(e: Exception) {
+ } catch (e: Exception) {
aapsLogger.error("Unhandled exception", e)
}
}
@@ -862,19 +945,19 @@ class BigLogInquireResponsePacket(
return "BIG_LOG_INQUIRE_RESPONSE"
}
- private fun getReasonName(logKind: Byte, reason: Byte): String{
+ private fun getReasonName(logKind: Byte, reason: Byte): String {
val logInjectNormalFail: Byte = 0x0B
val logInjectSquareFail: Byte = 0x0E
val logInjectDualFail: Byte = 0x11
val logTBStopV3: Byte = 0x13
val logResetSysV3: Byte = 0x01
- val logALarmBlock: Byte = 0x29
+ val logAlarmBlock: Byte = 0x29
return when (logKind) {
logInjectNormalFail, logInjectSquareFail, logInjectDualFail, logTBStopV3 -> failLog(reason)
- logResetSysV3 -> resetLog(reason)
- logALarmBlock -> blockLog(reason)
- else -> ""
+ logResetSysV3 -> resetLog(reason)
+ logAlarmBlock -> blockLog(reason)
+ else -> ""
}
}
@@ -895,26 +978,26 @@ class BigLogInquireResponsePacket(
private fun resetLog(reason: Byte): String {
return when (reason.toInt()) {
- 1 -> rh.gs(R.string.diaconn_g8_resetfactoryreset)
- 2 -> rh.gs(R.string.diaconn_g8_resetemergencyoff)
- 3 -> rh.gs(R.string.diaconn_g8_resetbatteryreplacement)
- 4 -> rh.gs(R.string.diaconn_g8_resetaftercalibration)
- 5 -> rh.gs(R.string.diaconn_g8_resetpreshipment)
- 9 -> rh.gs(R.string.diaconn_g8_resetunexpected)
+ 1 -> rh.gs(R.string.diaconn_g8_resetfactoryreset)
+ 2 -> rh.gs(R.string.diaconn_g8_resetemergencyoff)
+ 3 -> rh.gs(R.string.diaconn_g8_resetbatteryreplacement)
+ 4 -> rh.gs(R.string.diaconn_g8_resetaftercalibration)
+ 5 -> rh.gs(R.string.diaconn_g8_resetpreshipment)
+ 9 -> rh.gs(R.string.diaconn_g8_resetunexpected)
else -> ""
}
}
private fun blockLog(reason: Byte): String {
return when (reason.toInt()) {
- 1 -> rh.gs(R.string.diacon_g8_blockbasal)
- 2 -> rh.gs(R.string.diacon_g8_blockmealbolus)
- 3 -> rh.gs(R.string.diacon_g8_blocknormalbolus)
- 4 -> rh.gs(R.string.diacon_g8_blocksquarebolus)
- 5 -> rh.gs(R.string.diacon_g8_blockdualbolus)
- 6 -> rh.gs(R.string.diacon_g8_blockreplacetube)
- 7 -> rh.gs(R.string.diacon_g8_blockreplaceneedle)
- 8 -> rh.gs(R.string.diacon_g8_blockreplacesyringe)
+ 1 -> rh.gs(R.string.diacon_g8_blockbasal)
+ 2 -> rh.gs(R.string.diacon_g8_blockmealbolus)
+ 3 -> rh.gs(R.string.diacon_g8_blocknormalbolus)
+ 4 -> rh.gs(R.string.diacon_g8_blocksquarebolus)
+ 5 -> rh.gs(R.string.diacon_g8_blockdualbolus)
+ 6 -> rh.gs(R.string.diacon_g8_blockreplacetube)
+ 7 -> rh.gs(R.string.diacon_g8_blockreplaceneedle)
+ 8 -> rh.gs(R.string.diacon_g8_blockreplacesyringe)
else -> ""
}
}
diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt
index 44b53851e7..556e8dc38f 100644
--- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt
+++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/BLECommonService.kt
@@ -144,6 +144,7 @@ class BLECommonService @Inject internal constructor(
bluetoothGatt = null
}
+ @Suppress("OVERRIDE_DEPRECATION", "DEPRECATION")
private val mGattCallback: BluetoothGattCallback = object : BluetoothGattCallback() {
override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) {
onConnectionStateChangeSynchronized(gatt, newState) // call it synchronized
@@ -179,6 +180,7 @@ class BLECommonService @Inject internal constructor(
}
}
+ @Suppress("DEPRECATION")
@SuppressLint("MissingPermission")
@Synchronized
private fun writeCharacteristicNoResponse(characteristic: BluetoothGattCharacteristic, data: ByteArray) {
@@ -218,6 +220,7 @@ class BLECommonService @Inject internal constructor(
return bluetoothGatt?.services
}
+ @Suppress("DEPRECATION")
@SuppressLint("MissingPermission")
@Synchronized
private fun findCharacteristic() {
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 3a2a3a704e..46ed4ffcad 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Tue Oct 20 18:24:46 CEST 2020
+#Sun Sep 18 18:21:09 CEST 2022
distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl = https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
+zipStoreBase=GRADLE_USER_HOME
diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java
index 1a48c9d960..5fccf13dd9 100644
--- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java
+++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/InsightAlertService.java
@@ -333,7 +333,7 @@ public class InsightAlertService extends DaggerService implements InsightConnect
private void dismissNotification() {
NotificationManagerCompat.from(this).cancel(NOTIFICATION_ID);
- stopForeground(true);
+ stopForeground(STOP_FOREGROUND_REMOVE);
}
public class LocalBinder extends Binder {
diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java
index 97a5c9dfbe..e88086499b 100644
--- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java
+++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/activities/InsightPairingActivity.java
@@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.insight.activities;
+import info.nightscout.androidaps.extensions.BluetoothAdapterExtensionKt;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothManager;
@@ -33,6 +34,7 @@ import java.util.List;
import javax.inject.Inject;
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
+import info.nightscout.androidaps.extensions.IntentExtensionKt;
import info.nightscout.androidaps.insight.R;
import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck;
@@ -189,7 +191,7 @@ public class InsightPairingActivity extends NoSplashAppCompatActivity implements
if (!scanning) {
BluetoothAdapter bluetoothAdapter = ((BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
if (bluetoothAdapter != null) {
- if (!bluetoothAdapter.isEnabled()) bluetoothAdapter.enable();
+ BluetoothAdapterExtensionKt.safeEnable(bluetoothAdapter, 0, null);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
intentFilter.addAction(BluetoothDevice.ACTION_FOUND);
@@ -234,7 +236,8 @@ public class InsightPairingActivity extends NoSplashAppCompatActivity implements
if (action.equals(BluetoothAdapter.ACTION_DISCOVERY_FINISHED))
((BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter().startDiscovery();
else if (action.equals(BluetoothDevice.ACTION_FOUND)) {
- BluetoothDevice bluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+ BluetoothDevice bluetoothDevice =
+ IntentExtensionKt.safeGetParcelableExtra(intent, BluetoothDevice.EXTRA_DEVICE, BluetoothDevice.class);
deviceAdapter.addDevice(bluetoothDevice);
}
}
diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/utils/ConnectionEstablisher.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/utils/ConnectionEstablisher.java
index 7c957bd866..fa23118e77 100644
--- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/utils/ConnectionEstablisher.java
+++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/utils/ConnectionEstablisher.java
@@ -8,6 +8,7 @@ import java.io.IOException;
import java.lang.reflect.Method;
import java.util.UUID;
+import info.nightscout.androidaps.extensions.BluetoothAdapterExtensionKt;
public class ConnectionEstablisher extends Thread {
private final Callback callback;
@@ -26,14 +27,7 @@ public class ConnectionEstablisher extends Thread {
@Override
public void run() {
- try {
- if (!bluetoothAdapter.isEnabled()) {
- bluetoothAdapter.enable();
- Thread.sleep(2000);
- }
- } catch (InterruptedException ignored) {
- return;
- }
+ BluetoothAdapterExtensionKt.safeEnable(bluetoothAdapter, 2000, null);
if (forPairing && bluetoothDevice.getBondState() != BluetoothDevice.BOND_NONE) {
try {
Method removeBond = bluetoothDevice.getClass().getMethod("removeBond", (Class[]) null);
diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/PodActivationWizardActivity.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/PodActivationWizardActivity.kt
index f94ed3e0b0..8851b4239a 100644
--- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/PodActivationWizardActivity.kt
+++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/PodActivationWizardActivity.kt
@@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activat
import android.os.Bundle
import androidx.annotation.IdRes
+import info.nightscout.androidaps.extensions.safeGetSerializableExtra
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.activity.OmnipodWizardActivityBase
@@ -26,7 +27,7 @@ abstract class PodActivationWizardActivity : OmnipodWizardActivityBase() {
setContentView(R.layout.omnipod_common_pod_activation_wizard_activity)
startDestination = savedInstanceState?.getInt(KEY_START_DESTINATION, R.id.startPodActivationFragment)
- ?: if (intent.getSerializableExtra(KEY_TYPE) as Type == Type.LONG) {
+ ?: if (intent.safeGetSerializableExtra(KEY_TYPE, Type::class.java) == Type.LONG) {
R.id.startPodActivationFragment
} else {
R.id.attachPodFragment
diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/callbacks/BleCommCallbacks.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/callbacks/BleCommCallbacks.kt
index 3724341c89..226fbe9dce 100644
--- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/callbacks/BleCommCallbacks.kt
+++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/callbacks/BleCommCallbacks.kt
@@ -103,6 +103,7 @@ class BleCommCallbacks(
}
}
+ @Suppress("DEPRECATION")
override fun onCharacteristicWrite(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, status: Int) {
aapsLogger.debug(
LTag.PUMPBTCOMM,
@@ -115,6 +116,7 @@ class BleCommCallbacks(
onWrite(status, characteristic.uuid, characteristic.value)
}
+ @Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
override fun onCharacteristicChanged(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic) {
super.onCharacteristicChanged(gatt, characteristic)
@@ -134,6 +136,7 @@ class BleCommCallbacks(
}
}
+ @Suppress("DEPRECATION")
override fun onDescriptorWrite(gatt: BluetoothGatt, descriptor: BluetoothGattDescriptor, status: Int) {
super.onDescriptorWrite(gatt, descriptor, status)
diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/io/BleIO.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/io/BleIO.kt
index 0c93a2fc88..5e1974ea51 100644
--- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/io/BleIO.kt
+++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/io/BleIO.kt
@@ -24,7 +24,7 @@ data class BleSendErrorConfirming(val msg: String, val cause: Throwable? = null)
open class BleIO(
private val aapsLogger: AAPSLogger,
- var characteristic: BluetoothGattCharacteristic,
+ private var characteristic: BluetoothGattCharacteristic,
private val incomingPackets: BlockingQueue,
private val gatt: BluetoothGatt,
private val bleCommCallbacks: BleCommCallbacks,
@@ -33,7 +33,6 @@ open class BleIO(
/***
*
- * @param characteristic where to read from(CMD or DATA)
* @return a byte array with the received data or error
*/
fun receivePacket(timeoutMs: Long = DEFAULT_IO_TIMEOUT_MS): ByteArray? {
@@ -51,10 +50,9 @@ open class BleIO(
/***
*
- * @param characteristic where to write to(CMD or DATA)
* @param payload the data to send
*/
- @Suppress("ReturnCount")
+ @Suppress("ReturnCount", "DEPRECATION")
fun sendAndConfirmPacket(payload: ByteArray): BleSendResult {
aapsLogger.debug(LTag.PUMPBTCOMM, "BleIO: Sending on $type: ${payload.toHex()}")
val set = characteristic.setValue(payload)
@@ -103,7 +101,7 @@ open class BleIO(
* This will signal the pod it can start sending back data
* @return
*/
- fun readyToRead(): BleSendResult {
+ @Suppress("DEPRECATION") fun readyToRead(): BleSendResult {
gatt.setCharacteristicNotification(characteristic, true)
.assertTrue("enable notifications")
diff --git a/omnipod-dash/src/main/res/values-es-rES/strings.xml b/omnipod-dash/src/main/res/values-es-rES/strings.xml
index 81653b86c9..44561d226c 100644
--- a/omnipod-dash/src/main/res/values-es-rES/strings.xml
+++ b/omnipod-dash/src/main/res/values-es-rES/strings.xml
@@ -13,8 +13,8 @@
%1$.2f U, CH=%2$.1f g
Tasa: %1$.2f U, duración: %2$d minutos
- Estado de Bluetooth
- Dirección Bluetooth
+ Estado de bluetooth
+ Dirección bluetooth
Firmware %1$s / Bluetooth %2$s
Calidad de la conexión
Estado de entrega
@@ -24,7 +24,7 @@
Intentando emparejar el nuevo Pod y prepararlo.\n\nCuando el proceso de inicialización se haya completado con éxito, puedes pulsar Siguiente.
Sonido cuando la notificación suspendida de entrega está activada
- Error al conectar con el pod
+ Error al conectar con el POD
Se han encontrado demasiados pods para su activación
No se pudo encontrar un pod disponible para la activación
Error genérico: %1$s
diff --git a/pump-common/src/main/AndroidManifest.xml b/pump-common/src/main/AndroidManifest.xml
index 84d3bd3279..43a77bf6e2 100644
--- a/pump-common/src/main/AndroidManifest.xml
+++ b/pump-common/src/main/AndroidManifest.xml
@@ -1,5 +1,4 @@
-
+
(BluetoothDevice.EXTRA_DEVICE)
- aapsLogger.info(TAG, "in onReceive: INTENT" + gson.toJson(intent))
+ val device = intent.safeGetParcelableExtra(BluetoothDevice.EXTRA_DEVICE, BluetoothDevice::class.java)
+ aapsLogger.info(LTag.PUMPBTCOMM, "in onReceive: INTENT" + gson.toJson(intent))
if (device == null) {
- aapsLogger.error(TAG, "onReceive. Device is null. Exiting.")
+ aapsLogger.error(LTag.PUMPBTCOMM, "onReceive. Device is null. Exiting.")
return
} else {
if (device.address != targetDevice) {
- aapsLogger.error(TAG, "onReceive. Device is not the same as targetDevice. Exiting.")
+ aapsLogger.error(LTag.PUMPBTCOMM, "onReceive. Device is not the same as targetDevice. Exiting.")
return
}
}
@@ -53,11 +53,11 @@ class BondStateReceiver(
if (action == BluetoothDevice.ACTION_BOND_STATE_CHANGED) {
val bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.ERROR)
val previousBondState = intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE, -1)
- aapsLogger.info(TAG, "in onReceive: bondState=$bondState, previousBondState=$previousBondState")
+ aapsLogger.info(LTag.PUMPBTCOMM, "in onReceive: bondState=$bondState, previousBondState=$previousBondState")
if (bondState == targetState) {
- aapsLogger.info(TAG, "onReceive: found targeted state: $targetState")
+ aapsLogger.info(LTag.PUMPBTCOMM, "onReceive: found targeted state: $targetState")
val currentDeviceSettings = sp.getString(deviceAddress, "")
- if (currentDeviceSettings.equals(targetDevice)) {
+ if (currentDeviceSettings == targetDevice) {
if (targetState == 12) {
sp.putBoolean(bondedFlag, true)
rxBus.send(EventPumpConnectionParametersChanged())
@@ -67,10 +67,10 @@ class BondStateReceiver(
}
context.unregisterReceiver(this)
} else {
- aapsLogger.error(TAG, "onReceive: Device stored in SP is not the same as target device, process interrupted")
+ aapsLogger.error(LTag.PUMPBTCOMM, "onReceive: Device stored in SP is not the same as target device, process interrupted")
}
} else {
- aapsLogger.info(TAG, "onReceive: currentBondState=$bondState, targetBondState=$targetState")
+ aapsLogger.info(LTag.PUMPBTCOMM, "onReceive: currentBondState=$bondState, targetBondState=$targetState")
}
}
}
diff --git a/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/ui/PumpBLEConfigActivity.kt b/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/ui/PumpBLEConfigActivity.kt
index db19107d75..a2fab202c3 100755
--- a/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/ui/PumpBLEConfigActivity.kt
+++ b/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/ui/PumpBLEConfigActivity.kt
@@ -165,7 +165,7 @@ class PumpBLEConfigActivity : DaggerAppCompatActivity() {
true
}
- else -> false
+ else -> super.onOptionsItemSelected(item)
}
override fun onResume() {
diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.kt
index 0dbbd0302b..f2c80cc3c9 100644
--- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.kt
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEConfigActivity.kt
@@ -155,7 +155,7 @@ class RileyLinkBLEConfigActivity : DaggerAppCompatActivity() {
true
}
- else -> false
+ else -> super.onOptionsItemSelected(item)
}
private fun prepareForScanning() {
diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.kt
index 09a7a68c49..bcb6630d9a 100644
--- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.kt
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.kt
@@ -324,6 +324,7 @@ class RileyLinkBLE @Inject constructor(
init {
//orangeLink.rileyLinkBLE = this;
bluetoothGattCallback = object : BluetoothGattCallback() {
+ @Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
override fun onCharacteristicChanged(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic) {
super.onCharacteristicChanged(gatt, characteristic)
if (gattDebugEnabled) {
@@ -333,9 +334,10 @@ class RileyLinkBLE @Inject constructor(
}
if (characteristic.uuid == UUID.fromString(GattAttributes.CHARA_RADIO_RESPONSE_COUNT))
radioResponseCountNotified?.run()
- orangeLink.onCharacteristicChanged(characteristic)
+ orangeLink.onCharacteristicChanged(characteristic, characteristic.value)
}
+ @Suppress("OVERRIDE_DEPRECATION", "DEPRECATION")
override fun onCharacteristicRead(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, status: Int) {
super.onCharacteristicRead(gatt, characteristic, status)
val statusMessage = getGattStatusMessage(status)
@@ -344,6 +346,7 @@ class RileyLinkBLE @Inject constructor(
mCurrentOperation?.gattOperationCompletionCallback(characteristic.uuid, characteristic.value)
}
+ @Suppress("DEPRECATION")
override fun onCharacteristicWrite(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, status: Int) {
super.onCharacteristicWrite(gatt, characteristic, status)
val uuidString = GattAttributes.lookup(characteristic.uuid)
@@ -387,6 +390,7 @@ class RileyLinkBLE @Inject constructor(
}
}
+ @Suppress("DEPRECATION")
override fun onDescriptorWrite(gatt: BluetoothGatt, descriptor: BluetoothGattDescriptor, status: Int) {
super.onDescriptorWrite(gatt, descriptor, status)
if (gattDebugEnabled)
@@ -394,6 +398,7 @@ class RileyLinkBLE @Inject constructor(
mCurrentOperation?.gattOperationCompletionCallback(descriptor.uuid, descriptor.value)
}
+ @Suppress("OVERRIDE_DEPRECATION", "DEPRECATION")
override fun onDescriptorRead(gatt: BluetoothGatt, descriptor: BluetoothGattDescriptor, status: Int) {
super.onDescriptorRead(gatt, descriptor, status)
mCurrentOperation?.gattOperationCompletionCallback(descriptor.uuid, descriptor.value)
diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/device/OrangeLinkImpl.kt b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/device/OrangeLinkImpl.kt
index 4cfa13000b..0f1ab68f74 100644
--- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/device/OrangeLinkImpl.kt
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/device/OrangeLinkImpl.kt
@@ -32,11 +32,10 @@ class OrangeLinkImpl @Inject constructor(
lateinit var rileyLinkBLE: RileyLinkBLE
- fun onCharacteristicChanged(characteristic: BluetoothGattCharacteristic) {
+ fun onCharacteristicChanged(characteristic: BluetoothGattCharacteristic, data: ByteArray) {
if (characteristic.uuid.toString() == GattAttributes.CHARA_NOTIFICATION_ORANGE) {
- val data = characteristic.value
val first = 0xff and data[0].toInt()
- aapsLogger.info(LTag.PUMPBTCOMM, "OrangeLinkImpl: onCharacteristicChanged ${ByteUtil.shortHexString(characteristic.value)}=====$first")
+ aapsLogger.info(LTag.PUMPBTCOMM, "OrangeLinkImpl: onCharacteristicChanged ${ByteUtil.shortHexString(data)}=====$first")
val fv = data[3].toString() + "." + data[4]
val hv = data[5].toString() + "." + data[6]
rileyLinkServiceData.versionOrangeFirmware = fv
diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicReadOperation.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicReadOperation.java
index c85dec375c..9b96c498cc 100644
--- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicReadOperation.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicReadOperation.java
@@ -29,6 +29,7 @@ public class CharacteristicReadOperation extends BLECommOperation {
}
+ @SuppressWarnings({"deprecation"})
@Override
public void execute(RileyLinkBLE comm) {
gatt.readCharacteristic(characteristic);
diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicWriteOperation.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicWriteOperation.java
index 843e4e9816..802057c986 100644
--- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicWriteOperation.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/CharacteristicWriteOperation.java
@@ -30,6 +30,7 @@ public class CharacteristicWriteOperation extends BLECommOperation {
}
+ @SuppressWarnings({"deprecation"})
@Override
public void execute(RileyLinkBLE comm) {
diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/DescriptorWriteOperation.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/DescriptorWriteOperation.java
index b2fe8e55a5..1df2cc0a58 100644
--- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/DescriptorWriteOperation.java
+++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/operations/DescriptorWriteOperation.java
@@ -36,6 +36,7 @@ public class DescriptorWriteOperation extends BLECommOperation {
}
+ @SuppressWarnings({"deprecation"})
@Override
public void execute(RileyLinkBLE comm) {
descr.setValue(value);
diff --git a/shared/build.gradle b/shared/build.gradle
index befbf26b4a..a51586e640 100644
--- a/shared/build.gradle
+++ b/shared/build.gradle
@@ -28,10 +28,8 @@ dependencies {
api "com.google.dagger:dagger-android-support:$dagger_version"
//Logger
- api 'org.slf4j:slf4j-api:2.0.0'
- api("com.github.tony19:logback-android-classic:1.1.1-6") {
- exclude group: "com.google.android", module: "android"
- }
+ api 'org.slf4j:slf4j-api:1.7.36' // 2.0.x breaks logging. Code change needed
+ api 'com.github.tony19:logback-android:2.0.0'
api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0"
api "org.apache.commons:commons-lang3:$commonslang3_version"
diff --git a/shared/src/main/java/info/nightscout/androidaps/extensions/PackageManagerExtension.kt b/shared/src/main/java/info/nightscout/androidaps/extensions/PackageManagerExtension.kt
new file mode 100644
index 0000000000..a1a37df5f3
--- /dev/null
+++ b/shared/src/main/java/info/nightscout/androidaps/extensions/PackageManagerExtension.kt
@@ -0,0 +1,28 @@
+package info.nightscout.androidaps.extensions
+
+import android.content.Intent
+import android.content.pm.PackageInfo
+import android.content.pm.PackageManager
+import android.content.pm.ResolveInfo
+
+/**
+ * Safe version of getInstalledPackages depending on Android version running
+ */
+fun PackageManager.safeGetInstalledPackages(flags: Int): List =
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) getInstalledPackages(PackageManager.PackageInfoFlags.of(flags.toLong()))
+ else @Suppress("DEPRECATION") getInstalledPackages(flags)
+
+/**
+ * Safe version of queryBroadcastReceivers depending on Android version running
+ */
+fun PackageManager.safeQueryBroadcastReceivers(intent: Intent, flags: Int): List =
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) queryBroadcastReceivers(intent, PackageManager.ResolveInfoFlags.of(flags.toLong()))
+ else @Suppress("DEPRECATION") queryBroadcastReceivers(intent, flags)
+
+/**
+ * Safe version of getPackageInfo depending on Android version running
+ */
+@Throws(PackageManager.NameNotFoundException::class)
+fun PackageManager.safeGetPackageInfo(packageName: String, flags: Int): PackageInfo =
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(flags.toLong()))
+ else @Suppress("DEPRECATION") getPackageInfo(packageName, flags)
diff --git a/shared/src/main/java/info/nightscout/shared/logging/BundleLogger.kt b/shared/src/main/java/info/nightscout/shared/logging/BundleLogger.kt
index 1a3fb89c56..ddfc492c6a 100644
--- a/shared/src/main/java/info/nightscout/shared/logging/BundleLogger.kt
+++ b/shared/src/main/java/info/nightscout/shared/logging/BundleLogger.kt
@@ -10,6 +10,7 @@ object BundleLogger {
}
var string = "Bundle{"
for (key in bundle.keySet()) {
+ @Suppress("DEPRECATION")
string += " " + key + " => " + bundle[key] + ";"
}
string += " }Bundle"
diff --git a/wear/build.gradle b/wear/build.gradle
index e5410ca95a..ec41997972 100644
--- a/wear/build.gradle
+++ b/wear/build.gradle
@@ -101,7 +101,7 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation "androidx.preference:preference-ktx:$preferencektx_version"
implementation 'androidx.wear:wear:1.2.0'
- implementation "androidx.wear.tiles:tiles:1.0.1"
+ implementation 'androidx.wear.tiles:tiles:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
compileOnly "com.google.android.wearable:wearable:$wearable_version"
diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt
index 40a8f690e9..11184a7e2a 100644
--- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt
+++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/QuickSnoozeActivity.kt
@@ -8,6 +8,7 @@ import android.widget.Toast
import dagger.android.DaggerActivity
import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventWearToMobile
+import info.nightscout.androidaps.extensions.safeGetPackageInfo
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.shared.weardata.EventData
import javax.inject.Inject
@@ -31,7 +32,7 @@ class QuickSnoozeActivity : DaggerActivity() {
val i = Intent()
i.setClassName(xDripPackageName, "$xDripPackageName.QuickSnooze")
startActivity(i)
- } catch (e : Exception) {
+ } catch (e: Exception) {
Log.e("WEAR", "failed to snooze xDrip: ", e)
}
} else {
@@ -41,9 +42,10 @@ class QuickSnoozeActivity : DaggerActivity() {
finish()
}
+ @Suppress("SameParameterValue")
private fun isPackageExisted(targetPackage: String): Boolean {
try {
- packageManager.getPackageInfo(targetPackage, PackageManager.GET_META_DATA)
+ packageManager.safeGetPackageInfo(targetPackage, 0)
} catch (e: PackageManager.NameNotFoundException) {
return false
}
diff --git a/wear/src/main/res/values-sk-rSK/strings.xml b/wear/src/main/res/values-sk-rSK/strings.xml
index 8f2e92e153..fbd3d936d7 100644
--- a/wear/src/main/res/values-sk-rSK/strings.xml
+++ b/wear/src/main/res/values-sk-rSK/strings.xml
@@ -114,7 +114,7 @@
Uzavretý okruh
Prepnutie profilu
TDD
- Sacharidy
+ Sach
IOB
žiadny stav
červená