danar module

This commit is contained in:
Milos Kozak 2020-05-10 11:03:19 +02:00
parent a99be409eb
commit 311f9dd119
210 changed files with 893 additions and 692 deletions

View file

@ -244,6 +244,7 @@ dependencies {
implementation project(':core') implementation project(':core')
implementation project(':dana') implementation project(':dana')
implementation project(':danars') implementation project(':danars')
implementation project(':danar')
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-wearable:17.0.0' implementation 'com.google.android.gms:play-services-wearable:17.0.0'

View file

@ -16,7 +16,7 @@ import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugi
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin
import info.nightscout.androidaps.plugins.insulin.InsulinOrefUltraRapidActingPlugin import info.nightscout.androidaps.plugins.insulin.InsulinOrefUltraRapidActingPlugin
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
import info.nightscout.androidaps.plugins.source.RandomBgPlugin import info.nightscout.androidaps.plugins.source.RandomBgPlugin
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
@ -42,7 +42,7 @@ class RealPumpTest {
private val validProfile = "{\"dia\":\"6\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"10\"},{\"time\":\"2:00\",\"value\":\"11\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"0.1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4\"}],\"target_high\":[{\"time\":\"00:00\",\"value\":\"5\"}],\"startDate\":\"1970-01-01T00:00:00.000Z\",\"units\":\"mmol\"}" private val validProfile = "{\"dia\":\"6\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"10\"},{\"time\":\"2:00\",\"value\":\"11\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"0.1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4\"}],\"target_high\":[{\"time\":\"00:00\",\"value\":\"5\"}],\"startDate\":\"1970-01-01T00:00:00.000Z\",\"units\":\"mmol\"}"
@Inject lateinit var pump : DanaRv2Plugin @Inject lateinit var pump : info.nightscout.androidaps.danaRv2.DanaRv2Plugin
@Inject lateinit var randomBgPlugin :RandomBgPlugin @Inject lateinit var randomBgPlugin :RandomBgPlugin
@Inject lateinit var localProfilePlugin: LocalProfilePlugin @Inject lateinit var localProfilePlugin: LocalProfilePlugin
@Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var profileFunction: ProfileFunction

View file

@ -154,15 +154,15 @@
android:name=".services.LocationService" android:name=".services.LocationService"
android:exported="false" /> android:exported="false" />
<service <service
android:name=".plugins.pump.danaR.services.DanaRExecutionService" android:name=".danar.services.DanaRExecutionService"
android:enabled="true" android:enabled="true"
android:exported="false" /> android:exported="false" />
<service <service
android:name=".plugins.pump.danaRKorean.services.DanaRKoreanExecutionService" android:name=".danaRKorean.services.DanaRKoreanExecutionService"
android:enabled="true" android:enabled="true"
android:exported="false" /> android:exported="false" />
<service <service
android:name=".plugins.pump.danaRv2.services.DanaRv2ExecutionService" android:name=".danaRv2.services.DanaRv2ExecutionService"
android:enabled="true" android:enabled="true"
android:exported="false" /> android:exported="false" />
<service <service

View file

@ -35,10 +35,10 @@ import info.nightscout.androidaps.plugins.general.wear.WearPlugin
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin
import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSPlugin
import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin

View file

@ -11,6 +11,7 @@ import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.db.DatabaseHelperProvider import info.nightscout.androidaps.db.DatabaseHelperProvider
import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.configBuilder.PluginStore import info.nightscout.androidaps.plugins.configBuilder.PluginStore
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImplementation import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImplementation
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
@ -67,6 +68,7 @@ open class AppModule {
@Binds fun bindActivePluginProvider(pluginStore: PluginStore): ActivePluginProvider @Binds fun bindActivePluginProvider(pluginStore: PluginStore): ActivePluginProvider
@Binds fun commandQueueProvider(commandQueue: CommandQueue): CommandQueueProvider @Binds fun commandQueueProvider(commandQueue: CommandQueue): CommandQueueProvider
@Binds fun configInterfaceProvider(config: Config): ConfigInterface @Binds fun configInterfaceProvider(config: Config): ConfigInterface
@Binds fun configBuilderInterfaceProvider(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilderInterface
@Binds fun treatmentInterfaceProvider(treatmentsPlugin: TreatmentsPlugin): TreatmentsInterface @Binds fun treatmentInterfaceProvider(treatmentsPlugin: TreatmentsPlugin): TreatmentsInterface
@Binds fun provideDatabaseHelperInterface(databaseHelperProvider: DatabaseHelperProvider): DatabaseHelperInterface @Binds fun provideDatabaseHelperInterface(databaseHelperProvider: DatabaseHelperProvider): DatabaseHelperInterface
@Binds fun provideUploadQueueInterface(uploadQueue: UploadQueue): UploadQueueInterface @Binds fun provideUploadQueueInterface(uploadQueue: UploadQueue): UploadQueueInterface

View file

@ -34,10 +34,10 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorP
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSPlugin
import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.mdi.MDIPlugin import info.nightscout.androidaps.plugins.pump.mdi.MDIPlugin
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
@ -110,19 +110,19 @@ abstract class PluginsModule {
@PumpDriver @PumpDriver
@IntoMap @IntoMap
@IntKey(90) @IntKey(90)
abstract fun bindDanaRPlugin(plugin: DanaRPlugin): PluginBase abstract fun bindDanaRPlugin(plugin: info.nightscout.androidaps.danar.DanaRPlugin): PluginBase
@Binds @Binds
@PumpDriver @PumpDriver
@IntoMap @IntoMap
@IntKey(100) @IntKey(100)
abstract fun bindDanaRKoreanPlugin(plugin: DanaRKoreanPlugin): PluginBase abstract fun bindDanaRKoreanPlugin(plugin: info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin): PluginBase
@Binds @Binds
@PumpDriver @PumpDriver
@IntoMap @IntoMap
@IntKey(110) @IntKey(110)
abstract fun bindDanaRv2Plugin(plugin: DanaRv2Plugin): PluginBase abstract fun bindDanaRv2Plugin(plugin: info.nightscout.androidaps.danaRv2.DanaRv2Plugin): PluginBase
@Binds @Binds
@PumpDriver @PumpDriver

View file

@ -7,11 +7,11 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Dismiss
import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService
import info.nightscout.androidaps.plugins.general.wear.wearintegration.WatchUpdaterService import info.nightscout.androidaps.plugins.general.wear.wearintegration.WatchUpdaterService
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService
import info.nightscout.androidaps.plugins.pump.danaR.services.AbstractDanaRExecutionService import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService
import info.nightscout.androidaps.plugins.pump.danaR.services.DanaRExecutionService import info.nightscout.androidaps.danar.services.DanaRExecutionService
import info.nightscout.androidaps.plugins.pump.danaRKorean.services.DanaRKoreanExecutionService import info.nightscout.androidaps.danaRKorean.services.DanaRKoreanExecutionService
import info.nightscout.androidaps.danars.services.DanaRSService import info.nightscout.androidaps.danars.services.DanaRSService
import info.nightscout.androidaps.plugins.pump.danaRv2.services.DanaRv2ExecutionService import info.nightscout.androidaps.danaRv2.services.DanaRv2ExecutionService
import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService
import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService
@ -24,7 +24,7 @@ import info.nightscout.androidaps.services.LocationService
@Suppress("unused") @Suppress("unused")
abstract class ServicesModule { abstract class ServicesModule {
@ContributesAndroidInjector abstract fun contributesAbstractDanaRExecutionService(): AbstractDanaRExecutionService @ContributesAndroidInjector abstract fun contributesAbstractDanaRExecutionService(): info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService
@ContributesAndroidInjector abstract fun contributesAlarmSoundService(): AlarmSoundService @ContributesAndroidInjector abstract fun contributesAlarmSoundService(): AlarmSoundService
@ContributesAndroidInjector abstract fun contributesDataService(): DataService @ContributesAndroidInjector abstract fun contributesDataService(): DataService
@ContributesAndroidInjector abstract fun contributesDismissNotificationService(): DismissNotificationService @ContributesAndroidInjector abstract fun contributesDismissNotificationService(): DismissNotificationService

View file

@ -36,7 +36,7 @@ class ConfigBuilderPlugin @Inject constructor(
.shortName(R.string.configbuilder_shortname) .shortName(R.string.configbuilder_shortname)
.description(R.string.description_config_builder), .description(R.string.description_config_builder),
aapsLogger, resourceHelper, injector aapsLogger, resourceHelper, injector
) { ), ConfigBuilderInterface {
fun initialize() { fun initialize() {
(activePlugin as PluginStore).loadDefaults() (activePlugin as PluginStore).loadDefaults()
@ -52,7 +52,7 @@ class ConfigBuilderPlugin @Inject constructor(
storeSettings("setAlwaysEnabledPluginsEnabled") storeSettings("setAlwaysEnabledPluginsEnabled")
} }
fun storeSettings(from: String) { override fun storeSettings(from: String) {
activePlugin.pluginsList activePlugin.pluginsList
aapsLogger.debug(LTag.CONFIGBUILDER, "Storing settings from: $from") aapsLogger.debug(LTag.CONFIGBUILDER, "Storing settings from: $from")
activePlugin.verifySelectionInCategories() activePlugin.verifySelectionInCategories()

View file

@ -7,6 +7,7 @@ import info.nightscout.androidaps.Config
import info.nightscout.androidaps.Constants import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.data.DetailedBolusInfo import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.db.CareportalEvent import info.nightscout.androidaps.db.CareportalEvent
@ -23,11 +24,10 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSPlugin
import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.treatments.CarbsGenerator import info.nightscout.androidaps.plugins.treatments.CarbsGenerator
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
@ -65,7 +65,7 @@ class ActionStringHandler @Inject constructor(
private val danaRKoreanPlugin: DanaRKoreanPlugin, private val danaRKoreanPlugin: DanaRKoreanPlugin,
private val danaRv2Plugin: DanaRv2Plugin, private val danaRv2Plugin: DanaRv2Plugin,
private val danaRSPlugin: DanaRSPlugin, private val danaRSPlugin: DanaRSPlugin,
private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, private val danaRPump: DanaRPump,
private val hardLimits: HardLimits, private val hardLimits: HardLimits,
private val carbsGenerator: CarbsGenerator, private val carbsGenerator: CarbsGenerator,
private val dateUtil: DateUtil, private val dateUtil: DateUtil,

View file

@ -1,13 +0,0 @@
package info.nightscout.androidaps.plugins.pump.danaR.services;
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase;
/**
* Created by mike on 28.01.2018.
*/
public abstract class AbstractSerialIOThread extends Thread {
public abstract void sendMessage(MessageBase message);
public abstract void disconnect(String reason);
}

View file

@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.virtual
import android.os.SystemClock import android.os.SystemClock
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.Config import info.nightscout.androidaps.Config
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.DetailedBolusInfo import info.nightscout.androidaps.data.DetailedBolusInfo

View file

@ -59,9 +59,6 @@
<string name="description_profile_nightscout">Provides the profile you have defined in Nightscout</string> <string name="description_profile_nightscout">Provides the profile you have defined in Nightscout</string>
<string name="description_profile_simple">Define a profile with only one time block.</string> <string name="description_profile_simple">Define a profile with only one time block.</string>
<string name="description_pump_combo">Pump integration for Accu-Chek Combo pumps, requires having ruffy installed</string> <string name="description_pump_combo">Pump integration for Accu-Chek Combo pumps, requires having ruffy installed</string>
<string name="description_pump_dana_r">Pump integration for DANA Diabecare R pumps</string>
<string name="description_pump_dana_r_korean">Pump integration for domestic DANA Diabecare R pumps</string>
<string name="description_pump_dana_r_v2">Pump integration for DANA Diabecare R pumps with upgraded firmware</string>
<string name="description_pump_mdi">Pump integration for people who do multiple daily injections for their diabetes therapy</string> <string name="description_pump_mdi">Pump integration for people who do multiple daily injections for their diabetes therapy</string>
<string name="description_pump_virtual">Pump integration for pumps which don\'t have any driver yet (Open Loop)</string> <string name="description_pump_virtual">Pump integration for pumps which don\'t have any driver yet (Open Loop)</string>
<string name="description_sensitivity_aaps">Sensitivity is calculated the same way like Oref0, but you can specify timeframe to the past. Minimal carb absorption is calculated from max carb absorption time from preferences.</string> <string name="description_sensitivity_aaps">Sensitivity is calculated the same way like Oref0, but you can specify timeframe to the past. Minimal carb absorption is calculated from max carb absorption time from preferences.</string>
@ -279,14 +276,11 @@
<string name="exported_less_than_hour_ago">exported less than hour ago</string> <string name="exported_less_than_hour_ago">exported less than hour ago</string>
<string name="in_directory" comment="placeholder is for exported file path">in directory: %1$s</string> <string name="in_directory" comment="placeholder is for exported file path">in directory: %1$s</string>
<string name="danarpump">DanaR</string>
<string name="danar_pump_settings">Dana pump settings</string> <string name="danar_pump_settings">Dana pump settings</string>
<string name="end_user_license_agreement">End User License Agreement</string> <string name="end_user_license_agreement">End User License Agreement</string>
<string name="end_user_license_agreement_text">MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</string> <string name="end_user_license_agreement_text">MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</string>
<string name="end_user_license_agreement_i_understand">I UNDERSTAND AND AGREE</string> <string name="end_user_license_agreement_i_understand">I UNDERSTAND AND AGREE</string>
<string name="save">Save</string> <string name="save">Save</string>
<string name="nobtadapter">No bluetooth adapter found</string>
<string name="devicenotfound">Selected device not found</string>
<string name="danar_iob_label">Pump IOB</string> <string name="danar_iob_label">Pump IOB</string>
<string name="danar_dailyunits">Daily units</string> <string name="danar_dailyunits">Daily units</string>
<string name="pump_lastbolus_label">Last bolus</string> <string name="pump_lastbolus_label">Last bolus</string>
@ -400,11 +394,7 @@
<string name="wear">Wear</string> <string name="wear">Wear</string>
<string name="resend_all_data">Resend All Data</string> <string name="resend_all_data">Resend All Data</string>
<string name="open_settings_on_wear">Open Settings on Wear</string> <string name="open_settings_on_wear">Open Settings on Wear</string>
<string name="danarkoreanpump">DanaR Korean</string>
<string name="basal_rate">Basal rate:</string> <string name="basal_rate">Basal rate:</string>
<string name="profile_set_failed">Setting of basal profile failed</string>
<string name="danar_disableeasymode">Disable EasyUI mode in pump</string>
<string name="danar_switchtouhmode">Change mode from U/d to U/h on pump</string>
<string name="basalvaluebelowminimum">Basal value below minimum. Profile not set!</string> <string name="basalvaluebelowminimum">Basal value below minimum. Profile not set!</string>
<string name="sms_actualbg">BG:</string> <string name="sms_actualbg">BG:</string>
<string name="sms_lastbg">Last BG:</string> <string name="sms_lastbg">Last BG:</string>
@ -434,7 +424,6 @@
<string name="simpleprofile_shortname">SP</string> <string name="simpleprofile_shortname">SP</string>
<string name="oaps_shortname">OAPS</string> <string name="oaps_shortname">OAPS</string>
<string name="localprofile_shortname">LP</string> <string name="localprofile_shortname">LP</string>
<string name="danarpump_shortname">DANA</string>
<string name="overview_shortname">HOME</string> <string name="overview_shortname">HOME</string>
<string name="virtualpump_shortname">VPUMP</string> <string name="virtualpump_shortname">VPUMP</string>
<string name="profileviewer_shortname">NSPROFILE</string> <string name="profileviewer_shortname">NSPROFILE</string>
@ -494,7 +483,6 @@
<string name="paused">Paused</string> <string name="paused">Paused</string>
<string name="key_nsclientinternal_url" translatable="false">nsclientinternal_url</string> <string name="key_nsclientinternal_url" translatable="false">nsclientinternal_url</string>
<string name="key_nsclientinternal_api_secret" translatable="false">nsclientinternal_api_secret</string> <string name="key_nsclientinternal_api_secret" translatable="false">nsclientinternal_api_secret</string>
<string name="key_danar_bt_name" translatable="false">danar_bt_name</string>
<string name="clearlog">Clear log</string> <string name="clearlog">Clear log</string>
<string name="key_nsclientinternal_autoscroll" translatable="false">nsclientinternal_autoscroll</string> <string name="key_nsclientinternal_autoscroll" translatable="false">nsclientinternal_autoscroll</string>
<string name="key_nsclientinternal_paused" translatable="false">nsclientinternal_paused</string> <string name="key_nsclientinternal_paused" translatable="false">nsclientinternal_paused</string>
@ -548,7 +536,6 @@
<string name="superbolus">Superbolus</string> <string name="superbolus">Superbolus</string>
<string name="ns_logappstartedevent">Log app start to NS</string> <string name="ns_logappstartedevent">Log app start to NS</string>
<string name="restartingapp">Exiting application to apply settings.</string> <string name="restartingapp">Exiting application to apply settings.</string>
<string name="danarv2pump">DanaRv2</string>
<string name="configbuilder_insulin_description">Which type of insulin are you using?</string> <string name="configbuilder_insulin_description">Which type of insulin are you using?</string>
<string name="fastactinginsulin">Fast Acting Insulin</string> <string name="fastactinginsulin">Fast Acting Insulin</string>
<string name="fastactinginsulincomment">Novorapid, Novolog, Humalog</string> <string name="fastactinginsulincomment">Novorapid, Novolog, Humalog</string>
@ -714,7 +701,6 @@
<string name="shortfat">Fat</string> <string name="shortfat">Fat</string>
<string name="active"><![CDATA[<Active>]]></string> <string name="active"><![CDATA[<Active>]]></string>
<string name="executingrightnow">Command is executed right now</string> <string name="executingrightnow">Command is executed right now</string>
<string name="pumpdrivercorrected">Pump driver corrected</string>
<string name="pump_unreachable">Pump unreachable</string> <string name="pump_unreachable">Pump unreachable</string>
<string name="missed_bg_readings">Missed BG readings</string> <string name="missed_bg_readings">Missed BG readings</string>
<string name="key_raise_notifications_as_android_notifications" translatable="false">raise_urgent_alarms_as_android_notification</string> <string name="key_raise_notifications_as_android_notifications" translatable="false">raise_urgent_alarms_as_android_notification</string>

View file

@ -24,7 +24,7 @@ open class DanaRSTestBase : TestBaseWithProfile() {
} }
} }
lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump lateinit var danaRPump: DanaRPump
fun createArray(length: Int, fillWith: Byte): ByteArray { fun createArray(length: Int, fillWith: Byte): ByteArray {
val ret = ByteArray(length) val ret = ByteArray(length)

View file

@ -7,6 +7,7 @@ import info.nightscout.androidaps.Config
import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
@ -19,8 +20,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSPlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
@ -63,7 +63,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
@Mock lateinit var uploadQueue: UploadQueue @Mock lateinit var uploadQueue: UploadQueue
private var buildHelper = BuildHelper(Config()) private var buildHelper = BuildHelper(Config())
lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump lateinit var danaRPump: DanaRPump
lateinit var constraintChecker: ConstraintChecker lateinit var constraintChecker: ConstraintChecker
private lateinit var safetyPlugin: SafetyPlugin private lateinit var safetyPlugin: SafetyPlugin
@ -113,11 +113,11 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
`when`(activePlugin.activePump).thenReturn(virtualPumpPlugin) `when`(activePlugin.activePump).thenReturn(virtualPumpPlugin)
constraintChecker = ConstraintChecker(activePlugin) constraintChecker = ConstraintChecker(activePlugin)
danaRPump = info.nightscout.androidaps.dana.DanaRPump(aapsLogger, sp, injector) danaRPump = DanaRPump(aapsLogger, sp, injector)
hardLimits = HardLimits(aapsLogger, rxBus, sp, resourceHelper, context, nsUpload) hardLimits = HardLimits(aapsLogger, rxBus, sp, resourceHelper, context, nsUpload)
objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, resourceHelper, activePlugin, sp, Config()) objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, resourceHelper, activePlugin, sp, Config())
comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, resourceHelper, profileFunction, treatmentsPlugin, sp, commandQueue, context) comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, resourceHelper, profileFunction, treatmentsPlugin, sp, commandQueue, context)
danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, danaRPump, dateUtil) danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, activePlugin, sp, commandQueue, danaRPump, dateUtil, fabricPrivacy)
danaRSPlugin = DanaRSPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil, Config()) danaRSPlugin = DanaRSPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil, Config())
insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, treatmentsPlugin, sp, commandQueue, profileFunction, nsUpload, context, uploadQueue, Config(), dateUtil) insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, treatmentsPlugin, sp, commandQueue, profileFunction, nsUpload, context, uploadQueue, Config(), dateUtil)
openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsPlugin, iobCobCalculatorPlugin, hardLimits, profiler, fabricPrivacy) openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsPlugin, iobCobCalculatorPlugin, hardLimits, profiler, fabricPrivacy)

View file

@ -6,6 +6,8 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Constants import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PluginType
@ -29,7 +31,7 @@ class DanaRPluginTest : TestBaseWithProfile() {
@Mock lateinit var sp: SP @Mock lateinit var sp: SP
@Mock lateinit var commandQueue: CommandQueueProvider @Mock lateinit var commandQueue: CommandQueueProvider
lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump lateinit var danaRPump: DanaRPump
private lateinit var danaRPlugin: DanaRPlugin private lateinit var danaRPlugin: DanaRPlugin
@ -44,7 +46,7 @@ class DanaRPluginTest : TestBaseWithProfile() {
`when`(resourceHelper.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(resourceHelper.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(resourceHelper.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") `when`(resourceHelper.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
danaRPump = info.nightscout.androidaps.dana.DanaRPump(aapsLogger, sp, injector) danaRPump = info.nightscout.androidaps.dana.DanaRPump(aapsLogger, sp, injector)
danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, danaRPump, dateUtil) danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, danaRPump, dateUtil, fabricPrivacy)
} }
@Test @Throws(Exception::class) @Test @Throws(Exception::class)

View file

@ -7,10 +7,13 @@ import info.nightscout.androidaps.db.TemporaryBasal
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
import info.nightscout.androidaps.interfaces.TreatmentsInterface
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Before import org.junit.Before
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.`when`
open class DanaRTestBase : TestBase() { open class DanaRTestBase : TestBase() {
@ -18,6 +21,13 @@ open class DanaRTestBase : TestBase() {
@Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var profileFunction: ProfileFunction
@Mock lateinit var activePluginProvider: ActivePluginProvider @Mock lateinit var activePluginProvider: ActivePluginProvider
@Mock lateinit var dateUtil: DateUtil @Mock lateinit var dateUtil: DateUtil
@Mock lateinit var databaseHelper: DatabaseHelperInterface
@Mock lateinit var treatmentsInterface: TreatmentsInterface
@Before
fun prepareMock() {
`when`(activePluginProvider.activeTreatments).thenReturn(treatmentsInterface)
}
val injector = HasAndroidInjector { val injector = HasAndroidInjector {
AndroidInjector { AndroidInjector {
@ -30,7 +40,7 @@ open class DanaRTestBase : TestBase() {
} }
} }
lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump lateinit var danaRPump: DanaRPump
fun createArray(length: Int, fillWith: Byte): ByteArray { fun createArray(length: Int, fillWith: Byte): ByteArray {
val ret = ByteArray(length) val ret = ByteArray(length)

View file

@ -1,5 +1,8 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.danar.comm.MessageHashTableR
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
@ -8,8 +11,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert
@ -38,7 +39,7 @@ class MessageHashTableRTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
val messageHashTable = MessageHashTableR(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, activePlugin, nsUpload, injector, dateUtil) val messageHashTable = MessageHashTableR(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, activePlugin, nsUpload, injector, databaseHelper, dateUtil)
val testMessage = messageHashTable.findMessage(0x41f2) val testMessage = messageHashTable.findMessage(0x41f2)
Assert.assertEquals("CMD_HISTORY_ALL", testMessage.messageName) Assert.assertEquals("CMD_HISTORY_ALL", testMessage.messageName)
} }

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.danar.comm.MessageOriginalNames
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test

View file

@ -3,8 +3,9 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.danar.comm.MsgBolusProgress
import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.db.Treatment
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgBolusStart
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import org.junit.Assert import org.junit.Assert

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgBolusStartWithSpeed
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import org.junit.Assert import org.junit.Assert

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.danar.comm.MsgBolusStop
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.db.Treatment
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.danar.comm.MsgCheckValue
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgError
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryAlarm
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -11,7 +12,7 @@ class MsgHistoryAlarmTest : DanaRTestBase() {
val rxBus = RxBusWrapper() val rxBus = RxBusWrapper()
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryAlarm(aapsLogger, rxBus, dateUtil) val packet = MsgHistoryAlarm(aapsLogger, rxBus, dateUtil, databaseHelper)
// nothing left to test // nothing left to test
} }
} }

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryAllDone
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.danar.comm.MsgHistoryAll
import info.nightscout.androidaps.db.DatabaseHelper import info.nightscout.androidaps.db.DatabaseHelper
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Assert import org.junit.Assert
@ -18,7 +19,7 @@ class MsgHistoryAllTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
PowerMockito.mockStatic(MainApp::class.java) PowerMockito.mockStatic(MainApp::class.java)
`when`(MainApp.getDbHelper()).thenReturn(PowerMockito.mock(DatabaseHelper::class.java)) `when`(MainApp.getDbHelper()).thenReturn(PowerMockito.mock(DatabaseHelper::class.java))
val packet = MsgHistoryAll(aapsLogger, RxBusWrapper(), dateUtil) val packet = MsgHistoryAll(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
// test message decoding // test message decoding
val array = ByteArray(100) val array = ByteArray(100)

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryBasalHour
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistoryBasalHourTest : DanaRTestBase() { class MsgHistoryBasalHourTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryBasalHour(aapsLogger, RxBusWrapper(), dateUtil) val packet = MsgHistoryBasalHour(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
// nothing left to test // nothing left to test
} }
} }

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryBolus
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistoryBolusTest : DanaRTestBase() { class MsgHistoryBolusTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryBolus(aapsLogger, RxBusWrapper(), dateUtil) val packet = MsgHistoryBolus(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
// nothing left to test // nothing left to test
} }
} }

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryCarbo
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistoryCarboTest : DanaRTestBase() { class MsgHistoryCarboTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryCarbo(aapsLogger, RxBusWrapper(), dateUtil) val packet = MsgHistoryCarbo(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
// nothing left to test // nothing left to test
} }
} }

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryDailyInsulin
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistoryDailyInsulinTest : DanaRTestBase() { class MsgHistoryDailyInsulinTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryDailyInsulin(aapsLogger, RxBusWrapper(), dateUtil) val packet = MsgHistoryDailyInsulin(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
// nothing left to test // nothing left to test
} }
} }

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryDone
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryError
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistoryErrorTest : DanaRTestBase() { class MsgHistoryErrorTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryError(aapsLogger, RxBusWrapper(), dateUtil) val packet = MsgHistoryError(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
// nothing left to test // nothing left to test
} }
} }

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryGlucose
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistoryGlucoseTest : DanaRTestBase() { class MsgHistoryGlucoseTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryGlucose(aapsLogger, RxBusWrapper(), dateUtil) val packet = MsgHistoryGlucose(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
// nothing left to test // nothing left to test
} }
} }

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryNewDone
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryNew
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistoryNewTest : DanaRTestBase() { class MsgHistoryNewTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryNew(aapsLogger, RxBusWrapper(), dateUtil) val packet = MsgHistoryNew(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
// nothing left to test // nothing left to test
} }
} }

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistoryRefill
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistoryRefillTest : DanaRTestBase() { class MsgHistoryRefillTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryRefill(aapsLogger, RxBusWrapper(), dateUtil) val packet = MsgHistoryRefill(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
// nothing left to test // nothing left to test
} }
} }

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgHistorySuspend
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistorySuspendTest : DanaRTestBase() { class MsgHistorySuspendTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistorySuspend(aapsLogger, RxBusWrapper(), dateUtil) val packet = MsgHistorySuspend(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper)
// nothing left to test // nothing left to test
} }
} }

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgInitConnStatusBasic
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgInitConnStatusBolus
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgInitConnStatusOption
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin

View file

@ -3,8 +3,9 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danar.comm.MsgInitConnStatusTime
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
@ -14,7 +15,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest(DanaRKoreanPlugin::class, DanaRPlugin::class, ConfigBuilderPlugin::class) @PrepareForTest(info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin::class, info.nightscout.androidaps.danar.DanaRPlugin::class, ConfigBuilderPlugin::class)
class MsgInitConnStatusTimeTest : DanaRTestBase() { class MsgInitConnStatusTimeTest : DanaRTestBase() {
@Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var resourceHelper: ResourceHelper

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgPCCommStart
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgPCCommStop
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetActivateBasalProfile
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetBasalProfile
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetCarbsEntry
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStart
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import org.junit.Assert import org.junit.Assert

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStop
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetSingleBasalProfile
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetTempBasalStart
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetTime
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSetUserOptions
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingActiveProfile
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSettingBasalProfileAll
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner

View file

@ -1,7 +1,9 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.interfaces.PumpDescription import info.nightscout.androidaps.interfaces.PumpDescription
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingBasal
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -11,7 +13,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest(DanaRPlugin::class) @PrepareForTest(info.nightscout.androidaps.danar.DanaRPlugin::class)
class MsgSettingBasalTest : DanaRTestBase() { class MsgSettingBasalTest : DanaRTestBase() {
@Mock lateinit var danaRPlugin: DanaRPlugin @Mock lateinit var danaRPlugin: DanaRPlugin

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgSettingGlucose
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingMaxValues
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,8 +1,10 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingMeal
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
@ -12,7 +14,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest(DanaRPlugin::class, DanaRKoreanPlugin::class) @PrepareForTest(info.nightscout.androidaps.danar.DanaRPlugin::class, info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin::class)
class MsgSettingMealTest : DanaRTestBase() { class MsgSettingMealTest : DanaRTestBase() {
@Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var resourceHelper: ResourceHelper

View file

@ -1,6 +1,8 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatiosAll
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,6 +1,8 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatios
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,6 +1,8 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingPumpTime
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,6 +1,8 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danar.comm.MsgSettingUserOptions
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -11,7 +12,7 @@ class MsgSettingUserOptionsTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSettingUserOptions(aapsLogger, danaRPump) val packet = MsgSettingUserOptions(aapsLogger, danaRPump)
danaRPump.units = info.nightscout.androidaps.dana.DanaRPump.UNITS_MGDL danaRPump.units = DanaRPump.UNITS_MGDL
// test message decoding // test message decoding
packet.handleMessage(createArray(48, 7.toByte())) packet.handleMessage(createArray(48, 7.toByte()))
Assert.assertEquals(7, danaRPump.lcdOnTimeSec) Assert.assertEquals(7, danaRPump.lcdOnTimeSec)

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgStatusBasic
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import org.junit.Assert import org.junit.Assert

View file

@ -1,6 +1,8 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgStatusProfile
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaR.comm package info.nightscout.androidaps.plugins.pump.danaR.comm
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgStatus
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -6,11 +6,12 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Constants import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PluginType
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
@ -30,7 +31,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() {
@Mock lateinit var sp: SP @Mock lateinit var sp: SP
@Mock lateinit var commandQueue: CommandQueueProvider @Mock lateinit var commandQueue: CommandQueueProvider
lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump lateinit var danaRPump: DanaRPump
private lateinit var danaRPlugin: DanaRKoreanPlugin private lateinit var danaRPlugin: DanaRKoreanPlugin
@ -44,8 +45,8 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() {
`when`(resourceHelper.gs(R.string.pumplimit)).thenReturn("pump limit") `when`(resourceHelper.gs(R.string.pumplimit)).thenReturn("pump limit")
`when`(resourceHelper.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(resourceHelper.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(resourceHelper.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") `when`(resourceHelper.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
danaRPump = info.nightscout.androidaps.dana.DanaRPump(aapsLogger, sp, injector) danaRPump = DanaRPump(aapsLogger, sp, injector)
danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, rxBus, danaRPump, context, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, dateUtil) danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, rxBus, danaRPump, context, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, dateUtil, fabricPrivacy)
} }
@Test @Throws(Exception::class) @Test @Throws(Exception::class)

View file

@ -8,8 +8,10 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danaRKorean.comm.MessageHashTableRKorean
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -30,10 +32,11 @@ class MessageHashTableRKoreanTest : DanaRSTestBase() {
@Mock lateinit var activePlugin: ActivePluginProvider @Mock lateinit var activePlugin: ActivePluginProvider
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
@Mock lateinit var nsUpload: NSUpload @Mock lateinit var nsUpload: NSUpload
@Mock lateinit var databaseHelper: DatabaseHelperInterface
@Test fun runTest() { @Test fun runTest() {
Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
val messageHashTable = MessageHashTableRKorean(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, activePlugin, dateUtil, nsUpload, injector) val messageHashTable = MessageHashTableRKorean(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, activePlugin, dateUtil, nsUpload, databaseHelper, injector)
val testMessage = messageHashTable.findMessage(0x41f2) val testMessage = messageHashTable.findMessage(0x41f2)
Assert.assertEquals("CMD_HISTORY_ALL", testMessage.messageName) Assert.assertEquals("CMD_HISTORY_ALL", testMessage.messageName)
} }

View file

@ -6,12 +6,13 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Constants import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PluginType
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.androidaps.dana.DanaRPump
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -30,7 +31,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() {
@Mock lateinit var commandQueue: CommandQueueProvider @Mock lateinit var commandQueue: CommandQueueProvider
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump lateinit var danaRPump: DanaRPump
private lateinit var danaRv2Plugin: DanaRv2Plugin private lateinit var danaRv2Plugin: DanaRv2Plugin
@ -44,8 +45,8 @@ class DanaRv2PluginTest : TestBaseWithProfile() {
`when`(resourceHelper.gs(R.string.pumplimit)).thenReturn("pump limit") `when`(resourceHelper.gs(R.string.pumplimit)).thenReturn("pump limit")
`when`(resourceHelper.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(resourceHelper.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
`when`(resourceHelper.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") `when`(resourceHelper.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
danaRPump = info.nightscout.androidaps.dana.DanaRPump(aapsLogger, sp, injector) danaRPump = DanaRPump(aapsLogger, sp, injector)
danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, rxBus, context, danaRPump, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, detailedBolusInfoStorage, dateUtil) danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, rxBus, context, danaRPump, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, detailedBolusInfoStorage, dateUtil, fabricPrivacy)
} }
@Test @Test

View file

@ -1,6 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRv2.comm package info.nightscout.androidaps.plugins.pump.danaRv2.comm
import android.content.Context import android.content.Context
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.danaRv2.comm.MessageHashTableRv2
import info.nightscout.androidaps.danaRv2.comm.MsgStatusAPS_v2
import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
@ -9,11 +15,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
@ -46,7 +48,7 @@ class MessageHashTable_rv2Test : DanaRTestBase() {
@Test @Test
fun runTest() { fun runTest() {
`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) `when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
val messageHashTableRv2 = MessageHashTableRv2(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue, activePlugin, detailedBolusInfoStorage, treatmentsPlugin, nsUpload, injector, DateUtil(context, resourceHelper)) val messageHashTableRv2 = MessageHashTableRv2(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue, activePlugin, detailedBolusInfoStorage, nsUpload, injector, DateUtil(context, resourceHelper), databaseHelper)
val forTesting: MessageBase = MsgStatusAPS_v2(aapsLogger, danaRPump) val forTesting: MessageBase = MsgStatusAPS_v2(aapsLogger, danaRPump)
val testPacket: MessageBase = messageHashTableRv2.findMessage(forTesting.command) val testPacket: MessageBase = messageHashTableRv2.findMessage(forTesting.command)
Assert.assertEquals(0xE001, testPacket.command.toLong()) Assert.assertEquals(0xE001, testPacket.command.toLong())

View file

@ -3,11 +3,11 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm
import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.danaRv2.comm.MsgCheckValue_v2
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test

View file

@ -1,11 +1,10 @@
package info.nightscout.androidaps.plugins.pump.danaRv2.comm package info.nightscout.androidaps.plugins.pump.danaRv2.comm
import android.content.Context import android.content.Context
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import org.junit.Assert import org.junit.Assert
@ -23,10 +22,9 @@ class MsgHistoryEvents_v2Test : DanaRTestBase() {
@Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var resourceHelper: ResourceHelper
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
@Mock lateinit var danaRv2Plugin: DanaRv2Plugin @Mock lateinit var danaRv2Plugin: DanaRv2Plugin
@Mock lateinit var treatmentsPlugin: TreatmentsPlugin
@Test @Throws(Exception::class) fun runTest() { @Test @Throws(Exception::class) fun runTest() {
var packet = MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, RxBusWrapper(), treatmentsPlugin, injector, DateUtil(context, resourceHelper), 0) val packet = info.nightscout.androidaps.danaRv2.comm.MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, RxBusWrapper(), activePluginProvider, injector, DateUtil(context, resourceHelper), 0)
// test message decoding // test message decoding
val array = ByteArray(100) val array = ByteArray(100)

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRv2.comm package info.nightscout.androidaps.plugins.pump.danaRv2.comm
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase.intFromBuff import info.nightscout.androidaps.danar.comm.MessageBase.intFromBuff
import info.nightscout.androidaps.danars.comm.DanaRS_Packet_APS_Basal_Set_Temporary_Basal.Companion.PARAM30MIN import info.nightscout.androidaps.danars.comm.DanaRS_Packet_APS_Basal_Set_Temporary_Basal.Companion.PARAM30MIN
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
@ -14,31 +14,31 @@ class MsgSetAPSTempBasalStart_v2Test : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
// test low hard limit // test low hard limit
var packet = MsgSetAPSTempBasalStart_v2(aapsLogger, -1, true, false) var packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, -1, true, false)
Assert.assertEquals(0, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(0, intFromBuff(packet.buffer, 0, 2))
Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1)) Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1))
// test high hard limit // test high hard limit
packet = MsgSetAPSTempBasalStart_v2(aapsLogger, 550, true, false) packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 550, true, false)
Assert.assertEquals(500, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(500, intFromBuff(packet.buffer, 0, 2))
Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1)) Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1))
// test setting 15 min // test setting 15 min
packet = MsgSetAPSTempBasalStart_v2(aapsLogger, 50, true, false) packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 50, true, false)
Assert.assertEquals(50, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(50, intFromBuff(packet.buffer, 0, 2))
Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1)) Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1))
// test setting 30 min // test setting 30 min
packet = MsgSetAPSTempBasalStart_v2(aapsLogger, 50, false, true) packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 50, false, true)
Assert.assertEquals(50, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(50, intFromBuff(packet.buffer, 0, 2))
Assert.assertEquals(PARAM30MIN, intFromBuff(packet.buffer, 2, 1)) Assert.assertEquals(PARAM30MIN, intFromBuff(packet.buffer, 2, 1))
// over 200% set always 15 min // over 200% set always 15 min
packet = MsgSetAPSTempBasalStart_v2(aapsLogger, 250, false, true) packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 250, false, true)
Assert.assertEquals(250, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(250, intFromBuff(packet.buffer, 0, 2))
Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1)) Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1))
// test low hard limit // test low hard limit
packet = MsgSetAPSTempBasalStart_v2(aapsLogger, -1, false, true) packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, -1, false, true)
Assert.assertEquals(0, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(0, intFromBuff(packet.buffer, 0, 2))
Assert.assertEquals(PARAM30MIN, intFromBuff(packet.buffer, 2, 1)) Assert.assertEquals(PARAM30MIN, intFromBuff(packet.buffer, 2, 1))
// test high hard limit // test high hard limit
packet = MsgSetAPSTempBasalStart_v2(aapsLogger, 550, false, true) packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 550, false, true)
Assert.assertEquals(500, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(500, intFromBuff(packet.buffer, 0, 2))
Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1)) Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1))

View file

@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgSetHistoryEntry_v2Test : DanaRTestBase() { class MsgSetHistoryEntry_v2Test : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
var packet = MsgSetHistoryEntry_v2(aapsLogger, 1, System.currentTimeMillis(), 1, 0) var packet = info.nightscout.androidaps.danaRv2.comm.MsgSetHistoryEntry_v2(aapsLogger, 1, System.currentTimeMillis(), 1, 0)
// test message decoding // test message decoding
// != 1 fails // != 1 fails
packet.handleMessage(createArray(34, 2.toByte())) packet.handleMessage(createArray(34, 2.toByte()))

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRv2.comm package info.nightscout.androidaps.plugins.pump.danaRv2.comm
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase import info.nightscout.androidaps.danar.comm.MessageBase
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -12,7 +12,7 @@ class MsgStatusAPS_v2Test : DanaRTestBase() {
@Test @Test
fun runTest() { fun runTest() {
val packet = MsgStatusAPS_v2(aapsLogger, danaRPump) val packet = info.nightscout.androidaps.danaRv2.comm.MsgStatusAPS_v2(aapsLogger, danaRPump)
// test iob // test iob
//TODO Find a way to mock treatments plugin //TODO Find a way to mock treatments plugin
val testArray = createArray(34, 7.toByte()) val testArray = createArray(34, 7.toByte())

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRv2.comm package info.nightscout.androidaps.plugins.pump.danaRv2.comm
import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase import info.nightscout.androidaps.danar.comm.MessageBase
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -12,7 +12,7 @@ class MsgStatusBolusExtended_v2Test : DanaRTestBase() {
@Test @Test
fun runTest() { fun runTest() {
val packet = MsgStatusBolusExtended_v2(aapsLogger, danaRPump) val packet = info.nightscout.androidaps.danaRv2.comm.MsgStatusBolusExtended_v2(aapsLogger, danaRPump)
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 7.toByte())) packet.handleMessage(createArray(34, 7.toByte()))
Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 2, 2).toDouble() / 100.0, danaRPump.extendedBolusAmount, 0.0) Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 2, 2).toDouble() / 100.0, danaRPump.extendedBolusAmount, 0.0)

View file

@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgStatusTempBasal_v2Test : DanaRTestBase() { class MsgStatusTempBasal_v2Test : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgStatusTempBasal_v2(aapsLogger, danaRPump, dateUtil) val packet = info.nightscout.androidaps.danaRv2.comm.MsgStatusTempBasal_v2(aapsLogger, danaRPump, dateUtil)
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 1.toByte())) packet.handleMessage(createArray(34, 1.toByte()))
Assert.assertEquals(true, danaRPump.isTempBasalInProgress) Assert.assertEquals(true, danaRPump.isTempBasalInProgress)

View file

@ -1,7 +1,5 @@
package info.nightscout.androidaps.events package info.nightscout.androidaps.events
import android.content.res.Resources
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
class EventPreferenceChange : Event { class EventPreferenceChange : Event {

View file

@ -0,0 +1,5 @@
package info.nightscout.androidaps.interfaces
interface ConfigBuilderInterface {
fun storeSettings(from: String)
}

View file

@ -11,6 +11,7 @@
<string name="key_danars_v3_randomsynckey" translatable="false">danars_v3_randomsync_key_</string> <string name="key_danars_v3_randomsynckey" translatable="false">danars_v3_randomsync_key_</string>
<string name="key_rs_logcanulachange" translatable="false">rs_logcanulachange</string> <string name="key_rs_logcanulachange" translatable="false">rs_logcanulachange</string>
<string name="key_rs_loginsulinchange" translatable="false">rs_loginsulinchange</string> <string name="key_rs_loginsulinchange" translatable="false">rs_loginsulinchange</string>
<string name="key_danar_bt_name" translatable="false">danar_bt_name</string>
<string name="danars_pairing">Pairing</string> <string name="danars_pairing">Pairing</string>
<string name="danars_nodeviceavailable">No device found so far</string> <string name="danars_nodeviceavailable">No device found so far</string>
@ -89,5 +90,18 @@
<string name="danar_shutdown">Shutdown [hours]</string> <string name="danar_shutdown">Shutdown [hours]</string>
<string name="danar_lowreservoir">Low reservoir [Units]</string> <string name="danar_lowreservoir">Low reservoir [Units]</string>
<string name="danar_saveuseroptions">Save options to pump</string> <string name="danar_saveuseroptions">Save options to pump</string>
<string name="description_pump_dana_r">Pump integration for DANA Diabecare R pumps</string>
<string name="description_pump_dana_r_korean">Pump integration for domestic DANA Diabecare R pumps</string>
<string name="description_pump_dana_r_v2">Pump integration for DANA Diabecare R pumps with upgraded firmware</string>
<string name="danarpump_shortname">DANA</string>
<string name="nobtadapter">No bluetooth adapter found</string>
<string name="devicenotfound">Selected device not found</string>
<string name="danar_switchtouhmode">Change mode from U/d to U/h on pump</string>
<string name="danarkoreanpump">DanaR Korean</string>
<string name="danarpump">DanaR</string>
<string name="pumpdrivercorrected">Pump driver corrected</string>
<string name="danarv2pump">DanaRv2</string>
<string name="danar_disableeasymode">Disable EasyUI mode in pump</string>
<string name="profile_set_failed">Setting of basal profile failed</string>
</resources> </resources>

1
danar/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

82
danar/build.gradle Normal file
View file

@ -0,0 +1,82 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
kotlinOptions {
jvmTarget = '1.8'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled(project.hasProperty('coverage'))
}
firebaseDisable {
System.setProperty("disableFirebase", "true")
ext.enableCrashlytics = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
dependencies {
implementation project(':core')
implementation project(':dana')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation "androidx.preference:preference-ktx:1.1.1"
implementation "androidx.activity:activity:${activityVersion}"
implementation "androidx.activity:activity-ktx:${activityVersion}"
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
// remove after conversion to aapslogger
implementation 'org.slf4j:slf4j-api:1.7.30'
// Graphview cannot be upgraded
implementation "com.jjoe64:graphview:4.0.1"
implementation 'net.danlew:android.joda:2.10.6'
implementation "com.google.dagger:dagger-android:$dagger_version"
implementation "com.google.dagger:dagger-android-support:$dagger_version"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
//RxBus
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

0
danar/consumer-rules.pro Normal file
View file

21
danar/proguard-rules.pro vendored Normal file
View 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

View file

@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.nightscout.androidaps.danar" >
<uses-permission android:name="android.permission.BLUETOOTH" />
</manifest>

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.pump.danaRKorean; package info.nightscout.androidaps.danaRKorean;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
@ -12,15 +12,19 @@ import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import dagger.android.HasAndroidInjector; import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.dana.DanaRPump; import info.nightscout.androidaps.dana.DanaRPump;
import info.nightscout.androidaps.danaRKorean.services.DanaRKoreanExecutionService;
import info.nightscout.androidaps.danar.AbstractDanaRPlugin;
import info.nightscout.androidaps.danar.R;
import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
@ -29,10 +33,6 @@ import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker; import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.danaR.AbstractDanaRPlugin;
import info.nightscout.androidaps.plugins.pump.danaRKorean.services.DanaRKoreanExecutionService;
import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.Round; import info.nightscout.androidaps.utils.Round;
@ -49,6 +49,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
private final Context context; private final Context context;
private final ResourceHelper resourceHelper; private final ResourceHelper resourceHelper;
private final ConstraintChecker constraintChecker; private final ConstraintChecker constraintChecker;
private final FabricPrivacy fabricPrivacy;
@Inject @Inject
public DanaRKoreanPlugin( public DanaRKoreanPlugin(
@ -59,16 +60,18 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
Context context, Context context,
ResourceHelper resourceHelper, ResourceHelper resourceHelper,
ConstraintChecker constraintChecker, ConstraintChecker constraintChecker,
TreatmentsPlugin treatmentsPlugin, ActivePluginProvider activePlugin,
SP sp, SP sp,
CommandQueueProvider commandQueue, CommandQueueProvider commandQueue,
DateUtil dateUtil DateUtil dateUtil,
FabricPrivacy fabricPrivacy
) { ) {
super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, treatmentsPlugin, sp, dateUtil); super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, activePlugin, sp, dateUtil);
this.aapsLogger = aapsLogger; this.aapsLogger = aapsLogger;
this.context = context; this.context = context;
this.resourceHelper = resourceHelper; this.resourceHelper = resourceHelper;
this.constraintChecker = constraintChecker; this.constraintChecker = constraintChecker;
this.fabricPrivacy = fabricPrivacy;
getPluginDescription().description(R.string.description_pump_dana_r_korean); getPluginDescription().description(R.string.description_pump_dana_r_korean);
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false); useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false);
@ -87,16 +90,16 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
boolean previousValue = useExtendedBoluses; boolean previousValue = useExtendedBoluses;
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false); useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false);
if (useExtendedBoluses != previousValue && treatmentsPlugin.isInHistoryExtendedBoluslInProgress()) { if (useExtendedBoluses != previousValue && activePlugin.getActiveTreatments().isInHistoryExtendedBoluslInProgress()) {
sExecutionService.extendedBolusStop(); sExecutionService.extendedBolusStop();
} }
} }
}, exception -> FabricPrivacy.getInstance().logException(exception)) }, fabricPrivacy::logException)
); );
disposable.add(rxBus disposable.add(rxBus
.toObservable(EventAppExit.class) .toObservable(EventAppExit.class)
.observeOn(Schedulers.io()) .observeOn(Schedulers.io())
.subscribe(event -> context.unbindService(mConnection), exception -> FabricPrivacy.getInstance().logException(exception)) .subscribe(event -> context.unbindService(mConnection), fabricPrivacy::logException)
); );
super.onStart(); super.onStart();
} }
@ -171,11 +174,11 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
if (!result.success) if (!result.success)
result.comment = resourceHelper.gs(R.string.boluserrorcode, detailedBolusInfo.insulin, t.insulin, danaRPump.getBolusStartErrorCode()); result.comment = resourceHelper.gs(R.string.boluserrorcode, detailedBolusInfo.insulin, t.insulin, danaRPump.getBolusStartErrorCode());
else else
result.comment = resourceHelper.gs(R.string.virtualpump_resultok); result.comment = resourceHelper.gs(R.string.ok);
aapsLogger.debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered); aapsLogger.debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered);
detailedBolusInfo.insulin = t.insulin; detailedBolusInfo.insulin = t.insulin;
detailedBolusInfo.date = System.currentTimeMillis(); detailedBolusInfo.date = System.currentTimeMillis();
treatmentsPlugin.addToHistoryTreatment(detailedBolusInfo, false); activePlugin.getActiveTreatments().addToHistoryTreatment(detailedBolusInfo, false);
return result; return result;
} else { } else {
PumpEnactResult result = new PumpEnactResult(getInjector()); PumpEnactResult result = new PumpEnactResult(getInjector());
@ -206,8 +209,8 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
final boolean doExtendedTemp = absoluteRate > getBaseBasalRate() && useExtendedBoluses; final boolean doExtendedTemp = absoluteRate > getBaseBasalRate() && useExtendedBoluses;
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
TemporaryBasal activeTemp = treatmentsPlugin.getRealTempBasalFromHistory(now); TemporaryBasal activeTemp = activePlugin.getActiveTreatments().getRealTempBasalFromHistory(now);
ExtendedBolus activeExtended = treatmentsPlugin.getExtendedBolusFromHistory(now); ExtendedBolus activeExtended = activePlugin.getActiveTreatments().getExtendedBolusFromHistory(now);
if (doTempOff) { if (doTempOff) {
// If extended in progress // If extended in progress
@ -328,15 +331,15 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
@NonNull @Override @NonNull @Override
public PumpEnactResult cancelTempBasal(boolean force) { public PumpEnactResult cancelTempBasal(boolean force) {
if (treatmentsPlugin.isInHistoryRealTempBasalInProgress()) if (activePlugin.getActiveTreatments().isInHistoryRealTempBasalInProgress())
return cancelRealTempBasal(); return cancelRealTempBasal();
if (treatmentsPlugin.isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) { if (activePlugin.getActiveTreatments().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) {
return cancelExtendedBolus(); return cancelExtendedBolus();
} }
PumpEnactResult result = new PumpEnactResult(getInjector()); PumpEnactResult result = new PumpEnactResult(getInjector());
result.success = true; result.success = true;
result.enacted = false; result.enacted = false;
result.comment = resourceHelper.gs(R.string.virtualpump_resultok); result.comment = resourceHelper.gs(R.string.ok);
result.isTempCancel = true; result.isTempCancel = true;
return result; return result;
} }
@ -348,7 +351,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
private PumpEnactResult cancelRealTempBasal() { private PumpEnactResult cancelRealTempBasal() {
PumpEnactResult result = new PumpEnactResult(getInjector()); PumpEnactResult result = new PumpEnactResult(getInjector());
TemporaryBasal runningTB = treatmentsPlugin.getTempBasalFromHistory(System.currentTimeMillis()); TemporaryBasal runningTB = activePlugin.getActiveTreatments().getTempBasalFromHistory(System.currentTimeMillis());
if (runningTB != null) { if (runningTB != null) {
sExecutionService.tempBasalStop(); sExecutionService.tempBasalStop();
result.enacted = true; result.enacted = true;
@ -357,7 +360,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
if (!danaRPump.isTempBasalInProgress()) { if (!danaRPump.isTempBasalInProgress()) {
result.success = true; result.success = true;
result.isTempCancel = true; result.isTempCancel = true;
result.comment = resourceHelper.gs(R.string.virtualpump_resultok); result.comment = resourceHelper.gs(R.string.ok);
aapsLogger.debug(LTag.PUMP, "cancelRealTempBasal: OK"); aapsLogger.debug(LTag.PUMP, "cancelRealTempBasal: OK");
return result; return result;
} else { } else {

View file

@ -1,17 +1,18 @@
package info.nightscout.androidaps.plugins.pump.danaRKorean.comm package info.nightscout.androidaps.danaRKorean.comm
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.danar.comm.*
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.ConfigBuilderInterface
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaR.comm.*
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import java.util.* import java.util.*
@ -24,18 +25,19 @@ class MessageHashTableRKorean @Inject constructor(
rxBus: RxBusWrapper, rxBus: RxBusWrapper,
resourceHelper: ResourceHelper, resourceHelper: ResourceHelper,
constraintChecker: ConstraintChecker, constraintChecker: ConstraintChecker,
danaRPump: info.nightscout.androidaps.dana.DanaRPump, danaRPump: DanaRPump,
danaRPlugin: DanaRPlugin, danaRPlugin: DanaRPlugin,
danaRKoreanPlugin: DanaRKoreanPlugin, danaRKoreanPlugin: DanaRKoreanPlugin,
configBuilderPlugin: ConfigBuilderPlugin, configBuilderPlugin: ConfigBuilderInterface,
commandQueue: CommandQueueProvider, commandQueue: CommandQueueProvider,
activePlugin: ActivePluginProvider, activePlugin: ActivePluginProvider,
dateUtil: DateUtil, dateUtil: DateUtil,
nsUpload: NSUpload, nsUpload: NSUpload,
databaseHelper: DatabaseHelperInterface,
injector: HasAndroidInjector injector: HasAndroidInjector
) : MessageHashTableBase { ) : MessageHashTableBase {
var messages: HashMap<Int, MessageBase> = HashMap() private var messages: HashMap<Int, MessageBase> = HashMap()
init { init {
put(MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0101 CMD_MEALINS_STOP put(MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0101 CMD_MEALINS_STOP
@ -57,11 +59,11 @@ class MessageHashTableRKorean @Inject constructor(
put(MsgError(aapsLogger, rxBus, resourceHelper, danaRPump, nsUpload)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS put(MsgError(aapsLogger, rxBus, resourceHelper, danaRPump, nsUpload)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT
put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT
put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil)) // 0x3101 CMD_HISTORY_MEAL_INS put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3101 CMD_HISTORY_MEAL_INS
put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil)) // 0x3102 CMD_HISTORY_DAY_INS put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3102 CMD_HISTORY_DAY_INS
put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil)) // 0x3104 CMD_HISTORY_GLUCOSE put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3104 CMD_HISTORY_GLUCOSE
put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil)) // 0x3105 CMD_HISTORY_ALARM put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3105 CMD_HISTORY_ALARM
put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil)) // 0x3107 CMD_HISTORY_CARBOHY put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3107 CMD_HISTORY_CARBOHY
put(MsgSettingBasal_k(aapsLogger, danaRPump, danaRKoreanPlugin)) // 0x3202 CMD_SETTING_V_BASAL_INS_I put(MsgSettingBasal_k(aapsLogger, danaRPump, danaRKoreanPlugin)) // 0x3202 CMD_SETTING_V_BASAL_INS_I
put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaRPump, danaRKoreanPlugin)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaRPump, danaRKoreanPlugin)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
put(MsgSettingProfileRatios(aapsLogger, danaRPump)) // 0x3204 CMD_SETTING_V_CCC_I put(MsgSettingProfileRatios(aapsLogger, danaRPump)) // 0x3204 CMD_SETTING_V_CCC_I
@ -71,9 +73,9 @@ class MessageHashTableRKorean @Inject constructor(
put(MsgSettingGlucose(aapsLogger, danaRPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY put(MsgSettingGlucose(aapsLogger, danaRPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
put(MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I put(MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I
put(MsgSetSingleBasalProfile(aapsLogger, rxBus, resourceHelper, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S put(MsgSetSingleBasalProfile(aapsLogger, rxBus, resourceHelper, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S
put(MsgHistoryAll(aapsLogger, rxBus, dateUtil)) // 0x41F2 CMD_HISTORY_ALL put(MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x41F2 CMD_HISTORY_ALL
put(MsgHistoryNewDone(aapsLogger, danaRPump)) // 0x42F1 CMD_HISTORY_NEW_DONE put(MsgHistoryNewDone(aapsLogger, danaRPump)) // 0x42F1 CMD_HISTORY_NEW_DONE
put(MsgHistoryNew(aapsLogger, rxBus, dateUtil)) // 0x42F2 CMD_HISTORY_NEW put(MsgHistoryNew(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x42F2 CMD_HISTORY_NEW
put(MsgCheckValue_k(aapsLogger, danaRPump, danaRKoreanPlugin)) // 0xF0F1 CMD_PUMP_CHECK_VALUE put(MsgCheckValue_k(aapsLogger, danaRPump, danaRKoreanPlugin)) // 0xF0F1 CMD_PUMP_CHECK_VALUE
} }

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.plugins.pump.danaRKorean.comm package info.nightscout.androidaps.danaRKorean.comm
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
class MsgCheckValue_k( class MsgCheckValue_k(
private val aapsLogger: AAPSLogger, private val aapsLogger: AAPSLogger,
private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, private val danaRPump: DanaRPump,
private val danaRKoreanPlugin: DanaRKoreanPlugin private val danaRKoreanPlugin: DanaRKoreanPlugin
) : MessageBase() { ) : MessageBase() {

View file

@ -1,21 +1,21 @@
package info.nightscout.androidaps.plugins.pump.danaRKorean.comm package info.nightscout.androidaps.danaRKorean.comm
import info.nightscout.androidaps.R import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danar.R
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
class MsgInitConnStatusBasic_k( class MsgInitConnStatusBasic_k(
private val aapsLogger: AAPSLogger, private val aapsLogger: AAPSLogger,
private val rxBus: RxBusWrapper, private val rxBus: RxBusWrapper,
private val resourceHelper: ResourceHelper, private val resourceHelper: ResourceHelper,
private val danaRPump: info.nightscout.androidaps.dana.DanaRPump private val danaRPump: DanaRPump
) : MessageBase() { ) : MessageBase() {
init { init {

View file

@ -1,6 +1,8 @@
package info.nightscout.androidaps.plugins.pump.danaRKorean.comm package info.nightscout.androidaps.danaRKorean.comm
import info.nightscout.androidaps.R import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danar.R
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
@ -8,15 +10,13 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
class MsgInitConnStatusBolus_k( class MsgInitConnStatusBolus_k(
private val aapsLogger: AAPSLogger, private val aapsLogger: AAPSLogger,
private val rxBus: RxBusWrapper, private val rxBus: RxBusWrapper,
private val resourceHelper: ResourceHelper, private val resourceHelper: ResourceHelper,
private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, private val danaRPump: DanaRPump,
private val activePlugin: ActivePluginProvider private val activePlugin: ActivePluginProvider
) : MessageBase() { ) : MessageBase() {

View file

@ -1,19 +1,19 @@
package info.nightscout.androidaps.plugins.pump.danaRKorean.comm package info.nightscout.androidaps.danaRKorean.comm
import info.nightscout.androidaps.R import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.danar.R
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.events.EventRebuildTabs import info.nightscout.androidaps.events.EventRebuildTabs
import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider
import info.nightscout.androidaps.interfaces.ConfigBuilderInterface
import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PluginType
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
@ -21,10 +21,10 @@ class MsgInitConnStatusTime_k(
private val aapsLogger: AAPSLogger, private val aapsLogger: AAPSLogger,
private val rxBus: RxBusWrapper, private val rxBus: RxBusWrapper,
private val resourceHelper: ResourceHelper, private val resourceHelper: ResourceHelper,
private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, private val danaRPump: DanaRPump,
private val danaRPlugin: DanaRPlugin, private val danaRPlugin: DanaRPlugin,
private val danaRKoreanPlugin: DanaRKoreanPlugin, private val danaRKoreanPlugin: DanaRKoreanPlugin,
private val configBuilderPlugin: ConfigBuilderPlugin, private val configBuilderPlugin: ConfigBuilderInterface,
private val commandQueue: CommandQueueProvider, private val commandQueue: CommandQueueProvider,
private val dateUtil: DateUtil private val dateUtil: DateUtil
) : MessageBase() { ) : MessageBase() {

View file

@ -1,9 +1,9 @@
package info.nightscout.androidaps.plugins.pump.danaRKorean.comm package info.nightscout.androidaps.danaRKorean.comm
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase
import java.util.* import java.util.*
/** /**
@ -16,7 +16,7 @@ import java.util.*
*/ */
class MsgSettingBasalProfileAll_k( class MsgSettingBasalProfileAll_k(
private val aapsLogger: AAPSLogger, private val aapsLogger: AAPSLogger,
private val danaRPump: info.nightscout.androidaps.dana.DanaRPump private val danaRPump: DanaRPump
) : MessageBase() { ) : MessageBase() {
init { init {

View file

@ -1,15 +1,15 @@
package info.nightscout.androidaps.plugins.pump.danaRKorean.comm package info.nightscout.androidaps.danaRKorean.comm
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
import java.util.* import java.util.*
class MsgSettingBasal_k( class MsgSettingBasal_k(
private val aapsLogger: AAPSLogger, private val aapsLogger: AAPSLogger,
private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, private val danaRPump: DanaRPump,
private val danaRKoreanPlugin: DanaRKoreanPlugin private val danaRKoreanPlugin: DanaRKoreanPlugin
) : MessageBase() { ) : MessageBase() {
@ -19,7 +19,7 @@ class MsgSettingBasal_k(
} }
override fun handleMessage(bytes: ByteArray) { override fun handleMessage(bytes: ByteArray) {
danaRPump.pumpProfiles = Array(4) {Array(48) {0.0} } danaRPump.pumpProfiles = Array(4) { Array(48) { 0.0 } }
for (index in 0..23) { for (index in 0..23) {
var basal = intFromBuff(bytes, 2 * index, 2) var basal = intFromBuff(bytes, 2 * index, 2)
if (basal < danaRKoreanPlugin.pumpDescription.basalMinimumRate) basal = 0 if (basal < danaRKoreanPlugin.pumpDescription.basalMinimumRate) basal = 0

View file

@ -1,13 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRKorean.comm package info.nightscout.androidaps.danaRKorean.comm
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase
class MsgStatusBasic_k( class MsgStatusBasic_k(
private val aapsLogger: AAPSLogger, private val aapsLogger: AAPSLogger,
private val danaRPump: info.nightscout.androidaps.dana.DanaRPump private val danaRPump: DanaRPump
) : MessageBase() { ) : MessageBase() {
init { init {

Some files were not shown because too many files have changed in this diff Show more