:pump:virtual
This commit is contained in:
parent
53e29aaf33
commit
16bf64129d
|
@ -218,10 +218,11 @@ dependencies {
|
||||||
implementation project(':pump:medtronic')
|
implementation project(':pump:medtronic')
|
||||||
implementation project(':pump:pump-common')
|
implementation project(':pump:pump-common')
|
||||||
implementation project(':pump:pump-core')
|
implementation project(':pump:pump-core')
|
||||||
implementation project(':pump:rileylink')
|
|
||||||
implementation project(':pump:omnipod-common')
|
implementation project(':pump:omnipod-common')
|
||||||
implementation project(':pump:omnipod-eros')
|
implementation project(':pump:omnipod-eros')
|
||||||
implementation project(':pump:omnipod-dash')
|
implementation project(':pump:omnipod-dash')
|
||||||
|
implementation project(':pump:rileylink')
|
||||||
|
implementation project(':pump:virtual')
|
||||||
implementation project(':workflow')
|
implementation project(':workflow')
|
||||||
|
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
|
|
@ -48,7 +48,6 @@ import info.nightscout.plugins.general.autotune.AutotunePlugin
|
||||||
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||||
import info.nightscout.plugins.general.wear.WearPlugin
|
import info.nightscout.plugins.general.wear.WearPlugin
|
||||||
import info.nightscout.plugins.general.xdripStatusline.StatusLinePlugin
|
import info.nightscout.plugins.general.xdripStatusline.StatusLinePlugin
|
||||||
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
|
|
||||||
import info.nightscout.plugins.source.AidexPlugin
|
import info.nightscout.plugins.source.AidexPlugin
|
||||||
import info.nightscout.plugins.source.DexcomPlugin
|
import info.nightscout.plugins.source.DexcomPlugin
|
||||||
import info.nightscout.plugins.source.EversensePlugin
|
import info.nightscout.plugins.source.EversensePlugin
|
||||||
|
@ -63,6 +62,7 @@ import info.nightscout.plugins.sync.tidepool.TidepoolPlugin
|
||||||
import info.nightscout.pump.combo.ComboPlugin
|
import info.nightscout.pump.combo.ComboPlugin
|
||||||
import info.nightscout.pump.combov2.ComboV2Plugin
|
import info.nightscout.pump.combov2.ComboV2Plugin
|
||||||
import info.nightscout.pump.diaconn.DiaconnG8Plugin
|
import info.nightscout.pump.diaconn.DiaconnG8Plugin
|
||||||
|
import info.nightscout.pump.virtual.VirtualPumpPlugin
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventPreferenceChange
|
import info.nightscout.rx.events.EventPreferenceChange
|
||||||
import info.nightscout.rx.events.EventRebuildTabs
|
import info.nightscout.rx.events.EventRebuildTabs
|
||||||
|
|
|
@ -32,6 +32,7 @@ import info.nightscout.pump.dana.di.DanaHistoryModule
|
||||||
import info.nightscout.pump.dana.di.DanaModule
|
import info.nightscout.pump.dana.di.DanaModule
|
||||||
import info.nightscout.pump.danars.di.DanaRSModule
|
import info.nightscout.pump.danars.di.DanaRSModule
|
||||||
import info.nightscout.pump.diaconn.di.DiaconnG8Module
|
import info.nightscout.pump.diaconn.di.DiaconnG8Module
|
||||||
|
import info.nightscout.pump.virtual.di.VirtualPumpModule
|
||||||
import info.nightscout.rx.di.RxModule
|
import info.nightscout.rx.di.RxModule
|
||||||
import info.nightscout.shared.di.SharedModule
|
import info.nightscout.shared.di.SharedModule
|
||||||
import info.nightscout.shared.impl.di.SharedImplModule
|
import info.nightscout.shared.impl.di.SharedImplModule
|
||||||
|
@ -83,7 +84,8 @@ import javax.inject.Singleton
|
||||||
OmnipodDashModule::class,
|
OmnipodDashModule::class,
|
||||||
OmnipodErosModule::class,
|
OmnipodErosModule::class,
|
||||||
PumpCommonModule::class,
|
PumpCommonModule::class,
|
||||||
RileyLinkModule::class
|
RileyLinkModule::class,
|
||||||
|
VirtualPumpModule::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
interface AppComponent : AndroidInjector<MainApp> {
|
interface AppComponent : AndroidInjector<MainApp> {
|
||||||
|
|
|
@ -41,7 +41,6 @@ import info.nightscout.plugins.general.wear.WearPlugin
|
||||||
import info.nightscout.plugins.general.xdripStatusline.StatusLinePlugin
|
import info.nightscout.plugins.general.xdripStatusline.StatusLinePlugin
|
||||||
import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||||
import info.nightscout.plugins.profile.ProfilePlugin
|
import info.nightscout.plugins.profile.ProfilePlugin
|
||||||
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
|
|
||||||
import info.nightscout.plugins.source.AidexPlugin
|
import info.nightscout.plugins.source.AidexPlugin
|
||||||
import info.nightscout.plugins.source.DexcomPlugin
|
import info.nightscout.plugins.source.DexcomPlugin
|
||||||
import info.nightscout.plugins.source.GlimpPlugin
|
import info.nightscout.plugins.source.GlimpPlugin
|
||||||
|
@ -59,6 +58,7 @@ import info.nightscout.plugins.sync.tidepool.TidepoolPlugin
|
||||||
import info.nightscout.pump.combo.ComboPlugin
|
import info.nightscout.pump.combo.ComboPlugin
|
||||||
import info.nightscout.pump.combov2.ComboV2Plugin
|
import info.nightscout.pump.combov2.ComboV2Plugin
|
||||||
import info.nightscout.pump.diaconn.DiaconnG8Plugin
|
import info.nightscout.pump.diaconn.DiaconnG8Plugin
|
||||||
|
import info.nightscout.pump.virtual.VirtualPumpPlugin
|
||||||
import info.nightscout.sensitivity.SensitivityAAPSPlugin
|
import info.nightscout.sensitivity.SensitivityAAPSPlugin
|
||||||
import info.nightscout.sensitivity.SensitivityOref1Plugin
|
import info.nightscout.sensitivity.SensitivityOref1Plugin
|
||||||
import info.nightscout.sensitivity.SensitivityWeightedAveragePlugin
|
import info.nightscout.sensitivity.SensitivityWeightedAveragePlugin
|
||||||
|
|
|
@ -6,7 +6,7 @@ import info.nightscout.androidaps.TestBaseWithProfile
|
||||||
import info.nightscout.core.pump.toHtml
|
import info.nightscout.core.pump.toHtml
|
||||||
import info.nightscout.interfaces.pump.PumpEnactResult
|
import info.nightscout.interfaces.pump.PumpEnactResult
|
||||||
import info.nightscout.plugins.aps.loop.extensions.json
|
import info.nightscout.plugins.aps.loop.extensions.json
|
||||||
import info.nightscout.plugins.extensions.toText
|
import info.nightscout.pump.virtual.extensions.toText
|
||||||
import info.nightscout.plugins.sync.nsShared.extensions.log
|
import info.nightscout.plugins.sync.nsShared.extensions.log
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
import org.junit.jupiter.api.Assertions
|
||||||
|
|
|
@ -71,6 +71,8 @@ files:
|
||||||
translation: /pump/omnipod-eros/src/main/res/values-%android_code%/strings.xml
|
translation: /pump/omnipod-eros/src/main/res/values-%android_code%/strings.xml
|
||||||
- source: /pump/rileylink/src/main/res/values/strings.xml
|
- source: /pump/rileylink/src/main/res/values/strings.xml
|
||||||
translation: /pump/rileylink/src/main/res/values-%android_code%/strings.xml
|
translation: /pump/rileylink/src/main/res/values-%android_code%/strings.xml
|
||||||
|
- source: /pump/virtual/src/main/res/values/strings.xml
|
||||||
|
translation: /pump/virtual/src/main/res/values-%android_code%/strings.xml
|
||||||
- source: /insight/src/main/res/values/strings.xml
|
- source: /insight/src/main/res/values/strings.xml
|
||||||
translation: /insight/src/main/res/values-%android_code%/strings.xml
|
translation: /insight/src/main/res/values-%android_code%/strings.xml
|
||||||
- source: /insight/src/main/res/values/alert_codes.xml
|
- source: /insight/src/main/res/values/alert_codes.xml
|
||||||
|
|
|
@ -18,7 +18,6 @@ import info.nightscout.plugins.iob.iobCobCalculator.data.AutosensDataObject
|
||||||
SMSCommunicatorModule::class,
|
SMSCommunicatorModule::class,
|
||||||
ProfileModule::class,
|
ProfileModule::class,
|
||||||
SourceModule::class,
|
SourceModule::class,
|
||||||
VirtualPumpModule::class,
|
|
||||||
SkinsModule::class,
|
SkinsModule::class,
|
||||||
SkinsUiModule::class,
|
SkinsUiModule::class,
|
||||||
ActionsModule::class,
|
ActionsModule::class,
|
||||||
|
|
|
@ -14,9 +14,9 @@ import info.nightscout.interfaces.XDripBroadcast
|
||||||
import info.nightscout.interfaces.plugin.PluginBase
|
import info.nightscout.interfaces.plugin.PluginBase
|
||||||
import info.nightscout.interfaces.plugin.PluginDescription
|
import info.nightscout.interfaces.plugin.PluginDescription
|
||||||
import info.nightscout.interfaces.plugin.PluginType
|
import info.nightscout.interfaces.plugin.PluginType
|
||||||
|
import info.nightscout.interfaces.pump.VirtualPump
|
||||||
import info.nightscout.interfaces.source.BgSource
|
import info.nightscout.interfaces.source.BgSource
|
||||||
import info.nightscout.plugins.R
|
import info.nightscout.plugins.R
|
||||||
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
|
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
|
@ -39,7 +39,7 @@ class RandomBgPlugin @Inject constructor(
|
||||||
private val sp: SP,
|
private val sp: SP,
|
||||||
private val repository: AppRepository,
|
private val repository: AppRepository,
|
||||||
private val xDripBroadcast: XDripBroadcast,
|
private val xDripBroadcast: XDripBroadcast,
|
||||||
private val virtualPumpPlugin: VirtualPumpPlugin,
|
private val virtualPump: VirtualPump,
|
||||||
private val config: Config
|
private val config: Config
|
||||||
) : PluginBase(
|
) : PluginBase(
|
||||||
PluginDescription()
|
PluginDescription()
|
||||||
|
@ -94,7 +94,7 @@ class RandomBgPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun specialEnableCondition(): Boolean {
|
override fun specialEnableCondition(): Boolean {
|
||||||
return isRunningTest() || config.isUnfinishedMode() || virtualPumpPlugin.isEnabled() && config.isEngineeringMode()
|
return isRunningTest() || config.isUnfinishedMode() || virtualPump.isEnabled() && config.isEngineeringMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleNewData() {
|
private fun handleNewData() {
|
||||||
|
|
|
@ -12,36 +12,4 @@
|
||||||
<item>@string/value_system_theme</item>
|
<item>@string/value_system_theme</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="virtualPumpTypes">
|
|
||||||
<item>Generic AAPS</item>
|
|
||||||
<item>MDI</item>
|
|
||||||
<item>Accu-Chek Combo</item>
|
|
||||||
<item>Accu-Chek Spirit</item>
|
|
||||||
<item>Accu-Chek Insight</item>
|
|
||||||
<item>Accu-Chek Solo</item>
|
|
||||||
<item>Animas Ping</item>
|
|
||||||
<item>Animas Vibe</item>
|
|
||||||
<item>Cellnovo</item>
|
|
||||||
<item>DanaR</item>
|
|
||||||
<item>DanaR Korean</item>
|
|
||||||
<item>DanaRS</item>
|
|
||||||
<item>DanaRv2</item>
|
|
||||||
<item>DanaI</item>
|
|
||||||
<item>Diaconn G8</item>
|
|
||||||
<item>Eoflow Eopatch2</item>
|
|
||||||
<item>Medtronic 512/712</item>
|
|
||||||
<item>Medtronic 515/715</item>
|
|
||||||
<item>Medtronic 522/722</item>
|
|
||||||
<item>Medtronic 523/723 (Revel)</item>
|
|
||||||
<item>Medtronic 554/754 (Veo)</item>
|
|
||||||
<item>Medtronic 640G</item>
|
|
||||||
<item>Omnipod Dash</item>
|
|
||||||
<item>Omnipod Eros</item>
|
|
||||||
<item>Tandem t:slim</item>
|
|
||||||
<item>Tandem t:flex</item>
|
|
||||||
<item>Tandem t:slim G4</item>
|
|
||||||
<item>Tandem t:slim X2</item>
|
|
||||||
<item>YpsoPump</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -344,16 +344,6 @@
|
||||||
<string name="graph_scale">Graph scale</string>
|
<string name="graph_scale">Graph scale</string>
|
||||||
<string name="graph_menu_divider_header">Graph</string>
|
<string name="graph_menu_divider_header">Graph</string>
|
||||||
|
|
||||||
<!-- VirtualPump -->
|
|
||||||
<string name="virtual_pump_type">Virtual Pump Type</string>
|
|
||||||
<string name="virtual_pump_definition">Pump Definition</string>
|
|
||||||
<string name="virtual_pump_pump_def">Bolus: Step=%1$s\nExtended Bolus: [Step=%2$s, Duration=%3$smin-%4$sh]\nBasal: Step=%5$s\nTBR: %6$s (by %7$s), Duration=%8$smin-%9$sh\n%10$s</string>
|
|
||||||
|
|
||||||
<string name="virtual_pump_shortname">VPUMP</string>
|
|
||||||
<string name="description_pump_virtual">Pump integration for pumps which don\'t have any driver yet (Open Loop)</string>
|
|
||||||
<string name="virtual_pump_label">VIRTUAL PUMP</string>
|
|
||||||
<string name="virtualpump_settings">Virtual pump settings</string>
|
|
||||||
|
|
||||||
<!-- Source -->
|
<!-- Source -->
|
||||||
<string name="key_dexcom_log_ns_sensor_change" translatable="false">dexcom_lognssensorchange</string>
|
<string name="key_dexcom_log_ns_sensor_change" translatable="false">dexcom_lognssensorchange</string>
|
||||||
<string name="key_last_processed_glunovo_timestamp" translatable="false">last_processed_glunovo_timestamp</string>
|
<string name="key_last_processed_glunovo_timestamp" translatable="false">last_processed_glunovo_timestamp</string>
|
||||||
|
|
1
pump/virtual/.gitignore
vendored
Normal file
1
pump/virtual/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
27
pump/virtual/build.gradle
Normal file
27
pump/virtual/build.gradle
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
plugins {
|
||||||
|
id 'com.android.library'
|
||||||
|
id 'kotlin-android'
|
||||||
|
id 'kotlin-kapt'
|
||||||
|
id 'kotlin-allopen'
|
||||||
|
id 'com.hiya.jacoco-android'
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "${project.rootDir}/core/main/android_dependencies.gradle"
|
||||||
|
apply from: "${project.rootDir}/core/main/android_module_dependencies.gradle"
|
||||||
|
apply from: "${project.rootDir}/core/main/allopen_dependencies.gradle"
|
||||||
|
apply from: "${project.rootDir}/core/main/test_dependencies.gradle"
|
||||||
|
apply from: "${project.rootDir}/core/main/jacoco_global.gradle"
|
||||||
|
|
||||||
|
android {
|
||||||
|
|
||||||
|
namespace 'info.nightscout.pump.virtual'
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(':app-wear-shared:shared')
|
||||||
|
implementation project(':database:entities')
|
||||||
|
implementation project(':core:interfaces')
|
||||||
|
implementation project(':core:main')
|
||||||
|
implementation project(':core:ui')
|
||||||
|
implementation project(':core:utils')
|
||||||
|
}
|
0
pump/virtual/consumer-rules.pro
Normal file
0
pump/virtual/consumer-rules.pro
Normal file
21
pump/virtual/proguard-rules.pro
vendored
Normal file
21
pump/virtual/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
3
pump/virtual/src/main/AndroidManifest.xml
Normal file
3
pump/virtual/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.pump.virtual
|
package info.nightscout.pump.virtual
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
|
@ -11,9 +11,8 @@ import info.nightscout.core.extensions.toStringFull
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.plugins.R
|
import info.nightscout.pump.virtual.databinding.VirtualPumpFragmentBinding
|
||||||
import info.nightscout.plugins.databinding.VirtualPumpFragmentBinding
|
import info.nightscout.pump.virtual.events.EventVirtualPumpUpdateGui
|
||||||
import info.nightscout.plugins.pump.virtual.events.EventVirtualPumpUpdateGui
|
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventExtendedBolusChange
|
import info.nightscout.rx.events.EventExtendedBolusChange
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.pump.virtual
|
package info.nightscout.pump.virtual
|
||||||
|
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
@ -28,9 +28,8 @@ import info.nightscout.interfaces.pump.defs.PumpDescription
|
||||||
import info.nightscout.interfaces.pump.defs.PumpType
|
import info.nightscout.interfaces.pump.defs.PumpType
|
||||||
import info.nightscout.interfaces.queue.CommandQueue
|
import info.nightscout.interfaces.queue.CommandQueue
|
||||||
import info.nightscout.interfaces.utils.TimeChangeType
|
import info.nightscout.interfaces.utils.TimeChangeType
|
||||||
import info.nightscout.plugins.R
|
import info.nightscout.pump.virtual.events.EventVirtualPumpUpdateGui
|
||||||
import info.nightscout.plugins.extensions.toText
|
import info.nightscout.pump.virtual.extensions.toText
|
||||||
import info.nightscout.plugins.pump.virtual.events.EventVirtualPumpUpdateGui
|
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventOverviewBolusProgress
|
import info.nightscout.rx.events.EventOverviewBolusProgress
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.plugins.di
|
package info.nightscout.pump.virtual.di
|
||||||
|
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
import info.nightscout.interfaces.pump.VirtualPump
|
import info.nightscout.interfaces.pump.VirtualPump
|
||||||
import info.nightscout.plugins.pump.virtual.VirtualPumpFragment
|
import info.nightscout.pump.virtual.VirtualPumpFragment
|
||||||
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
|
import info.nightscout.pump.virtual.VirtualPumpPlugin
|
||||||
|
|
||||||
@Module(
|
@Module(
|
||||||
includes = [
|
includes = [
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.pump.virtual.events
|
package info.nightscout.pump.virtual.events
|
||||||
|
|
||||||
import info.nightscout.rx.events.EventUpdateGui
|
import info.nightscout.rx.events.EventUpdateGui
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.extensions
|
package info.nightscout.pump.virtual.extensions
|
||||||
|
|
||||||
import info.nightscout.interfaces.pump.PumpEnactResult
|
import info.nightscout.interfaces.pump.PumpEnactResult
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
|
@ -2,7 +2,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".pump.virtual.VirtualPumpFragment">
|
tools:context=".VirtualPumpFragment">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
35
pump/virtual/src/main/res/values/arrays.xml
Normal file
35
pump/virtual/src/main/res/values/arrays.xml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string-array name="virtualPumpTypes">
|
||||||
|
<item>Generic AAPS</item>
|
||||||
|
<item>MDI</item>
|
||||||
|
<item>Accu-Chek Combo</item>
|
||||||
|
<item>Accu-Chek Spirit</item>
|
||||||
|
<item>Accu-Chek Insight</item>
|
||||||
|
<item>Accu-Chek Solo</item>
|
||||||
|
<item>Animas Ping</item>
|
||||||
|
<item>Animas Vibe</item>
|
||||||
|
<item>Cellnovo</item>
|
||||||
|
<item>DanaR</item>
|
||||||
|
<item>DanaR Korean</item>
|
||||||
|
<item>DanaRS</item>
|
||||||
|
<item>DanaRv2</item>
|
||||||
|
<item>DanaI</item>
|
||||||
|
<item>Diaconn G8</item>
|
||||||
|
<item>Eoflow Eopatch2</item>
|
||||||
|
<item>Medtronic 512/712</item>
|
||||||
|
<item>Medtronic 515/715</item>
|
||||||
|
<item>Medtronic 522/722</item>
|
||||||
|
<item>Medtronic 523/723 (Revel)</item>
|
||||||
|
<item>Medtronic 554/754 (Veo)</item>
|
||||||
|
<item>Medtronic 640G</item>
|
||||||
|
<item>Omnipod Dash</item>
|
||||||
|
<item>Omnipod Eros</item>
|
||||||
|
<item>Tandem t:slim</item>
|
||||||
|
<item>Tandem t:flex</item>
|
||||||
|
<item>Tandem t:slim G4</item>
|
||||||
|
<item>Tandem t:slim X2</item>
|
||||||
|
<item>YpsoPump</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
</resources>
|
13
pump/virtual/src/main/res/values/strings.xml
Normal file
13
pump/virtual/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- VirtualPump -->
|
||||||
|
<string name="virtual_pump_type">Virtual Pump Type</string>
|
||||||
|
<string name="virtual_pump_definition">Pump Definition</string>
|
||||||
|
<string name="virtual_pump_pump_def">Bolus: Step=%1$s\nExtended Bolus: [Step=%2$s, Duration=%3$smin-%4$sh]\nBasal: Step=%5$s\nTBR: %6$s (by %7$s), Duration=%8$smin-%9$sh\n%10$s</string>
|
||||||
|
|
||||||
|
<string name="virtual_pump_shortname">VPUMP</string>
|
||||||
|
<string name="description_pump_virtual">Pump integration for pumps which don\'t have any driver yet (Open Loop)</string>
|
||||||
|
<string name="virtual_pump_label">VIRTUAL PUMP</string>
|
||||||
|
<string name="virtualpump_settings">Virtual pump settings</string>
|
||||||
|
|
||||||
|
</resources>
|
|
@ -0,0 +1,37 @@
|
||||||
|
package info.nightscout.androidaps
|
||||||
|
|
||||||
|
import info.nightscout.rx.AapsSchedulers
|
||||||
|
import info.nightscout.rx.TestAapsSchedulers
|
||||||
|
import info.nightscout.rx.logging.AAPSLoggerTest
|
||||||
|
import org.junit.jupiter.api.BeforeEach
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
|
import org.mockito.Mockito
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension
|
||||||
|
import org.mockito.junit.jupiter.MockitoSettings
|
||||||
|
import org.mockito.quality.Strictness
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension::class)
|
||||||
|
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||||
|
open class TestBase {
|
||||||
|
|
||||||
|
val aapsLogger = AAPSLoggerTest()
|
||||||
|
val aapsSchedulers: AapsSchedulers = TestAapsSchedulers()
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
fun setupLocale() {
|
||||||
|
Locale.setDefault(Locale.ENGLISH)
|
||||||
|
System.setProperty("disableFirebase", "true")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workaround for Kotlin nullability.
|
||||||
|
// https://medium.com/@elye.project/befriending-kotlin-and-mockito-1c2e7b0ef791
|
||||||
|
// https://stackoverflow.com/questions/30305217/is-it-possible-to-use-mockito-in-kotlin
|
||||||
|
fun <T> anyObject(): T {
|
||||||
|
Mockito.any<T>()
|
||||||
|
return uninitialized()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("Unchecked_Cast")
|
||||||
|
fun <T> uninitialized(): T = null as T
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.pump.virtual
|
package info.nightscout.pump.virtual
|
||||||
|
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import info.nightscout.androidaps.TestBase
|
import info.nightscout.androidaps.TestBase
|
||||||
|
@ -13,7 +13,7 @@ import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import info.nightscout.shared.utils.DateUtil
|
import info.nightscout.shared.utils.DateUtil
|
||||||
import org.junit.Assert
|
import org.junit.jupiter.api.Assertions
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
@ -32,7 +32,7 @@ class VirtualPumpPluginUTest : TestBase() {
|
||||||
@Mock lateinit var pumpSync: PumpSync
|
@Mock lateinit var pumpSync: PumpSync
|
||||||
@Mock lateinit var config: Config
|
@Mock lateinit var config: Config
|
||||||
|
|
||||||
lateinit var virtualPumpPlugin: VirtualPumpPlugin
|
private lateinit var virtualPumpPlugin: VirtualPumpPlugin
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
fun prepareMocks() {
|
fun prepareMocks() {
|
||||||
|
@ -43,7 +43,7 @@ class VirtualPumpPluginUTest : TestBase() {
|
||||||
fun refreshConfiguration() {
|
fun refreshConfiguration() {
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
||||||
virtualPumpPlugin.refreshConfiguration()
|
virtualPumpPlugin.refreshConfiguration()
|
||||||
Assert.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType)
|
Assertions.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -52,6 +52,6 @@ class VirtualPumpPluginUTest : TestBase() {
|
||||||
virtualPumpPlugin.refreshConfiguration()
|
virtualPumpPlugin.refreshConfiguration()
|
||||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
`when`(sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
||||||
virtualPumpPlugin.refreshConfiguration()
|
virtualPumpPlugin.refreshConfiguration()
|
||||||
Assert.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType)
|
Assertions.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -40,5 +40,6 @@ include ':pump:omnipod-dash'
|
||||||
include ':pump:pump-common'
|
include ':pump:pump-common'
|
||||||
include ':pump:pump-core'
|
include ':pump:pump-core'
|
||||||
include ':pump:rileylink'
|
include ':pump:rileylink'
|
||||||
|
include ':pump:virtual'
|
||||||
include ':plugins:sync'
|
include ':plugins:sync'
|
||||||
include ':workflow'
|
include ':workflow'
|
||||||
|
|
Loading…
Reference in a new issue