diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt
index 74bbac3d1d..862a8c918a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt
@@ -141,6 +141,7 @@ class ConfigBuilderFragment : DaggerFragment() {
private val enabledExclusive: RadioButton = baseView.findViewById(R.id.plugin_enabled_exclusive)
private val enabledInclusive: CheckBox = baseView.findViewById(R.id.plugin_enabled_inclusive)
private val pluginIcon: ImageView = baseView.findViewById(R.id.plugin_icon)
+ private val pluginIcon2: ImageView = baseView.findViewById(R.id.plugin_icon2)
private val pluginName: TextView = baseView.findViewById(R.id.plugin_name)
private val pluginDescription: TextView = baseView.findViewById(R.id.plugin_description)
private val pluginPreferences: ImageButton = baseView.findViewById(R.id.plugin_preferences)
@@ -184,6 +185,12 @@ class ConfigBuilderFragment : DaggerFragment() {
if (plugin.menuIcon != -1) {
pluginIcon.visibility = View.VISIBLE
pluginIcon.setImageDrawable(context?.let { ContextCompat.getDrawable(it, plugin.menuIcon) })
+ if (plugin.menuIcon2 != -1) {
+ pluginIcon2.visibility = View.VISIBLE
+ pluginIcon2.setImageDrawable(context?.let { ContextCompat.getDrawable(it, plugin.menuIcon2) })
+ } else {
+ pluginIcon2.visibility = View.GONE
+ }
} else {
pluginIcon.visibility = View.GONE
}
diff --git a/app/src/main/res/layout/configbuilder_single_plugin.xml b/app/src/main/res/layout/configbuilder_single_plugin.xml
index 94d6468828..c6303a922b 100644
--- a/app/src/main/res/layout/configbuilder_single_plugin.xml
+++ b/app/src/main/res/layout/configbuilder_single_plugin.xml
@@ -9,17 +9,17 @@
+ android:layout_marginEnd="6dp"
+ android:saveEnabled="false" />
+ android:layout_marginEnd="6dp"
+ android:saveEnabled="false" />
+ android:layout_gravity="center_vertical"
+ android:layout_marginEnd="8dp" />
+
+
+ android:layout_height="wrap_content"
+ android:saveEnabled="false" />
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.kt
index c0e83323a7..9e47f94639 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.kt
@@ -26,6 +26,8 @@ abstract class PluginBase(
open val menuIcon: Int
get() = pluginDescription.pluginIcon
+ open val menuIcon2: Int
+ get() = pluginDescription.pluginIcon2
open val name: String
get() = if (pluginDescription.pluginName == -1) "UNKNOWN" else resourceHelper.gs(pluginDescription.pluginName)
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.kt
index 7f2d873d23..4c9a4b1d03 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.kt
@@ -16,6 +16,7 @@ open class PluginDescription {
var visibleByDefault = false
var defaultPlugin = false
var pluginIcon = -1
+ var pluginIcon2 = -1
fun mainType(mainType: PluginType): PluginDescription = this.also { it.mainType = mainType }
fun fragmentClass(fragmentClass: String?): PluginDescription = this.also { it.fragmentClass = fragmentClass }
@@ -24,6 +25,7 @@ open class PluginDescription {
fun neverVisible(neverVisible: Boolean): PluginDescription = this.also { it.neverVisible = neverVisible }
fun showInList(showInList: Boolean): PluginDescription = this.also { it.showInList = showInList }
fun pluginIcon(pluginIcon: Int): PluginDescription = this.also { it.pluginIcon = pluginIcon }
+ fun pluginIcon2(pluginIcon2: Int): PluginDescription = this.also { it.pluginIcon2 = pluginIcon2 }
fun pluginName(pluginName: Int): PluginDescription = this.also { it.pluginName = pluginName }
fun shortName(shortName: Int): PluginDescription = this.also { it.shortName = shortName }
fun preferencesId(preferencesId: Int): PluginDescription = this.also { it.preferencesId = preferencesId }
diff --git a/core/src/main/res/drawable/ic_danai_128.xml b/core/src/main/res/drawable/ic_danai_128.xml
new file mode 100644
index 0000000000..d707b93523
--- /dev/null
+++ b/core/src/main/res/drawable/ic_danai_128.xml
@@ -0,0 +1,418 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/src/main/res/drawable/ic_danars.xml b/core/src/main/res/drawable/ic_danars.xml
deleted file mode 100644
index efa1c62276..0000000000
--- a/core/src/main/res/drawable/ic_danars.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt b/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt
index 063cdc0584..7c094f1824 100644
--- a/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt
+++ b/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt
@@ -7,9 +7,13 @@ import android.os.Handler
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.core.content.ContextCompat
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.activities.TDDStatsActivity
+import info.nightscout.androidaps.dana.activities.DanaHistoryActivity
+import info.nightscout.androidaps.dana.activities.DanaUserOptionsActivity
import info.nightscout.androidaps.dana.databinding.DanarFragmentBinding
+import info.nightscout.androidaps.dana.events.EventDanaRNewStatus
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.events.EventExtendedBolusChange
import info.nightscout.androidaps.events.EventInitializationChanged
@@ -84,7 +88,7 @@ class DanaFragment : DaggerFragment() {
binding.danaPumpstatus.setBackgroundColor(resourceHelper.gc(R.color.colorInitializingBorder))
- binding.history.setOnClickListener { startActivity(Intent(context, info.nightscout.androidaps.dana.activities.DanaHistoryActivity::class.java)) }
+ binding.history.setOnClickListener { startActivity(Intent(context, DanaHistoryActivity::class.java)) }
binding.viewprofile.setOnClickListener {
val profile = danaPump.createConvertedProfile()?.getDefaultProfileJson()
?: return@setOnClickListener
@@ -101,7 +105,7 @@ class DanaFragment : DaggerFragment() {
}.show(childFragmentManager, "ProfileViewDialog")
}
binding.stats.setOnClickListener { startActivity(Intent(context, TDDStatsActivity::class.java)) }
- binding.userOptions.setOnClickListener { startActivity(Intent(context, info.nightscout.androidaps.dana.activities.DanaUserOptionsActivity::class.java)) }
+ binding.userOptions.setOnClickListener { startActivity(Intent(context, DanaUserOptionsActivity::class.java)) }
binding.btconnection.setOnClickListener {
aapsLogger.debug(LTag.PUMP, "Clicked connect to pump")
danaPump.reset()
@@ -128,7 +132,7 @@ class DanaFragment : DaggerFragment() {
.observeOn(aapsSchedulers.main)
.subscribe({ updateGUI() }, fabricPrivacy::logException)
disposable += rxBus
- .toObservable(info.nightscout.androidaps.dana.events.EventDanaRNewStatus::class.java)
+ .toObservable(EventDanaRNewStatus::class.java)
.observeOn(aapsSchedulers.main)
.subscribe({ updateGUI() }, fabricPrivacy::logException)
disposable += rxBus
@@ -232,6 +236,8 @@ class DanaFragment : DaggerFragment() {
binding.queue.visibility = View.VISIBLE
binding.queue.text = status
}
+ val icon = if (danaPump.pumpType() == PumpType.DANA_I) R.drawable.ic_dana_i else R.drawable.ic_dana_rs
+ binding.danaIcon.setImageDrawable(context?.let { ContextCompat.getDrawable(it, icon) })
//hide user options button if not an RS pump or old firmware
// also excludes pump with model 03 because of untested error
binding.userOptions.visibility = (pump.hwModel != 1 && pump.protocol != 0x00).toVisibility()
diff --git a/dana/src/main/res/drawable/ic_dana_i.xml b/dana/src/main/res/drawable/ic_dana_i.xml
new file mode 100644
index 0000000000..e98652e28e
--- /dev/null
+++ b/dana/src/main/res/drawable/ic_dana_i.xml
@@ -0,0 +1,418 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dana/src/main/res/layout/danar_fragment.xml b/dana/src/main/res/layout/danar_fragment.xml
index d8d5f27158..7fa180c672 100644
--- a/dana/src/main/res/layout/danar_fragment.xml
+++ b/dana/src/main/res/layout/danar_fragment.xml
@@ -682,11 +682,12 @@
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
-
diff --git a/dana/src/main/res/values/strings.xml b/dana/src/main/res/values/strings.xml
index 131e23c744..5cfaa7916a 100644
--- a/dana/src/main/res/values/strings.xml
+++ b/dana/src/main/res/values/strings.xml
@@ -19,9 +19,9 @@
Pairing OK
Pairing timed out
Waiting for pairing on pump
- DanaRS
+ Dana-i/RS
Dana
- Pump integration for DANA Diabecare RS pumps
+ Pump integration for DANA Diabecare RS and Dana-i pumps
Max bolus violation
Command error
Speed error
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgCheckValue_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgCheckValue_k.kt
index 362240338c..58f9037697 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgCheckValue_k.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgCheckValue_k.kt
@@ -1,6 +1,7 @@
package info.nightscout.androidaps.danaRKorean.comm
import dagger.android.HasAndroidInjector
+import info.nightscout.androidaps.dana.DanaPump
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.logging.LTag
@@ -19,7 +20,7 @@ class MsgCheckValue_k(
danaPump.hwModel = intFromBuff(bytes, 0, 1)
danaPump.protocol = intFromBuff(bytes, 1, 1)
danaPump.productCode = intFromBuff(bytes, 2, 1)
- if (danaPump.hwModel != info.nightscout.androidaps.dana.DanaPump.DOMESTIC_MODEL) {
+ if (danaPump.hwModel != DanaPump.DOMESTIC_MODEL) {
danaRKoreanPlugin.disconnect("Wrong Model")
aapsLogger.debug(LTag.PUMPCOMM, "Wrong model selected")
}
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 ffe87ed77b..412fe01956 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt
@@ -8,6 +8,7 @@ import android.os.IBinder
import android.text.format.DateFormat
import androidx.preference.Preference
import dagger.android.HasAndroidInjector
+import info.nightscout.androidaps.dana.DanaFragment
import info.nightscout.androidaps.dana.DanaPump
import info.nightscout.androidaps.dana.comm.RecordTypes
import info.nightscout.androidaps.danars.events.EventDanaRSDeviceChange
@@ -37,6 +38,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.sharedPreferences.SP
import io.reactivex.disposables.CompositeDisposable
+import io.reactivex.rxkotlin.plusAssign
import org.json.JSONException
import org.json.JSONObject
import javax.inject.Inject
@@ -62,14 +64,16 @@ class DanaRSPlugin @Inject constructor(
private val temporaryBasalStorage: TemporaryBasalStorage,
private val fabricPrivacy: FabricPrivacy,
private val dateUtil: DateUtil
-) : PumpPluginBase(PluginDescription()
- .mainType(PluginType.PUMP)
- .fragmentClass(info.nightscout.androidaps.dana.DanaFragment::class.java.name)
- .pluginIcon(R.drawable.ic_danars_128)
- .pluginName(R.string.danarspump)
- .shortName(R.string.danarspump_shortname)
- .preferencesId(R.xml.pref_danars)
- .description(R.string.description_pump_dana_rs),
+) : PumpPluginBase(
+ PluginDescription()
+ .mainType(PluginType.PUMP)
+ .fragmentClass(DanaFragment::class.java.name)
+ .pluginIcon(R.drawable.ic_danai_128)
+ .pluginIcon2(R.drawable.ic_danars_128)
+ .pluginName(R.string.danarspump)
+ .shortName(R.string.danarspump_shortname)
+ .preferencesId(R.xml.pref_danars)
+ .description(R.string.description_pump_dana_rs),
injector, aapsLogger, resourceHelper, commandQueue
), Pump, Dana, Constraints {
@@ -93,25 +97,21 @@ class DanaRSPlugin @Inject constructor(
super.onStart()
val intent = Intent(context, DanaRSService::class.java)
context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE)
- disposable.add(rxBus
+ disposable += rxBus
.toObservable(EventAppExit::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ context.unbindService(mConnection) }, fabricPrivacy::logException)
- )
- disposable.add(rxBus
+ disposable += rxBus
.toObservable(EventConfigBuilderChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe { danaPump.reset() }
- )
- disposable.add(rxBus
+ disposable += rxBus
.toObservable(EventDanaRSDeviceChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({
pumpSync.connectNewPump()
changePump()
-
}, fabricPrivacy::logException)
- )
changePump() // load device name
}
@@ -584,17 +584,9 @@ class DanaRSPlugin @Inject constructor(
return pumpJson
}
- override fun manufacturer(): ManufacturerType {
- return ManufacturerType.Sooil
- }
-
- override fun model(): PumpType {
- return PumpType.DANA_RS
- }
-
- override fun serialNumber(): String {
- return danaPump.serialNumber
- }
+ override fun manufacturer(): ManufacturerType = ManufacturerType.Sooil
+ override fun model(): PumpType = danaPump.pumpType()
+ override fun serialNumber(): String = danaPump.serialNumber
@Suppress("SpellCheckingInspection")
override fun shortStatus(veryShort: Boolean): String {
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 15dca9e37a..51d16a88eb 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
@@ -555,7 +555,7 @@ class BLEComm @Inject internal constructor(
sendEasyMenuCheck()
}
// response OK BLE5
- } else if (decryptedBuffer.size == 14 && decryptedBuffer[2] == 'O'.toByte() && decryptedBuffer[3] == 'K'.toByte()) {
+ } else if (decryptedBuffer.size == 14 && decryptedBuffer[2] == 'O'.code.toByte() && decryptedBuffer[3] == 'K'.code.toByte()) {
// v3 2nd layer encryption
encryption = EncryptionType.ENCRYPTION_BLE5
danaPump.ignoreUserPassword = true
diff --git a/diaconn/build.gradle b/diaconn/build.gradle
index 2b1454339c..46e26b9616 100644
--- a/diaconn/build.gradle
+++ b/diaconn/build.gradle
@@ -10,8 +10,6 @@ apply from: "${project.rootDir}/gradle/jacoco_global.gradle"
android {
defaultConfig {
- versionCode 1
- versionName "1.0"
kapt {
arguments {
arg("room.incremental", "true")