final dana renaming

This commit is contained in:
Milos Kozak 2020-05-11 16:58:59 +02:00
parent 5b269f6156
commit 5dea964b89
217 changed files with 1675 additions and 1620 deletions

View file

@ -64,8 +64,8 @@
<activity <activity
android:name=".activities.ErrorHelperActivity" android:name=".activities.ErrorHelperActivity"
android:theme="@style/Theme.AppCompat.Translucent" /> android:theme="@style/Theme.AppCompat.Translucent" />
<activity android:name="info.nightscout.androidaps.dana.activities.DanaRHistoryActivity" /> <activity android:name="info.nightscout.androidaps.dana.activities.DanaHistoryActivity" />
<activity android:name="info.nightscout.androidaps.dana.activities.DanaRUserOptionsActivity" /> <activity android:name="info.nightscout.androidaps.dana.activities.DanaUserOptionsActivity" />
<activity android:name=".activities.TDDStatsActivity" /> <activity android:name=".activities.TDDStatsActivity" />
<activity android:name=".plugins.general.overview.activities.QuickWizardListActivity"> <activity android:name=".plugins.general.overview.activities.QuickWizardListActivity">
<intent-filter> <intent-filter>

View file

@ -17,12 +17,10 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobThread
abstract class APSModule { abstract class APSModule {
@ContributesAndroidInjector abstract fun loggerCallbackInjector(): LoggerCallback @ContributesAndroidInjector abstract fun loggerCallbackInjector(): LoggerCallback
@ContributesAndroidInjector abstract fun apsResultInjector(): APSResult
@ContributesAndroidInjector abstract fun determineBasalResultSMBInjector(): DetermineBasalResultSMB @ContributesAndroidInjector abstract fun determineBasalResultSMBInjector(): DetermineBasalResultSMB
@ContributesAndroidInjector abstract fun determineBasalResultAMAInjector(): DetermineBasalResultAMA @ContributesAndroidInjector abstract fun determineBasalResultAMAInjector(): DetermineBasalResultAMA
@ContributesAndroidInjector abstract fun determineBasalAdapterAMAJSInjector(): DetermineBasalAdapterAMAJS @ContributesAndroidInjector abstract fun determineBasalAdapterAMAJSInjector(): DetermineBasalAdapterAMAJS
@ContributesAndroidInjector abstract fun determineBasalAdapterSMBJSInjector(): DetermineBasalAdapterSMBJS @ContributesAndroidInjector abstract fun determineBasalAdapterSMBJSInjector(): DetermineBasalAdapterSMBJS
@ContributesAndroidInjector abstract fun autosensDataInjector(): AutosensData
@ContributesAndroidInjector abstract fun iobCobThreadInjector(): IobCobThread @ContributesAndroidInjector abstract fun iobCobThreadInjector(): IobCobThread
@ContributesAndroidInjector abstract fun iobCobOref1ThreadInjector(): IobCobOref1Thread @ContributesAndroidInjector abstract fun iobCobOref1ThreadInjector(): IobCobOref1Thread
} }

View file

@ -4,7 +4,6 @@ import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.MainActivity import info.nightscout.androidaps.MainActivity
import info.nightscout.androidaps.activities.* import info.nightscout.androidaps.activities.*
import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.historyBrowser.HistoryBrowseActivity import info.nightscout.androidaps.historyBrowser.HistoryBrowseActivity
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity
@ -12,9 +11,6 @@ import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizar
import info.nightscout.androidaps.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity import info.nightscout.androidaps.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity
import info.nightscout.androidaps.plugins.pump.common.dialog.RileyLinkBLEScanActivity import info.nightscout.androidaps.plugins.pump.common.dialog.RileyLinkBLEScanActivity
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity
import info.nightscout.androidaps.dana.activities.DanaRHistoryActivity
import info.nightscout.androidaps.dana.activities.DanaRUserOptionsActivity
import info.nightscout.androidaps.danars.activities.EnterPinActivity
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity import info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingActivity import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingActivity
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingInformationActivity import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingInformationActivity
@ -25,10 +21,6 @@ import info.nightscout.androidaps.setupwizard.SetupWizardActivity
@Suppress("unused") @Suppress("unused")
abstract class ActivitiesModule { abstract class ActivitiesModule {
@ContributesAndroidInjector abstract fun contributeDanaRHistoryActivity(): DanaRHistoryActivity
@ContributesAndroidInjector abstract fun contributeDanaRUserOptionsActivity(): DanaRUserOptionsActivity
@ContributesAndroidInjector abstract fun contributeEnterPinActivity(): EnterPinActivity
@ContributesAndroidInjector abstract fun contributeErrorHelperActivity(): ErrorHelperActivity
@ContributesAndroidInjector abstract fun contributesHistoryBrowseActivity(): HistoryBrowseActivity @ContributesAndroidInjector abstract fun contributesHistoryBrowseActivity(): HistoryBrowseActivity
@ContributesAndroidInjector abstract fun contributesInsightAlertActivity(): InsightAlertActivity @ContributesAndroidInjector abstract fun contributesInsightAlertActivity(): InsightAlertActivity
@ContributesAndroidInjector abstract fun contributesInsightPairingActivity(): InsightPairingActivity @ContributesAndroidInjector abstract fun contributesInsightPairingActivity(): InsightPairingActivity

View file

@ -5,9 +5,10 @@ import dagger.Component
import dagger.android.AndroidInjectionModule import dagger.android.AndroidInjectionModule
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.core.dependencyInjection.CoreModule import info.nightscout.androidaps.core.di.CoreModule
import info.nightscout.androidaps.danars.dependencyInjection.DanaRSActivitiesModule import info.nightscout.androidaps.dana.di.DanaModule
import info.nightscout.androidaps.danars.dependencyInjection.DanaRSCommModule import info.nightscout.androidaps.danar.di.DanaRServicesModule
import info.nightscout.androidaps.danars.di.DanaRSModule
import javax.inject.Singleton import javax.inject.Singleton
@Singleton @Singleton
@ -33,8 +34,9 @@ import javax.inject.Singleton
SMSModule::class, SMSModule::class,
UIModule::class, UIModule::class,
CoreModule::class, CoreModule::class,
DanaRSCommModule::class, DanaModule::class,
DanaRSActivitiesModule::class DanaRServicesModule::class,
DanaRSModule::class
] ]
) )
interface AppComponent : AndroidInjector<MainApp> { interface AppComponent : AndroidInjector<MainApp> {

View file

@ -10,17 +10,12 @@ import info.nightscout.androidaps.Config
import info.nightscout.androidaps.MainApp 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.plugins.configBuilder.ConfigBuilderPlugin 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.general.nsclient.UploadQueue import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.queue.CommandQueue import info.nightscout.androidaps.queue.CommandQueue
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.androidNotification.NotificationHolder import info.nightscout.androidaps.utils.androidNotification.NotificationHolder
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import info.nightscout.androidaps.utils.storage.FileStorage import info.nightscout.androidaps.utils.storage.FileStorage
import info.nightscout.androidaps.utils.storage.Storage import info.nightscout.androidaps.utils.storage.Storage
import javax.inject.Singleton import javax.inject.Singleton
@ -30,12 +25,6 @@ import javax.inject.Singleton
]) ])
open class AppModule { open class AppModule {
@Provides
@Singleton
fun provideProfileFunction(injector: HasAndroidInjector, aapsLogger: AAPSLogger, sp: SP, resourceHelper: ResourceHelper, activePlugin: ActivePluginProvider, fabricPrivacy: FabricPrivacy): ProfileFunction {
return ProfileFunctionImplementation(injector, aapsLogger, sp, resourceHelper, activePlugin, fabricPrivacy)
}
@Provides @Provides
fun providesPlugins(configInterface: ConfigInterface, fun providesPlugins(configInterface: ConfigInterface,
@PluginsModule.AllConfigs allConfigs: Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>, @PluginsModule.AllConfigs allConfigs: Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>,

View file

@ -2,7 +2,6 @@ package info.nightscout.androidaps.dependencyInjection
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.queue.CommandQueue import info.nightscout.androidaps.queue.CommandQueue
import info.nightscout.androidaps.queue.commands.* import info.nightscout.androidaps.queue.commands.*
@ -10,8 +9,6 @@ import info.nightscout.androidaps.queue.commands.*
@Suppress("unused") @Suppress("unused")
abstract class CommandQueueModule { abstract class CommandQueueModule {
@ContributesAndroidInjector abstract fun pumpEnactResultInjector(): PumpEnactResult
@ContributesAndroidInjector abstract fun commandQueueInjector(): CommandQueue @ContributesAndroidInjector abstract fun commandQueueInjector(): CommandQueue
@ContributesAndroidInjector abstract fun commandBolusInjector(): CommandBolus @ContributesAndroidInjector abstract fun commandBolusInjector(): CommandBolus
@ContributesAndroidInjector abstract fun commandCancelExtendedBolusInjector(): CommandCancelExtendedBolus @ContributesAndroidInjector abstract fun commandCancelExtendedBolusInjector(): CommandCancelExtendedBolus

View file

@ -19,17 +19,7 @@ import info.nightscout.androidaps.utils.wizard.QuickWizardEntry
@Suppress("unused") @Suppress("unused")
abstract class DataClassesModule { abstract class DataClassesModule {
@ContributesAndroidInjector abstract fun profileInjector(): Profile
@ContributesAndroidInjector abstract fun glucoseStatusInjector(): GlucoseStatus @ContributesAndroidInjector abstract fun glucoseStatusInjector(): GlucoseStatus
@ContributesAndroidInjector abstract fun profileStoreInjector(): ProfileStore
// TODO move to Core
@ContributesAndroidInjector abstract fun bgReadingInjector(): BgReading
@ContributesAndroidInjector abstract fun treatmentInjector(): Treatment
@ContributesAndroidInjector abstract fun profileSwitchInjector(): ProfileSwitch
@ContributesAndroidInjector abstract fun temporaryBasalInjector(): TemporaryBasal
@ContributesAndroidInjector abstract fun careportalEventInjector(): CareportalEvent
@ContributesAndroidInjector abstract fun extendedBolusInjector(): ExtendedBolus
@ContributesAndroidInjector abstract fun treatmentServiceInjector(): TreatmentService @ContributesAndroidInjector abstract fun treatmentServiceInjector(): TreatmentService

View file

@ -32,7 +32,6 @@ import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment
import info.nightscout.androidaps.plugins.pump.combo.ComboFragment import info.nightscout.androidaps.plugins.pump.combo.ComboFragment
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment
import info.nightscout.androidaps.dana.DanaRFragment
import info.nightscout.androidaps.danars.dialogs.PairingProgressDialog import info.nightscout.androidaps.danars.dialogs.PairingProgressDialog
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment
@ -58,7 +57,6 @@ abstract class FragmentsModule {
@ContributesAndroidInjector @ContributesAndroidInjector
abstract fun contributesConfigBuilderFragment(): ConfigBuilderFragment abstract fun contributesConfigBuilderFragment(): ConfigBuilderFragment
@ContributesAndroidInjector abstract fun contributesDanaRFragment(): DanaRFragment
@ContributesAndroidInjector abstract fun contributesFoodFragment(): FoodFragment @ContributesAndroidInjector abstract fun contributesFoodFragment(): FoodFragment
@ContributesAndroidInjector abstract fun contributesInsulinFragment(): InsulinFragment @ContributesAndroidInjector abstract fun contributesInsulinFragment(): InsulinFragment
@ContributesAndroidInjector abstract fun contributesLocalProfileFragment(): LocalProfileFragment @ContributesAndroidInjector abstract fun contributesLocalProfileFragment(): LocalProfileFragment
@ -87,8 +85,6 @@ abstract class FragmentsModule {
@ContributesAndroidInjector abstract fun contributesVirtualPumpFragment(): VirtualPumpFragment @ContributesAndroidInjector abstract fun contributesVirtualPumpFragment(): VirtualPumpFragment
@ContributesAndroidInjector abstract fun contributesPairingProgressDialog(): PairingProgressDialog
@ContributesAndroidInjector abstract fun contributesBolusProgressDialog(): BolusProgressDialog
@ContributesAndroidInjector abstract fun contributesCalibrationDialog(): CalibrationDialog @ContributesAndroidInjector abstract fun contributesCalibrationDialog(): CalibrationDialog
@ContributesAndroidInjector abstract fun contributesCarbsDialog(): CarbsDialog @ContributesAndroidInjector abstract fun contributesCarbsDialog(): CarbsDialog
@ContributesAndroidInjector abstract fun contributesCareDialog(): CareDialog @ContributesAndroidInjector abstract fun contributesCareDialog(): CareDialog
@ -99,7 +95,6 @@ abstract class FragmentsModule {
@ContributesAndroidInjector @ContributesAndroidInjector
abstract fun contributesEditQuickWizardDialog(): EditQuickWizardDialog abstract fun contributesEditQuickWizardDialog(): EditQuickWizardDialog
@ContributesAndroidInjector abstract fun contributesErrorDialog(): ErrorDialog
@ContributesAndroidInjector abstract fun contributesExtendedBolusDialog(): ExtendedBolusDialog @ContributesAndroidInjector abstract fun contributesExtendedBolusDialog(): ExtendedBolusDialog
@ContributesAndroidInjector abstract fun contributesFillDialog(): FillDialog @ContributesAndroidInjector abstract fun contributesFillDialog(): FillDialog
@ContributesAndroidInjector abstract fun contributesChooseActionDialog(): ChooseActionDialog @ContributesAndroidInjector abstract fun contributesChooseActionDialog(): ChooseActionDialog

View file

@ -14,7 +14,6 @@ abstract class ReceiversModule {
@ContributesAndroidInjector abstract fun contributesChargingStateReceiver(): ChargingStateReceiver @ContributesAndroidInjector abstract fun contributesChargingStateReceiver(): ChargingStateReceiver
@ContributesAndroidInjector abstract fun contributesDataReceiver(): DataReceiver @ContributesAndroidInjector abstract fun contributesDataReceiver(): DataReceiver
@ContributesAndroidInjector abstract fun contributesKeepAliveReceiver(): KeepAliveReceiver @ContributesAndroidInjector abstract fun contributesKeepAliveReceiver(): KeepAliveReceiver
@ContributesAndroidInjector abstract fun contributesNetworkChangeReceiver(): NetworkChangeReceiver
@ContributesAndroidInjector abstract fun contributesRileyLinkBluetoothStateReceiver(): RileyLinkBluetoothStateReceiver @ContributesAndroidInjector abstract fun contributesRileyLinkBluetoothStateReceiver(): RileyLinkBluetoothStateReceiver
@ContributesAndroidInjector abstract fun contributesSmsReceiver(): SmsReceiver @ContributesAndroidInjector abstract fun contributesSmsReceiver(): SmsReceiver
@ContributesAndroidInjector abstract fun contributesTimeDateOrTZChangeReceiver(): TimeDateOrTZChangeReceiver @ContributesAndroidInjector abstract fun contributesTimeDateOrTZChangeReceiver(): TimeDateOrTZChangeReceiver

View file

@ -7,11 +7,6 @@ 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.danar.services.AbstractDanaRExecutionService
import info.nightscout.androidaps.danar.services.DanaRExecutionService
import info.nightscout.androidaps.danaRKorean.services.DanaRKoreanExecutionService
import info.nightscout.androidaps.danars.services.DanaRSService
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,17 +19,12 @@ import info.nightscout.androidaps.services.LocationService
@Suppress("unused") @Suppress("unused")
abstract class ServicesModule { abstract class ServicesModule {
@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
@ContributesAndroidInjector abstract fun contributesDummyService(): DummyService @ContributesAndroidInjector abstract fun contributesDummyService(): DummyService
@ContributesAndroidInjector abstract fun contributesLocationService(): LocationService @ContributesAndroidInjector abstract fun contributesLocationService(): LocationService
@ContributesAndroidInjector abstract fun contributesNSClientService(): NSClientService @ContributesAndroidInjector abstract fun contributesNSClientService(): NSClientService
@ContributesAndroidInjector abstract fun contributesDanaRSService(): DanaRSService
@ContributesAndroidInjector abstract fun contributesDanaRv2ExecutionService(): DanaRv2ExecutionService
@ContributesAndroidInjector abstract fun contributesDanaRExecutionService(): DanaRExecutionService
@ContributesAndroidInjector abstract fun contributesDanaRKoreanExecutionService(): DanaRKoreanExecutionService
@ContributesAndroidInjector abstract fun contributesWatchUpdaterService(): WatchUpdaterService @ContributesAndroidInjector abstract fun contributesWatchUpdaterService(): WatchUpdaterService
@ContributesAndroidInjector abstract fun contributesInsightAlertService(): InsightAlertService @ContributesAndroidInjector abstract fun contributesInsightAlertService(): InsightAlertService
@ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService @ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService

View file

@ -1,16 +0,0 @@
PreferenceActivity is an Example how to make an Activity injectable.
We might undo that as we don't actually have us inject things.
MyPreferencesFragment is an injectable Fragment. Here we actually have Dagger2 provide us an InsulinOrefFreePeakPlugin instance.
If we use multiple Fragments, we should generate a base-class. Then we only have to add a "provides***Fragment" to the FragmentsModule and derive from that class.
InsulinOrefFreePeakPlugin is an example how to get things injected via the constructor.
You could call "new InsulinOrefFreePeakPlugin(new SPImpl(SPImpl(PreferenceManager.getDefaultSharedPreferences(context))), new ResourceHelper())"... but Dagger will resolve that for you in MainApp. :)
SPImpl is an example how to bind an implementation to an Interface via Dagger.
ResourceHelper is an example how to generate simple classes that Dagger can auto-resolve how to inject them. No need for a provider here.
ResourceHelper might have a weak reference at some point and not a static dependency on MainApp... but at least we reduced the static dependencies within a plugin.
In order to Test: Any dependency of InsulinOrefFreePeakPlugin is passed via the constructor. Instead of static mocking MainApp you now can Mock ResourceHelper with a very small interface.

View file

@ -89,19 +89,19 @@ class TempBasalDialog : DialogFragmentWithDate() {
if (isPercentPump) { if (isPercentPump) {
val basalPercentInput = SafeParse.stringToInt(actions_tempbasal_basalpercentinput.text) val basalPercentInput = SafeParse.stringToInt(actions_tempbasal_basalpercentinput.text)
percent = constraintChecker.applyBasalPercentConstraints(Constraint(basalPercentInput), profile).value() percent = constraintChecker.applyBasalPercentConstraints(Constraint(basalPercentInput), profile).value()
actions.add(resourceHelper.gs(R.string.pump_tempbasal_label) + ": $percent%") actions.add(resourceHelper.gs(R.string.tempbasal_label) + ": $percent%")
actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, durationInMinutes)) actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, durationInMinutes))
if (percent != basalPercentInput) actions.add(resourceHelper.gs(R.string.constraintapllied)) if (percent != basalPercentInput) actions.add(resourceHelper.gs(R.string.constraintapllied))
} else { } else {
val basalAbsoluteInput = SafeParse.stringToDouble(actions_tempbasal_basalabsoluteinput.text) val basalAbsoluteInput = SafeParse.stringToDouble(actions_tempbasal_basalabsoluteinput.text)
absolute = constraintChecker.applyBasalConstraints(Constraint(basalAbsoluteInput), profile).value() absolute = constraintChecker.applyBasalConstraints(Constraint(basalAbsoluteInput), profile).value()
actions.add(resourceHelper.gs(R.string.pump_tempbasal_label) + ": " + resourceHelper.gs(R.string.pump_basebasalrate, absolute)) actions.add(resourceHelper.gs(R.string.tempbasal_label) + ": " + resourceHelper.gs(R.string.pump_basebasalrate, absolute))
actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, durationInMinutes)) actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, durationInMinutes))
if (abs(absolute - basalAbsoluteInput) > 0.01) if (abs(absolute - basalAbsoluteInput) > 0.01)
actions.add("<font color='" + resourceHelper.gc(R.color.warning) + "'>" + resourceHelper.gs(R.string.constraintapllied) + "</font>") actions.add("<font color='" + resourceHelper.gc(R.color.warning) + "'>" + resourceHelper.gs(R.string.constraintapllied) + "</font>")
} }
activity?.let { activity -> activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.pump_tempbasal_label), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable { OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.tempbasal_label), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
val callback: Callback = object : Callback() { val callback: Callback = object : Callback() {
override fun run() { override fun run() {
if (!result.success) { if (!result.success) {

View file

@ -16,7 +16,6 @@ import info.nightscout.androidaps.db.TempTarget
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.interfaces.ProfileFunction
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.DefaultValueHelper import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.HtmlHelper import info.nightscout.androidaps.utils.HtmlHelper
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
@ -123,7 +122,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
val duration = overview_temptarget_duration.value.toInt() val duration = overview_temptarget_duration.value.toInt()
if (target != 0.0 && duration != 0) { if (target != 0.0 && duration != 0) {
actions.add(resourceHelper.gs(R.string.reason) + ": " + reason) actions.add(resourceHelper.gs(R.string.reason) + ": " + reason)
actions.add(resourceHelper.gs(R.string.nsprofileview_target_label) + ": " + Profile.toCurrentUnitsString(profileFunction, target) + " " + resourceHelper.gs(unitResId)) actions.add(resourceHelper.gs(R.string.target_label) + ": " + Profile.toCurrentUnitsString(profileFunction, target) + " " + resourceHelper.gs(unitResId))
actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, duration)) actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, duration))
} else { } else {
actions.add(resourceHelper.gs(R.string.stoptemptarget)) actions.add(resourceHelper.gs(R.string.stoptemptarget))

View file

@ -346,7 +346,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
val lastRun = loopPlugin.lastRun val lastRun = loopPlugin.lastRun
loopPlugin.invoke("Accept temp button", false) loopPlugin.invoke("Accept temp button", false)
if (lastRun?.lastAPSRun != null && lastRun.constraintsProcessed?.isChangeRequested == true) { if (lastRun?.lastAPSRun != null && lastRun.constraintsProcessed?.isChangeRequested == true) {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.pump_tempbasal_label), lastRun.constraintsProcessed?.toSpanned() OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.tempbasal_label), lastRun.constraintsProcessed?.toSpanned()
?: "".toSpanned(), Runnable { ?: "".toSpanned(), Runnable {
aapsLogger.debug("USER ENTRY: ACCEPT TEMP BASAL") aapsLogger.debug("USER ENTRY: ACCEPT TEMP BASAL")
overview_accepttempbutton?.visibility = View.GONE overview_accepttempbutton?.visibility = View.GONE
@ -664,9 +664,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
overview_basebasal?.text = activeTemp?.let { if (resourceHelper.shortTextMode()) "T:" + activeTemp.toStringVeryShort() else activeTemp.toStringFull() } overview_basebasal?.text = activeTemp?.let { if (resourceHelper.shortTextMode()) "T:" + activeTemp.toStringVeryShort() else activeTemp.toStringFull() }
?: resourceHelper.gs(R.string.pump_basebasalrate, profile.basal) ?: resourceHelper.gs(R.string.pump_basebasalrate, profile.basal)
overview_basal_llayout?.setOnClickListener { overview_basal_llayout?.setOnClickListener {
var fullText = "${resourceHelper.gs(R.string.pump_basebasalrate_label)}: ${resourceHelper.gs(R.string.pump_basebasalrate, profile.basal)}" var fullText = "${resourceHelper.gs(R.string.basebasalrate_label)}: ${resourceHelper.gs(R.string.pump_basebasalrate, profile.basal)}"
if (activeTemp != null) if (activeTemp != null)
fullText += "\n" + resourceHelper.gs(R.string.pump_tempbasal_label) + ": " + activeTemp.toStringFull() fullText += "\n" + resourceHelper.gs(R.string.tempbasal_label) + ": " + activeTemp.toStringFull()
activity?.let { activity?.let {
OKDialog.show(it, resourceHelper.gs(R.string.basal), fullText) OKDialog.show(it, resourceHelper.gs(R.string.basal), fullText)
} }

View file

@ -206,7 +206,7 @@ class OverviewMenus @Inject constructor(
R.id.overview_activeprofile -> { R.id.overview_activeprofile -> {
menu.setHeaderTitle(resourceHelper.gs(R.string.profile)) menu.setHeaderTitle(resourceHelper.gs(R.string.profile))
menu.add(resourceHelper.gs(R.string.danar_viewprofile)) menu.add(resourceHelper.gs(R.string.viewprofile))
if (activePlugin.activeProfileInterface.profile != null) { if (activePlugin.activeProfileInterface.profile != null) {
menu.add(resourceHelper.gs(R.string.careportal_profileswitch)) menu.add(resourceHelper.gs(R.string.careportal_profileswitch))
} }
@ -341,18 +341,18 @@ class OverviewMenus @Inject constructor(
return true return true
} }
resourceHelper.gs(R.string.disconnectpumpfor3h) -> { resourceHelper.gs(R.string.disconnectpumpfor3h) -> {
aapsLogger.debug("USER ENTRY: DISCONNECT 3h") aapsLogger.debug("USER ENTRY: DISCONNECT 3h")
loopPlugin.disconnectPump(180, profile) loopPlugin.disconnectPump(180, profile)
rxBus.send(EventRefreshOverview("suspendmenu")) rxBus.send(EventRefreshOverview("suspendmenu"))
return true return true
} }
resourceHelper.gs(R.string.careportal_profileswitch) -> { resourceHelper.gs(R.string.careportal_profileswitch) -> {
ProfileSwitchDialog().show(manager, "Overview") ProfileSwitchDialog().show(manager, "Overview")
} }
resourceHelper.gs(R.string.danar_viewprofile) -> { resourceHelper.gs(R.string.viewprofile) -> {
val args = Bundle() val args = Bundle()
args.putLong("time", DateUtil.now()) args.putLong("time", DateUtil.now())
args.putInt("mode", ProfileViewerDialog.Mode.RUNNING_PROFILE.ordinal) args.putInt("mode", ProfileViewerDialog.Mode.RUNNING_PROFILE.ordinal)
@ -361,7 +361,7 @@ class OverviewMenus @Inject constructor(
pvd.show(manager, "ProfileViewDialog") pvd.show(manager, "ProfileViewDialog")
} }
resourceHelper.gs(R.string.eatingsoon) -> { resourceHelper.gs(R.string.eatingsoon) -> {
aapsLogger.debug("USER ENTRY: TEMP TARGET EATING SOON") aapsLogger.debug("USER ENTRY: TEMP TARGET EATING SOON")
val target = Profile.toMgdl(defaultValueHelper.determineEatingSoonTT(), profileFunction.getUnits()) val target = Profile.toMgdl(defaultValueHelper.determineEatingSoonTT(), profileFunction.getUnits())
val tempTarget = TempTarget() val tempTarget = TempTarget()

View file

@ -7,7 +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.dana.DanaPump
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
@ -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: DanaRPump, private val danaPump: DanaPump,
private val hardLimits: HardLimits, private val hardLimits: HardLimits,
private val carbsGenerator: CarbsGenerator, private val carbsGenerator: CarbsGenerator,
private val dateUtil: DateUtil, private val dateUtil: DateUtil,
@ -326,7 +326,7 @@ class ActionStringHandler @Inject constructor(
message += "Today: " + DecimalFormatter.to2Decimal(tdd) + "U " + (DecimalFormatter.to0Decimal(100 * tdd / refTDD) + "%") + "\n" message += "Today: " + DecimalFormatter.to2Decimal(tdd) + "U " + (DecimalFormatter.to0Decimal(100 * tdd / refTDD) + "%") + "\n"
message += "\n" message += "\n"
} else if (pump is DanaRPlugin) { } else if (pump is DanaRPlugin) {
val tdd = danaRPump.dailyTotalUnits val tdd = danaPump.dailyTotalUnits
message += "Today: " + DecimalFormatter.to2Decimal(tdd) + "U " + (DecimalFormatter.to0Decimal(100 * tdd / refTDD) + "%") + "\n" message += "Today: " + DecimalFormatter.to2Decimal(tdd) + "U " + (DecimalFormatter.to0Decimal(100 * tdd / refTDD) + "%") + "\n"
message += "\n" message += "\n"
} }

View file

@ -45,7 +45,7 @@ class LocalProfileFragment : DaggerFragment() {
private val save = Runnable { private val save = Runnable {
doEdit() doEdit()
basalView?.updateLabel(resourceHelper.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel()) basalView?.updateLabel(resourceHelper.gs(R.string.basal_label) + ": " + sumLabel())
} }
private val textWatch = object : TextWatcher { private val textWatch = object : TextWatcher {
@ -106,14 +106,14 @@ class LocalProfileFragment : DaggerFragment() {
localprofile_name.addTextChangedListener(textWatch) localprofile_name.addTextChangedListener(textWatch)
localprofile_dia.setParams(localProfilePlugin.currentProfile().dia, hardLimits.MINDIA, hardLimits.MAXDIA, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch) localprofile_dia.setParams(localProfilePlugin.currentProfile().dia, hardLimits.MINDIA, hardLimits.MAXDIA, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch)
localprofile_dia.tag = "LP_DIA" localprofile_dia.tag = "LP_DIA"
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.nsprofileview_ic_label), localProfilePlugin.currentProfile().ic, null, hardLimits.MINIC, hardLimits.MAXIC, 0.1, DecimalFormat("0.0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.ic_label), localProfilePlugin.currentProfile().ic, null, hardLimits.MINIC, hardLimits.MAXIC, 0.1, DecimalFormat("0.0"), save)
basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save) basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
if (units == Constants.MGDL) { if (units == Constants.MGDL) {
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label), localProfilePlugin.currentProfile().isf, null, hardLimits.MINISF, hardLimits.MAXISF, 1.0, DecimalFormat("0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.isf_label), localProfilePlugin.currentProfile().isf, null, hardLimits.MINISF, hardLimits.MAXISF, 1.0, DecimalFormat("0"), save)
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save)
} else { } else {
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label), localProfilePlugin.currentProfile().isf, null, Profile.fromMgdlToUnits(hardLimits.MINISF, Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.MAXISF, Constants.MMOL), 0.1, DecimalFormat("0.0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.isf_label), localProfilePlugin.currentProfile().isf, null, Profile.fromMgdlToUnits(hardLimits.MINISF, Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.MAXISF, Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), Constants.MMOL), 0.1, DecimalFormat("0.0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
} }
// Spinner // Spinner
@ -190,10 +190,10 @@ class LocalProfileFragment : DaggerFragment() {
localprofile_units.text = resourceHelper.gs(R.string.units_colon) + " " + (if (localProfilePlugin.currentProfile().mgdl) resourceHelper.gs(R.string.mgdl) else resourceHelper.gs(R.string.mmol)) localprofile_units.text = resourceHelper.gs(R.string.units_colon) + " " + (if (localProfilePlugin.currentProfile().mgdl) resourceHelper.gs(R.string.mgdl) else resourceHelper.gs(R.string.mmol))
localprofile_dia.setParams(localProfilePlugin.currentProfile().dia, MIN_DIA, 12.0, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch) localprofile_dia.setParams(localProfilePlugin.currentProfile().dia, MIN_DIA, 12.0, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch)
localprofile_dia.tag = "LP_DIA" localprofile_dia.tag = "LP_DIA"
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.nsprofileview_ic_label) + ":", localProfilePlugin.currentProfile().ic, null, 0.5, 50.0, 0.1, DecimalFormat("0.0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.ic_label) + ":", localProfilePlugin.currentProfile().ic, null, 0.5, 50.0, 0.1, DecimalFormat("0.0"), save)
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label) + ":", localProfilePlugin.currentProfile().isf, null, 0.5, 500.0, 0.1, DecimalFormat("0.0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.isf_label) + ":", localProfilePlugin.currentProfile().isf, null, 0.5, 500.0, 0.1, DecimalFormat("0.0"), save)
basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save) basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label) + ":", localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, 3.0, 200.0, 0.1, DecimalFormat("0.0"), save) TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.target_label) + ":", localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, 3.0, 200.0, 0.1, DecimalFormat("0.0"), save)
updateGUI() updateGUI()
} }

View file

@ -269,7 +269,7 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick
private void getBatteryStatusItem(List<View> statusItems) { private void getBatteryStatusItem(List<View> statusItems) {
if (localInsightPlugin.getBatteryStatus() == null) return; if (localInsightPlugin.getBatteryStatus() == null) return;
statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_battery_label), statusItems.add(getStatusItem(resourceHelper.gs(R.string.battery_label),
localInsightPlugin.getBatteryStatus().getBatteryAmount() + "%")); localInsightPlugin.getBatteryStatus().getBatteryAmount() + "%"));
} }
@ -280,7 +280,7 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick
if (cartridgeStatus.isInserted()) if (cartridgeStatus.isInserted())
status = DecimalFormatter.to2Decimal(localInsightPlugin.getCartridgeStatus().getRemainingAmount()) + "U"; status = DecimalFormatter.to2Decimal(localInsightPlugin.getCartridgeStatus().getRemainingAmount()) + "U";
else status = resourceHelper.gs(R.string.not_inserted); else status = resourceHelper.gs(R.string.not_inserted);
statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_reservoir_label), status)); statusItems.add(getStatusItem(resourceHelper.gs(R.string.reservoir_label), status));
} }
private void getTDDItems(List<View> statusItems) { private void getTDDItems(List<View> statusItems) {
@ -294,14 +294,14 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick
private void getBaseBasalRateItem(List<View> statusItems) { private void getBaseBasalRateItem(List<View> statusItems) {
if (localInsightPlugin.getActiveBasalRate() == null) return; if (localInsightPlugin.getActiveBasalRate() == null) return;
ActiveBasalRate activeBasalRate = localInsightPlugin.getActiveBasalRate(); ActiveBasalRate activeBasalRate = localInsightPlugin.getActiveBasalRate();
statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_basebasalrate_label), statusItems.add(getStatusItem(resourceHelper.gs(R.string.basebasalrate_label),
DecimalFormatter.to2Decimal(activeBasalRate.getActiveBasalRate()) + " U/h (" + activeBasalRate.getActiveBasalProfileName() + ")")); DecimalFormatter.to2Decimal(activeBasalRate.getActiveBasalRate()) + " U/h (" + activeBasalRate.getActiveBasalProfileName() + ")"));
} }
private void getTBRItem(List<View> statusItems) { private void getTBRItem(List<View> statusItems) {
if (localInsightPlugin.getActiveTBR() == null) return; if (localInsightPlugin.getActiveTBR() == null) return;
ActiveTBR activeTBR = localInsightPlugin.getActiveTBR(); ActiveTBR activeTBR = localInsightPlugin.getActiveTBR();
statusItems.add(getStatusItem(resourceHelper.gs(R.string.pump_tempbasal_label), statusItems.add(getStatusItem(resourceHelper.gs(R.string.tempbasal_label),
resourceHelper.gs(R.string.tbr_formatter, activeTBR.getPercentage(), activeTBR.getInitialDuration() - activeTBR.getRemainingDuration(), activeTBR.getInitialDuration()))); resourceHelper.gs(R.string.tbr_formatter, activeTBR.getPercentage(), activeTBR.getInitialDuration() - activeTBR.getRemainingDuration(), activeTBR.getInitialDuration())));
} }

View file

@ -133,7 +133,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
remove.setOnClickListener { v: View -> remove.setOnClickListener { v: View ->
val careportalEvent = v.tag as CareportalEvent val careportalEvent = v.tag as CareportalEvent
activity?.let { activity -> activity?.let { activity ->
val text = resourceHelper.gs(R.string.careportal_newnstreatment_eventtype) + ": " + translator.translate(careportalEvent.eventType) + "\n" + val text = resourceHelper.gs(R.string.eventtype) + ": " + translator.translate(careportalEvent.eventType) + "\n" +
resourceHelper.gs(R.string.careportal_newnstreatment_notes_label) + ": " + careportalEvent.notes + "\n" + resourceHelper.gs(R.string.careportal_newnstreatment_notes_label) + ": " + careportalEvent.notes + "\n" +
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(careportalEvent.date) resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(careportalEvent.date)
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable { OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {

View file

@ -162,7 +162,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
context?.let { context?.let {
showConfirmation(it, resourceHelper.gs(R.string.removerecord), showConfirmation(it, resourceHelper.gs(R.string.removerecord),
""" """
${resourceHelper.gs(R.string.pump_tempbasal_label)}: ${tempBasal.toStringFull()} ${resourceHelper.gs(R.string.tempbasal_label)}: ${tempBasal.toStringFull()}
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(tempBasal.date)} ${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(tempBasal.date)}
""".trimIndent(), """.trimIndent(),
DialogInterface.OnClickListener { _: DialogInterface?, _: Int -> DialogInterface.OnClickListener { _: DialogInterface?, _: Int ->

View file

@ -290,7 +290,7 @@
android:drawableTop="@drawable/icon_danarstats" android:drawableTop="@drawable/icon_danarstats"
android:paddingLeft="0dp" android:paddingLeft="0dp"
android:paddingRight="0dp" android:paddingRight="0dp"
android:text="@string/danar_stats_tdd" android:text="@string/tdd"
app:layout_column="1" app:layout_column="1"
app:layout_columnWeight="1" app:layout_columnWeight="1"

View file

@ -233,7 +233,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/nsprofileview_target_label" android:text="@string/target_label"
android:width="120dp" android:width="120dp"
android:padding="10dp" android:padding="10dp"
android:textAppearance="@android:style/TextAppearance.Material.Small" android:textAppearance="@android:style/TextAppearance.Material.Small"

View file

@ -121,7 +121,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_battery_label" android:text="@string/battery_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -167,7 +167,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_reservoir_label" android:text="@string/reservoir_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -212,7 +212,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_lastconnection_label" android:text="@string/lastconnection_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -257,7 +257,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_lastbolus_label" android:text="@string/lastbolus_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -302,7 +302,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_basebasalrate_label" android:text="@string/basebasalrate_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -347,7 +347,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_tempbasal_label" android:text="@string/tempbasal_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView

View file

@ -24,7 +24,7 @@
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/pump_tempbasal_label" android:contentDescription="@string/tempbasal_label"
android:src="@drawable/icon_cp_basal_start" /> android:src="@drawable/icon_cp_basal_start" />
<TextView <TextView
@ -34,7 +34,7 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:text="@string/pump_tempbasal_label" android:text="@string/tempbasal_label"
android:textAlignment="center" android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge" /> android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout> </RelativeLayout>

View file

@ -81,7 +81,7 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:width="120dp" android:width="120dp"
android:padding="10dp" android:padding="10dp"
android:text="@string/nsprofileview_target_label" android:text="@string/target_label"
android:textAppearance="@android:style/TextAppearance.Material.Small" android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" /> android:textStyle="bold" />

View file

@ -164,7 +164,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_battery_label" android:text="@string/battery_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -211,7 +211,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_lastconnection_label" android:text="@string/lastconnection_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -256,7 +256,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_lastbolus_label" android:text="@string/lastbolus_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -302,7 +302,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_basebasalrate_label" android:text="@string/basebasalrate_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -347,7 +347,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_tempbasal_label" android:text="@string/tempbasal_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -393,7 +393,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_reservoir_label" android:text="@string/reservoir_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -511,7 +511,7 @@
android:drawableTop="@drawable/icon_danarhistory" android:drawableTop="@drawable/icon_danarhistory"
android:paddingLeft="0dp" android:paddingLeft="0dp"
android:paddingRight="0dp" android:paddingRight="0dp"
android:text="@string/danar_history" /> android:text="@string/pumphistory" />
<Button <Button
android:id="@+id/medtronic_stats" android:id="@+id/medtronic_stats"

View file

@ -242,7 +242,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_lastconnection_label" android:text="@string/lastconnection_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -287,7 +287,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_lastbolus_label" android:text="@string/lastbolus_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -333,7 +333,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_basebasalrate_label" android:text="@string/basebasalrate_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -378,7 +378,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_tempbasal_label" android:text="@string/tempbasal_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -424,7 +424,7 @@
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_reservoir_label" android:text="@string/reservoir_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView

View file

@ -135,7 +135,7 @@
android:layout_weight="2" android:layout_weight="2"
android:gravity="end" android:gravity="end"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:text="@string/nsprofileview_units_label" android:text="@string/units_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -180,7 +180,7 @@
android:layout_weight="2" android:layout_weight="2"
android:gravity="end" android:gravity="end"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:text="@string/nsprofileview_dia_label" android:text="@string/dia_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -225,7 +225,7 @@
android:layout_weight="2" android:layout_weight="2"
android:gravity="end" android:gravity="end"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:text="@string/nsprofileview_ic_label" android:text="@string/ic_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -270,7 +270,7 @@
android:layout_weight="2" android:layout_weight="2"
android:gravity="end" android:gravity="end"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:text="@string/nsprofileview_isf_label" android:text="@string/isf_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -315,7 +315,7 @@
android:layout_weight="2" android:layout_weight="2"
android:gravity="end" android:gravity="end"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:text="@string/nsprofileview_basal_label" android:text="@string/basal_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -402,7 +402,7 @@
android:layout_weight="2" android:layout_weight="2"
android:gravity="end" android:gravity="end"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:text="@string/nsprofileview_target_label" android:text="@string/target_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView

View file

@ -48,7 +48,7 @@
android:gravity="center_vertical|center_horizontal" android:gravity="center_vertical|center_horizontal"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_tempbasal_label" /> android:text="@string/tempbasal_label" />
<TextView <TextView
android:id="@+id/treatments_temptargets" android:id="@+id/treatments_temptargets"

View file

@ -33,7 +33,7 @@
android:layout_weight="1" android:layout_weight="1"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_basebasalrate_label" android:text="@string/basebasalrate_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -77,7 +77,7 @@
android:layout_weight="1" android:layout_weight="1"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_tempbasal_label" android:text="@string/tempbasal_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -165,7 +165,7 @@
android:layout_weight="1" android:layout_weight="1"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_battery_label" android:text="@string/battery_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
@ -210,7 +210,7 @@
android:layout_weight="1" android:layout_weight="1"
android:gravity="end" android:gravity="end"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="@string/pump_reservoir_label" android:text="@string/reservoir_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView

View file

@ -6,7 +6,6 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider
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 info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.danars.encryption.BleEncryption import info.nightscout.androidaps.danars.encryption.BleEncryption
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
@ -34,10 +33,10 @@ class DanaRSMessageHashTableTest : DanaRSTestBase() {
it.constraintChecker = constraintChecker it.constraintChecker = constraintChecker
} }
if (it is DanaRS_Packet_Bolus_Set_Step_Bolus_Start) { if (it is DanaRS_Packet_Bolus_Set_Step_Bolus_Start) {
it.danaRPump = danaRPump it.danaPump = danaPump
} }
if (it is DanaRS_Packet_APS_History_Events) { if (it is DanaRS_Packet_APS_History_Events) {
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -47,7 +46,7 @@ class DanaRSMessageHashTableTest : DanaRSTestBase() {
`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) `when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
val danaRSMessageHashTable = DanaRSMessageHashTable(packetInjector) val danaRSMessageHashTable = DanaRSMessageHashTable(packetInjector)
val forTesting: DanaRS_Packet = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaRPump.CARBS, 0, 0, 0) val forTesting: DanaRS_Packet = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, 0, 0, 0)
val testPacket: DanaRS_Packet = danaRSMessageHashTable.findMessage(forTesting.command) val testPacket: DanaRS_Packet = danaRSMessageHashTable.findMessage(forTesting.command)
Assert.assertEquals(BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY.toLong(), testPacket.getOpCode().toLong()) Assert.assertEquals(BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY.toLong(), testPacket.getOpCode().toLong())
} }

View file

@ -4,7 +4,7 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBaseWithProfile import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.db.TemporaryBasal import info.nightscout.androidaps.db.TemporaryBasal
import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.dana.DanaPump
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
@ -24,7 +24,7 @@ open class DanaRSTestBase : TestBaseWithProfile() {
} }
} }
lateinit var danaRPump: DanaRPump lateinit var danaPump: DanaPump
fun createArray(length: Int, fillWith: Byte): ByteArray { fun createArray(length: Int, fillWith: Byte): ByteArray {
val ret = ByteArray(length) val ret = ByteArray(length)
@ -55,6 +55,6 @@ open class DanaRSTestBase : TestBaseWithProfile() {
@Before @Before
fun setup() { fun setup() {
danaRPump = info.nightscout.androidaps.dana.DanaRPump(aapsLogger, sp, injector) danaPump = info.nightscout.androidaps.dana.DanaPump(aapsLogger, sp, injector)
} }
} }

View file

@ -34,7 +34,7 @@ class DanaRS_Packet_APS_History_EventsTest : DanaRSTestBase() {
it.rxBus = rxBus it.rxBus = rxBus
it.resourceHelper = resourceHelper it.resourceHelper = resourceHelper
it.activePlugin = activePlugin it.activePlugin = activePlugin
it.danaRPump = danaRPump it.danaPump = danaPump
it.detailedBolusInfoStorage = detailedBolusInfoStorage it.detailedBolusInfoStorage = detailedBolusInfoStorage
it.sp = sp it.sp = sp
} }

View file

@ -2,7 +2,6 @@ package info.nightscout.androidaps.danars.comm
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.dana.DanaRPump
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
@ -27,23 +26,23 @@ class DanaRS_Packet_APS_Set_Event_HistoryTest : DanaRSTestBase() {
@Test fun runTest() { // test for negative carbs @Test fun runTest() { // test for negative carbs
val now = DateUtil.now() val now = DateUtil.now()
var historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaRPump.CARBS, now, -1, 0) var historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, -1, 0)
var testparams = historyTest.requestParams var testparams = historyTest.requestParams
Assert.assertEquals(0.toByte(), testparams[8]) Assert.assertEquals(0.toByte(), testparams[8])
// 5g carbs // 5g carbs
historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaRPump.CARBS, now, 5, 0) historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 5, 0)
testparams = historyTest.requestParams testparams = historyTest.requestParams
Assert.assertEquals(5.toByte(), testparams[8]) Assert.assertEquals(5.toByte(), testparams[8])
// 150g carbs // 150g carbs
historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaRPump.CARBS, now, 150, 0) historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 150, 0)
testparams = historyTest.requestParams testparams = historyTest.requestParams
Assert.assertEquals(150.toByte(), testparams[8]) Assert.assertEquals(150.toByte(), testparams[8])
// test message generation // test message generation
historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaRPump.CARBS, now, 5, 0) historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, info.nightscout.androidaps.dana.DanaPump.CARBS, now, 5, 0)
testparams = historyTest.requestParams testparams = historyTest.requestParams
Assert.assertEquals(5.toByte(), testparams[8]) Assert.assertEquals(5.toByte(), testparams[8])
Assert.assertEquals(11, testparams.size) Assert.assertEquals(11, testparams.size)
Assert.assertEquals(info.nightscout.androidaps.dana.DanaRPump.CARBS.toByte(), testparams[0]) Assert.assertEquals(info.nightscout.androidaps.dana.DanaPump.CARBS.toByte(), testparams[0])
// test message decoding // test message decoding
historyTest.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte())) historyTest.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))
Assert.assertEquals(false, historyTest.failed) Assert.assertEquals(false, historyTest.failed)

View file

@ -19,7 +19,7 @@ class DanaRS_Packet_Basal_Get_Basal_RateTest : DanaRSTestBase() {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.rxBus = rxBus it.rxBus = rxBus
it.resourceHelper = resourceHelper it.resourceHelper = resourceHelper
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -32,8 +32,8 @@ class DanaRS_Packet_Basal_Get_Basal_RateTest : DanaRSTestBase() {
putIntToArray(array, 0, (1.0 * 100).toInt()) putIntToArray(array, 0, (1.0 * 100).toInt())
putByteToArray(array, 2, (0.05 * 100).toByte()) putByteToArray(array, 2, (0.05 * 100).toByte())
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertEquals(1.0, danaRPump.maxBasal, 0.0) Assert.assertEquals(1.0, danaPump.maxBasal, 0.0)
Assert.assertEquals(0.05, danaRPump.basalStep, 0.0) Assert.assertEquals(0.05, danaPump.basalStep, 0.0)
Assert.assertTrue(packet.failed) Assert.assertTrue(packet.failed)
Assert.assertEquals("BASAL__GET_BASAL_RATE", packet.friendlyName) Assert.assertEquals("BASAL__GET_BASAL_RATE", packet.friendlyName)
} }

View file

@ -14,7 +14,7 @@ class DanaRS_Packet_Basal_Get_Profile_Basal_RateTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Basal_Get_Profile_Basal_Rate) { if (it is DanaRS_Packet_Basal_Get_Profile_Basal_Rate) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -30,15 +30,15 @@ class DanaRS_Packet_Basal_Get_Profile_Basal_RateTest : DanaRSTestBase() {
val params = testPacket.requestParams val params = testPacket.requestParams
assertEquals(1.toByte(), params[0]) assertEquals(1.toByte(), params[0])
testPacket.handleMessage(createArray(50, 0.toByte())) testPacket.handleMessage(createArray(50, 0.toByte()))
assertEquals(0.0, danaRPump.pumpProfiles!![1][1], 0.0) assertEquals(0.0, danaPump.pumpProfiles!![1][1], 0.0)
testPacket.handleMessage(createArray(50, 1.toByte())) testPacket.handleMessage(createArray(50, 1.toByte()))
assertEquals(basal01, danaRPump.pumpProfiles!![1][2], 0.0) assertEquals(basal01, danaPump.pumpProfiles!![1][2], 0.0)
testPacket.handleMessage(createArray(50, 5.toByte())) testPacket.handleMessage(createArray(50, 5.toByte()))
assertEquals(basal05, danaRPump.pumpProfiles!![1][1], 0.0) assertEquals(basal05, danaPump.pumpProfiles!![1][1], 0.0)
testPacket.handleMessage(createArray(50, 12.toByte())) testPacket.handleMessage(createArray(50, 12.toByte()))
assertEquals(basal12, danaRPump.pumpProfiles!![1][1], 0.0) assertEquals(basal12, danaPump.pumpProfiles!![1][1], 0.0)
testPacket.handleMessage(createArray(50, 120.toByte())) testPacket.handleMessage(createArray(50, 120.toByte()))
assertEquals(basal120, danaRPump.pumpProfiles!![1][1], 0.0) assertEquals(basal120, danaPump.pumpProfiles!![1][1], 0.0)
assertEquals("BASAL__GET_PROFILE_BASAL_RATE", testPacket.friendlyName) assertEquals("BASAL__GET_PROFILE_BASAL_RATE", testPacket.friendlyName)
} }
} }

View file

@ -16,7 +16,7 @@ class DanaRS_Packet_Basal_Get_Profile_NumberTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Basal_Get_Profile_Number) { if (it is DanaRS_Packet_Basal_Get_Profile_Number) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -27,7 +27,7 @@ class DanaRS_Packet_Basal_Get_Profile_NumberTest : DanaRSTestBase() {
val array = ByteArray(100) val array = ByteArray(100)
putByteToArray(array, 0, 1.toByte()) putByteToArray(array, 0, 1.toByte())
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertEquals(1, danaRPump.activeProfile) Assert.assertEquals(1, danaPump.activeProfile)
Assert.assertEquals("BASAL__GET_PROFILE_NUMBER", packet.friendlyName) Assert.assertEquals("BASAL__GET_PROFILE_NUMBER", packet.friendlyName)
} }
} }

View file

@ -19,7 +19,7 @@ class DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest : DanaRSTestBase() {
it.dateUtil = dateUtil it.dateUtil = dateUtil
} }
if (it is DanaRS_Packet_Basal_Get_Temporary_Basal_State) { if (it is DanaRS_Packet_Basal_Get_Temporary_Basal_State) {
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -35,9 +35,9 @@ class DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest : DanaRSTestBase() {
putIntToArray(array, 4, 1) putIntToArray(array, 4, 1)
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertTrue(packet.failed) Assert.assertTrue(packet.failed)
Assert.assertTrue(danaRPump.isTempBasalInProgress) Assert.assertTrue(danaPump.isTempBasalInProgress)
Assert.assertEquals(300, danaRPump.tempBasalPercent) Assert.assertEquals(300, danaPump.tempBasalPercent)
Assert.assertEquals(15 * 60, danaRPump.tempBasalTotalSec) Assert.assertEquals(15 * 60, danaPump.tempBasalTotalSec)
Assert.assertEquals("BASAL__TEMPORARY_BASAL_STATE", packet.friendlyName) Assert.assertEquals("BASAL__TEMPORARY_BASAL_STATE", packet.friendlyName)
} }
} }

View file

@ -19,7 +19,7 @@ class DanaRS_Packet_Bolus_Get_Bolus_OptionTest : DanaRSTestBase() {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.rxBus = rxBus it.rxBus = rxBus
it.resourceHelper = resourceHelper it.resourceHelper = resourceHelper
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -31,13 +31,13 @@ class DanaRS_Packet_Bolus_Get_Bolus_OptionTest : DanaRSTestBase() {
packet.handleMessage(createArray(21, 1.toByte())) packet.handleMessage(createArray(21, 1.toByte()))
Assert.assertEquals(false, packet.failed) Assert.assertEquals(false, packet.failed)
//Are options saved to pump //Are options saved to pump
Assert.assertEquals(false, !danaRPump.isExtendedBolusEnabled) Assert.assertEquals(false, !danaPump.isExtendedBolusEnabled)
Assert.assertEquals(1, danaRPump.bolusCalculationOption) Assert.assertEquals(1, danaPump.bolusCalculationOption)
Assert.assertEquals(1, danaRPump.missedBolusConfig) Assert.assertEquals(1, danaPump.missedBolusConfig)
packet.handleMessage(createArray(21, 0.toByte())) packet.handleMessage(createArray(21, 0.toByte()))
Assert.assertEquals(true, packet.failed) Assert.assertEquals(true, packet.failed)
//Are options saved to pump //Are options saved to pump
Assert.assertEquals(true, !danaRPump.isExtendedBolusEnabled) Assert.assertEquals(true, !danaPump.isExtendedBolusEnabled)
Assert.assertEquals("BOLUS__GET_BOLUS_OPTION", packet.friendlyName) Assert.assertEquals("BOLUS__GET_BOLUS_OPTION", packet.friendlyName)
} }
} }

View file

@ -2,7 +2,6 @@ package info.nightscout.androidaps.danars.comm
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.dana.DanaRPump
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
@ -15,7 +14,7 @@ class DanaRS_Packet_Bolus_Get_CIR_CF_ArrayTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_CIR_CF_Array) { if (it is DanaRS_Packet_Bolus_Get_CIR_CF_Array) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -27,7 +26,7 @@ class DanaRS_Packet_Bolus_Get_CIR_CF_ArrayTest : DanaRSTestBase() {
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 0.toByte())) packet.handleMessage(createArray(34, 0.toByte()))
// are pump units MG/DL ??? // are pump units MG/DL ???
Assert.assertEquals(info.nightscout.androidaps.dana.DanaRPump.UNITS_MGDL, danaRPump.units) Assert.assertEquals(info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL, danaPump.units)
Assert.assertEquals(false, packet.failed) Assert.assertEquals(false, packet.failed)
packet.handleMessage(createArray(34, 3.toByte())) packet.handleMessage(createArray(34, 3.toByte()))
Assert.assertEquals(true, packet.failed) Assert.assertEquals(true, packet.failed)

View file

@ -16,7 +16,7 @@ class DanaRS_Packet_Bolus_Get_Calculation_InformationTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Calculation_Information) { if (it is DanaRS_Packet_Bolus_Get_Calculation_Information) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }

View file

@ -16,7 +16,7 @@ class DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest : DanaRST
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information) { if (it is DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }

View file

@ -14,7 +14,7 @@ class DanaRS_Packet_Bolus_Get_Dual_BolusTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Dual_Bolus) { if (it is DanaRS_Packet_Bolus_Get_Dual_Bolus) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -31,9 +31,9 @@ class DanaRS_Packet_Bolus_Get_Dual_BolusTest : DanaRSTestBase() {
putIntToArray(array, 5, (40.0 * 100).toInt()) putIntToArray(array, 5, (40.0 * 100).toInt())
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertTrue(packet.failed) Assert.assertTrue(packet.failed)
Assert.assertEquals(1.0, danaRPump.bolusStep, 0.0) Assert.assertEquals(1.0, danaPump.bolusStep, 0.0)
Assert.assertEquals(0.55, danaRPump.extendedBolusAbsoluteRate, 0.0) Assert.assertEquals(0.55, danaPump.extendedBolusAbsoluteRate, 0.0)
Assert.assertEquals(40.0, danaRPump.maxBolus, 0.0) Assert.assertEquals(40.0, danaPump.maxBolus, 0.0)
Assert.assertEquals("BOLUS__GET_DUAL_BOLUS", packet.friendlyName) Assert.assertEquals("BOLUS__GET_DUAL_BOLUS", packet.friendlyName)
} }

View file

@ -16,7 +16,7 @@ class DanaRS_Packet_Bolus_Get_Extended_BolusTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Extended_Bolus) { if (it is DanaRS_Packet_Bolus_Get_Extended_Bolus) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -32,7 +32,7 @@ class DanaRS_Packet_Bolus_Get_Extended_BolusTest : DanaRSTestBase() {
testValue = 1.0 testValue = 1.0
packet.handleMessage(createArray(10, testValue.toByte())) packet.handleMessage(createArray(10, testValue.toByte()))
// is pump.bolustep set to 1 // is pump.bolustep set to 1
Assert.assertEquals(testValue / 100.0, danaRPump.bolusStep, 0.0) Assert.assertEquals(testValue / 100.0, danaPump.bolusStep, 0.0)
Assert.assertEquals(testValue != 0.0, packet.failed) Assert.assertEquals(testValue != 0.0, packet.failed)
Assert.assertEquals("BOLUS__GET_EXTENDED_BOLUS", packet.friendlyName) Assert.assertEquals("BOLUS__GET_EXTENDED_BOLUS", packet.friendlyName)
} }

View file

@ -16,7 +16,7 @@ class DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Extended_Bolus_State) { if (it is DanaRS_Packet_Bolus_Get_Extended_Bolus_State) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -32,7 +32,7 @@ class DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest : DanaRSTestBase() {
testValue = 1.0 testValue = 1.0
packet.handleMessage(createArray(11, testValue.toByte())) packet.handleMessage(createArray(11, testValue.toByte()))
// is extended bolus in progress // is extended bolus in progress
Assert.assertEquals(testValue == 1.0, danaRPump.isExtendedInProgress) Assert.assertEquals(testValue == 1.0, danaPump.isExtendedInProgress)
Assert.assertEquals(testValue != 0.0, packet.failed) Assert.assertEquals(testValue != 0.0, packet.failed)
Assert.assertEquals("BOLUS__GET_EXTENDED_BOLUS_STATE", packet.friendlyName) Assert.assertEquals("BOLUS__GET_EXTENDED_BOLUS_STATE", packet.friendlyName)
} }

View file

@ -14,7 +14,7 @@ class DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest : DanaRSTestBase()
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State) { if (it is DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -25,10 +25,10 @@ class DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest : DanaRSTestBase()
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 0.toByte())) packet.handleMessage(createArray(34, 0.toByte()))
// isExtendedinprogres should be false // isExtendedinprogres should be false
Assert.assertEquals(false, danaRPump.isExtendedInProgress) Assert.assertEquals(false, danaPump.isExtendedInProgress)
// assertEquals(false, packet.failed); // assertEquals(false, packet.failed);
packet.handleMessage(createArray(34, 1.toByte())) packet.handleMessage(createArray(34, 1.toByte()))
Assert.assertEquals(true, danaRPump.isExtendedInProgress) Assert.assertEquals(true, danaPump.isExtendedInProgress)
Assert.assertEquals("BOLUS__GET_EXTENDED_MENU_OPTION_STATE", packet.friendlyName) Assert.assertEquals("BOLUS__GET_EXTENDED_MENU_OPTION_STATE", packet.friendlyName)
} }
} }

View file

@ -20,7 +20,7 @@ class DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest : DanaRSTestBase() {
it.dateUtil = dateUtil it.dateUtil = dateUtil
} }
if (it is DanaRS_Packet_Bolus_Get_Step_Bolus_Information) { if (it is DanaRS_Packet_Bolus_Get_Step_Bolus_Information) {
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -40,13 +40,13 @@ class DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest : DanaRSTestBase() {
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertTrue(packet.failed) Assert.assertTrue(packet.failed)
Assert.assertEquals(6.0, danaRPump.initialBolusAmount, 0.01) Assert.assertEquals(6.0, danaPump.initialBolusAmount, 0.01)
val lastBolus = Date(danaRPump.lastBolusTime) val lastBolus = Date(danaPump.lastBolusTime)
Assert.assertEquals(13, lastBolus.hours) Assert.assertEquals(13, lastBolus.hours)
Assert.assertEquals(20, lastBolus.minutes) Assert.assertEquals(20, lastBolus.minutes)
Assert.assertEquals(12.5, danaRPump.lastBolusAmount, 0.01) Assert.assertEquals(12.5, danaPump.lastBolusAmount, 0.01)
Assert.assertEquals(25.0, danaRPump.maxBolus, 0.01) Assert.assertEquals(25.0, danaPump.maxBolus, 0.01)
Assert.assertEquals(1.0, danaRPump.bolusStep, 0.01) Assert.assertEquals(1.0, danaPump.bolusStep, 0.01)
Assert.assertEquals("BOLUS__GET_STEP_BOLUS_INFORMATION", packet.friendlyName) Assert.assertEquals("BOLUS__GET_STEP_BOLUS_INFORMATION", packet.friendlyName)
} }
} }

View file

@ -33,7 +33,7 @@ class DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Bolus_Set_Step_Bolus_Start) { if (it is DanaRS_Packet_Bolus_Set_Step_Bolus_Start) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
it.constraintChecker = constraintChecker it.constraintChecker = constraintChecker
} }
} }
@ -55,7 +55,7 @@ class DanaRS_Packet_Bolus_Set_Step_Bolus_StartTest : DanaRSTestBase() {
@Before @Before
fun mock() { fun mock() {
danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil, Config()) danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil, Config())
Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
} }
} }

View file

@ -27,7 +27,7 @@ class DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest : DanaRSTestBase() {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.rxBus = rxBus it.rxBus = rxBus
it.resourceHelper = resourceHelper it.resourceHelper = resourceHelper
it.danaRPump = danaRPump it.danaPump = danaPump
} }
if (it is Treatment) { if (it is Treatment) {
it.defaultValueHelper = defaultValueHelper it.defaultValueHelper = defaultValueHelper
@ -41,7 +41,7 @@ class DanaRS_Packet_Bolus_Set_Step_Bolus_StopTest : DanaRSTestBase() {
@Test fun runTest() { @Test fun runTest() {
`when`(resourceHelper.gs(Mockito.anyInt())).thenReturn("SomeString") `when`(resourceHelper.gs(Mockito.anyInt())).thenReturn("SomeString")
danaRPump.bolusingTreatment = Treatment(packetInjector) danaPump.bolusingTreatment = Treatment(packetInjector)
val testPacket = DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(packetInjector) val testPacket = DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(packetInjector)
// test message decoding // test message decoding
testPacket.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte())) testPacket.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))

View file

@ -18,7 +18,7 @@ class DanaRS_Packet_General_Get_More_InformationTest : DanaRSTestBase() {
it.dateUtil = dateUtil it.dateUtil = dateUtil
} }
if (it is DanaRS_Packet_General_Get_More_Information) { if (it is DanaRS_Packet_General_Get_More_Information) {
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -41,14 +41,14 @@ class DanaRS_Packet_General_Get_More_InformationTest : DanaRSTestBase() {
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertFalse(packet.failed) Assert.assertFalse(packet.failed)
Assert.assertEquals(6.0, danaRPump.iob, 0.01) Assert.assertEquals(6.0, danaPump.iob, 0.01)
Assert.assertEquals(12.5, danaRPump.dailyTotalUnits, 0.01) Assert.assertEquals(12.5, danaPump.dailyTotalUnits, 0.01)
Assert.assertTrue(danaRPump.isExtendedInProgress) Assert.assertTrue(danaPump.isExtendedInProgress)
Assert.assertEquals(150, danaRPump.extendedBolusRemainingMinutes) Assert.assertEquals(150, danaPump.extendedBolusRemainingMinutes)
val lastBolus = Date(danaRPump.lastBolusTime) val lastBolus = Date(danaPump.lastBolusTime)
Assert.assertEquals(15, lastBolus.hours) Assert.assertEquals(15, lastBolus.hours)
Assert.assertEquals(25, lastBolus.minutes) Assert.assertEquals(25, lastBolus.minutes)
Assert.assertEquals(1.7, danaRPump.lastBolusAmount, 0.01) Assert.assertEquals(1.7, danaPump.lastBolusAmount, 0.01)
Assert.assertEquals("REVIEW__GET_MORE_INFORMATION", packet.friendlyName) Assert.assertEquals("REVIEW__GET_MORE_INFORMATION", packet.friendlyName)
} }

View file

@ -14,7 +14,7 @@ class DanaRS_Packet_General_Get_PasswordTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_General_Get_Password) { if (it is DanaRS_Packet_General_Get_Password) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }

View file

@ -19,7 +19,7 @@ class DanaRS_Packet_General_Get_Pump_CheckTest : DanaRSTestBase() {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.rxBus = rxBus it.rxBus = rxBus
it.resourceHelper = resourceHelper it.resourceHelper = resourceHelper
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }

View file

@ -17,7 +17,7 @@ class DanaRS_Packet_General_Get_Shipping_InformationTest : DanaRSTestBase() {
it.dateUtil = dateUtil it.dateUtil = dateUtil
} }
if (it is DanaRS_Packet_General_Get_Shipping_Information) { if (it is DanaRS_Packet_General_Get_Shipping_Information) {
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }

View file

@ -14,7 +14,7 @@ class DanaRS_Packet_General_Get_Shipping_VerisonTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_General_Get_Shipping_Version) { if (it is DanaRS_Packet_General_Get_Shipping_Version) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -25,7 +25,7 @@ class DanaRS_Packet_General_Get_Shipping_VerisonTest : DanaRSTestBase() {
val ver = byteArrayOf((-78).toByte(), (-127).toByte(), (66).toByte(), (80).toByte(), (78).toByte(), (45).toByte(), (51).toByte(), (46).toByte(), (48).toByte(), (46).toByte(), (48).toByte()) val ver = byteArrayOf((-78).toByte(), (-127).toByte(), (66).toByte(), (80).toByte(), (78).toByte(), (45).toByte(), (51).toByte(), (46).toByte(), (48).toByte(), (46).toByte(), (48).toByte())
packet.handleMessage(ver) packet.handleMessage(ver)
Assert.assertFalse(packet.failed) Assert.assertFalse(packet.failed)
Assert.assertEquals("BPN-3.0.0", danaRPump.bleModel) Assert.assertEquals("BPN-3.0.0", danaPump.bleModel)
Assert.assertEquals("GENERAL__GET_SHIPPING_VERSION", packet.friendlyName) Assert.assertEquals("GENERAL__GET_SHIPPING_VERSION", packet.friendlyName)
} }
} }

View file

@ -14,7 +14,7 @@ class DanaRS_Packet_General_Get_Today_Delivery_TotalTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_General_Get_Today_Delivery_Total) { if (it is DanaRS_Packet_General_Get_Today_Delivery_Total) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -30,7 +30,7 @@ class DanaRS_Packet_General_Get_Today_Delivery_TotalTest : DanaRSTestBase() {
packet.handleMessage(createArray(18, 0.toByte())) packet.handleMessage(createArray(18, 0.toByte()))
Assert.assertEquals(false, packet.failed) Assert.assertEquals(false, packet.failed)
packet.handleMessage(createArray(15, 1.toByte())) packet.handleMessage(createArray(15, 1.toByte()))
Assert.assertEquals(((1 and 0x000000FF shl 8) + (1 and 0x000000FF)) / 100.0, danaRPump.dailyTotalUnits, 0.0) Assert.assertEquals(((1 and 0x000000FF shl 8) + (1 and 0x000000FF)) / 100.0, danaPump.dailyTotalUnits, 0.0)
Assert.assertEquals("REVIEW__GET_TODAY_DELIVERY_TOTAL", packet.friendlyName) Assert.assertEquals("REVIEW__GET_TODAY_DELIVERY_TOTAL", packet.friendlyName)
} }
} }

View file

@ -14,7 +14,7 @@ class DanaRS_Packet_General_Initial_Screen_InformationTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_General_Initial_Screen_Information) { if (it is DanaRS_Packet_General_Initial_Screen_Information) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -29,7 +29,7 @@ class DanaRS_Packet_General_Initial_Screen_InformationTest : DanaRSTestBase() {
packet = DanaRS_Packet_General_Initial_Screen_Information(packetInjector) packet = DanaRS_Packet_General_Initial_Screen_Information(packetInjector)
packet.handleMessage(createArray(17, 1.toByte())) packet.handleMessage(createArray(17, 1.toByte()))
Assert.assertEquals(false, packet.failed) Assert.assertEquals(false, packet.failed)
Assert.assertEquals(true, danaRPump.pumpSuspended) Assert.assertEquals(true, danaPump.pumpSuspended)
Assert.assertEquals("REVIEW__INITIAL_SCREEN_INFORMATION", packet.friendlyName) Assert.assertEquals("REVIEW__INITIAL_SCREEN_INFORMATION", packet.friendlyName)
} }
} }

View file

@ -29,7 +29,7 @@ class DanaRS_Packet_Notify_Delivery_CompleteTest : DanaRSTestBase() {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.rxBus = rxBus it.rxBus = rxBus
it.resourceHelper = resourceHelper it.resourceHelper = resourceHelper
it.danaRPump = danaRPump it.danaPump = danaPump
} }
if (it is Treatment) { if (it is Treatment) {
it.defaultValueHelper = defaultValueHelper it.defaultValueHelper = defaultValueHelper
@ -43,13 +43,13 @@ class DanaRS_Packet_Notify_Delivery_CompleteTest : DanaRSTestBase() {
@Test fun runTest() { @Test fun runTest() {
`when`(resourceHelper.gs(anyInt(), anyDouble())).thenReturn("SomeString") `when`(resourceHelper.gs(anyInt(), anyDouble())).thenReturn("SomeString")
danaRPump.bolusingTreatment = Treatment(packetInjector) danaPump.bolusingTreatment = Treatment(packetInjector)
val packet = DanaRS_Packet_Notify_Delivery_Complete(packetInjector) val packet = DanaRS_Packet_Notify_Delivery_Complete(packetInjector)
// test params // test params
Assert.assertEquals(null, packet.requestParams) Assert.assertEquals(null, packet.requestParams)
// test message decoding // test message decoding
packet.handleMessage(createArray(17, 0.toByte())) packet.handleMessage(createArray(17, 0.toByte()))
Assert.assertEquals(true, danaRPump.bolusDone) Assert.assertEquals(true, danaPump.bolusDone)
Assert.assertEquals("NOTIFY__DELIVERY_COMPLETE", packet.friendlyName) Assert.assertEquals("NOTIFY__DELIVERY_COMPLETE", packet.friendlyName)
} }
} }

View file

@ -39,7 +39,7 @@ class DanaRS_Packet_Notify_Delivery_Rate_DisplayTest : DanaRSTestBase() {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.rxBus = rxBus it.rxBus = rxBus
it.resourceHelper = resourceHelper it.resourceHelper = resourceHelper
it.danaRPump = danaRPump it.danaPump = danaPump
} }
if (it is Treatment) { if (it is Treatment) {
it.defaultValueHelper = defaultValueHelper it.defaultValueHelper = defaultValueHelper
@ -68,7 +68,7 @@ class DanaRS_Packet_Notify_Delivery_Rate_DisplayTest : DanaRSTestBase() {
@Before @Before
fun mock() { fun mock() {
danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil, Config()) danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil, Config())
danaRPump.bolusingTreatment = Treatment(packetInjector) danaPump.bolusingTreatment = Treatment(packetInjector)
} }
} }

View file

@ -18,7 +18,7 @@ class DanaRS_Packet_Option_Get_Pump_TimeTest : DanaRSTestBase() {
it.dateUtil = dateUtil it.dateUtil = dateUtil
} }
if (it is DanaRS_Packet_Option_Get_Pump_Time) { if (it is DanaRS_Packet_Option_Get_Pump_Time) {
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -34,7 +34,7 @@ class DanaRS_Packet_Option_Get_Pump_TimeTest : DanaRSTestBase() {
putByteToArray(array, 5, 35) // second 35 putByteToArray(array, 5, 35) // second 35
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertEquals(DateTime(2019, 2, 4, 20, 11, 35).millis, danaRPump.pumpTime) Assert.assertEquals(DateTime(2019, 2, 4, 20, 11, 35).millis, danaPump.pumpTime)
Assert.assertEquals("OPTION__GET_PUMP_TIME", packet.friendlyName) Assert.assertEquals("OPTION__GET_PUMP_TIME", packet.friendlyName)
} }
} }

View file

@ -14,7 +14,7 @@ class DanaRS_Packet_Option_Get_User_OptionTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Option_Get_User_Option) { if (it is DanaRS_Packet_Option_Get_User_Option) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -28,7 +28,7 @@ class DanaRS_Packet_Option_Get_User_OptionTest : DanaRSTestBase() {
Assert.assertEquals(true, packet.failed) Assert.assertEquals(true, packet.failed)
// everything ok :) // everything ok :)
packet.handleMessage(createArray(20, 5.toByte())) packet.handleMessage(createArray(20, 5.toByte()))
Assert.assertEquals(5, danaRPump.lcdOnTimeSec) Assert.assertEquals(5, danaPump.lcdOnTimeSec)
Assert.assertEquals(false, packet.failed) Assert.assertEquals(false, packet.failed)
Assert.assertEquals("OPTION__GET_USER_OPTION", packet.friendlyName) Assert.assertEquals("OPTION__GET_USER_OPTION", packet.friendlyName)
} }

View file

@ -14,7 +14,7 @@ class DanaRS_Packet_Option_Set_User_OptionTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Option_Set_User_Option) { if (it is DanaRS_Packet_Option_Set_User_Option) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -23,7 +23,7 @@ class DanaRS_Packet_Option_Set_User_OptionTest : DanaRSTestBase() {
val packet = DanaRS_Packet_Option_Set_User_Option(packetInjector) val packet = DanaRS_Packet_Option_Set_User_Option(packetInjector)
// test params // test params
val params = packet.requestParams val params = packet.requestParams
Assert.assertEquals((danaRPump.lcdOnTimeSec and 0xff).toByte(), params[3]) Assert.assertEquals((danaPump.lcdOnTimeSec and 0xff).toByte(), params[3])
// test message decoding // test message decoding
packet.handleMessage(createArray(3, 0.toByte())) packet.handleMessage(createArray(3, 0.toByte()))
Assert.assertEquals(false, packet.failed) Assert.assertEquals(false, packet.failed)

View file

@ -14,7 +14,7 @@ class DanaRS_Packet_Review_Get_Pump_Dec_RatioTest : DanaRSTestBase() {
AndroidInjector { AndroidInjector {
if (it is DanaRS_Packet_Review_Get_Pump_Dec_Ratio) { if (it is DanaRS_Packet_Review_Get_Pump_Dec_Ratio) {
it.aapsLogger = aapsLogger it.aapsLogger = aapsLogger
it.danaRPump = danaRPump it.danaPump = danaPump
} }
} }
} }
@ -25,7 +25,7 @@ class DanaRS_Packet_Review_Get_Pump_Dec_RatioTest : DanaRSTestBase() {
val array = ByteArray(100) val array = ByteArray(100)
putByteToArray(array, 0, 4.toByte()) putByteToArray(array, 0, 4.toByte())
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertEquals(20, danaRPump.decRatio) Assert.assertEquals(20, danaPump.decRatio)
Assert.assertEquals("REVIEW__GET_PUMP_DEC_RATIO", packet.friendlyName) Assert.assertEquals("REVIEW__GET_PUMP_DEC_RATIO", packet.friendlyName)
} }
} }

View file

@ -7,7 +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.dana.DanaPump
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
@ -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: DanaRPump lateinit var danaPump: DanaPump
lateinit var constraintChecker: ConstraintChecker lateinit var constraintChecker: ConstraintChecker
private lateinit var safetyPlugin: SafetyPlugin private lateinit var safetyPlugin: SafetyPlugin
@ -113,12 +113,12 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
`when`(activePlugin.activePump).thenReturn(virtualPumpPlugin) `when`(activePlugin.activePump).thenReturn(virtualPumpPlugin)
constraintChecker = ConstraintChecker(activePlugin) constraintChecker = ConstraintChecker(activePlugin)
danaRPump = DanaRPump(aapsLogger, sp, injector) danaPump = DanaPump(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, activePlugin, sp, commandQueue, danaRPump, dateUtil, fabricPrivacy) danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, activePlugin, sp, commandQueue, danaPump, 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, danaPump, 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)
openAPSAMAPlugin = OpenAPSAMAPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsPlugin, iobCobCalculatorPlugin, hardLimits, profiler, fabricPrivacy) openAPSAMAPlugin = OpenAPSAMAPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsPlugin, iobCobCalculatorPlugin, hardLimits, profiler, fabricPrivacy)
@ -221,7 +221,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
// DanaR, RS // DanaR, RS
danaRPlugin.setPluginEnabled(PluginType.PUMP, true) danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRSPlugin.setPluginEnabled(PluginType.PUMP, true) danaRSPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPump.maxBasal = 0.8 danaPump.maxBasal = 0.8
// Insight // Insight
// insightPlugin.setPluginEnabled(PluginType.PUMP, true); // insightPlugin.setPluginEnabled(PluginType.PUMP, true);
@ -248,7 +248,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
// DanaR, RS // DanaR, RS
danaRPlugin.setPluginEnabled(PluginType.PUMP, true) danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRSPlugin.setPluginEnabled(PluginType.PUMP, true) danaRSPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPump.maxBasal = 0.8 danaPump.maxBasal = 0.8
// Insight // Insight
// insightPlugin.setPluginEnabled(PluginType.PUMP, true); // insightPlugin.setPluginEnabled(PluginType.PUMP, true);
@ -277,7 +277,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
// DanaR, RS // DanaR, RS
danaRPlugin.setPluginEnabled(PluginType.PUMP, true) danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRSPlugin.setPluginEnabled(PluginType.PUMP, true) danaRSPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPump.maxBolus = 6.0 danaPump.maxBolus = 6.0
// Insight // Insight
// insightPlugin.setPluginEnabled(PluginType.PUMP, true); // insightPlugin.setPluginEnabled(PluginType.PUMP, true);

View file

@ -6,7 +6,7 @@ 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.dana.DanaPump
import info.nightscout.androidaps.danar.DanaRPlugin 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
@ -31,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: DanaRPump lateinit var danaPump: DanaPump
private lateinit var danaRPlugin: DanaRPlugin private lateinit var danaRPlugin: DanaRPlugin
@ -45,15 +45,15 @@ class DanaRPluginTest : 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) danaPump = info.nightscout.androidaps.dana.DanaPump(aapsLogger, sp, injector)
danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, danaRPump, dateUtil, fabricPrivacy) danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy)
} }
@Test @Throws(Exception::class) @Test @Throws(Exception::class)
fun basalRateShouldBeLimited() { fun basalRateShouldBeLimited() {
danaRPlugin.setPluginEnabled(PluginType.PUMP, true) danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPlugin.setPluginEnabled(PluginType.PUMP, true) danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPump.maxBasal = 0.8 danaPump.maxBasal = 0.8
val c = Constraint(Constants.REALLYHIGHBASALRATE) val c = Constraint(Constants.REALLYHIGHBASALRATE)
danaRPlugin.applyBasalConstraints(c, validProfile) danaRPlugin.applyBasalConstraints(c, validProfile)
Assert.assertEquals(0.8, c.value(), 0.01) Assert.assertEquals(0.8, c.value(), 0.01)
@ -65,7 +65,7 @@ class DanaRPluginTest : TestBaseWithProfile() {
fun percentBasalRateShouldBeLimited() { fun percentBasalRateShouldBeLimited() {
danaRPlugin.setPluginEnabled(PluginType.PUMP, true) danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPlugin.setPluginEnabled(PluginType.PUMP, true) danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPump.maxBasal = 0.8 danaPump.maxBasal = 0.8
val c = Constraint(Constants.REALLYHIGHPERCENTBASALRATE) val c = Constraint(Constants.REALLYHIGHPERCENTBASALRATE)
danaRPlugin.applyBasalPercentConstraints(c, validProfile) danaRPlugin.applyBasalPercentConstraints(c, validProfile)
Assert.assertEquals(200, c.value()) Assert.assertEquals(200, c.value())

View file

@ -6,7 +6,7 @@ import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.db.TemporaryBasal 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.DanaPump
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
import info.nightscout.androidaps.interfaces.TreatmentsInterface import info.nightscout.androidaps.interfaces.TreatmentsInterface
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
@ -40,7 +40,7 @@ open class DanaRTestBase : TestBase() {
} }
} }
lateinit var danaRPump: DanaRPump lateinit var danaPump: DanaPump
fun createArray(length: Int, fillWith: Byte): ByteArray { fun createArray(length: Int, fillWith: Byte): ByteArray {
val ret = ByteArray(length) val ret = ByteArray(length)
@ -71,6 +71,6 @@ open class DanaRTestBase : TestBase() {
@Before @Before
fun setup() { fun setup() {
danaRPump = info.nightscout.androidaps.dana.DanaRPump(aapsLogger, sp, injector) danaPump = info.nightscout.androidaps.dana.DanaPump(aapsLogger, sp, injector)
} }
} }

View file

@ -39,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, databaseHelper, dateUtil) val messageHashTable = MessageHashTableR(aapsLogger, rxBus, resourceHelper, constraintChecker, danaPump, 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

@ -23,14 +23,14 @@ class MsgBolusProgressTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
`when`(resourceHelper.gs(ArgumentMatchers.eq(R.string.bolusdelivering), ArgumentMatchers.anyDouble())).thenReturn("Delivering %1\$.2fU") `when`(resourceHelper.gs(ArgumentMatchers.eq(R.string.bolusdelivering), ArgumentMatchers.anyDouble())).thenReturn("Delivering %1\$.2fU")
danaRPump.bolusingTreatment = Treatment(HasAndroidInjector { AndroidInjector { } }) danaPump.bolusingTreatment = Treatment(HasAndroidInjector { AndroidInjector { } })
danaRPump.bolusAmountToBeDelivered = 3.0 danaPump.bolusAmountToBeDelivered = 3.0
val packet = MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaRPump) val packet = MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaPump)
// test message decoding // test message decoding
val array = ByteArray(100) val array = ByteArray(100)
putIntToArray(array, 0, 2 * 100) putIntToArray(array, 0, 2 * 100)
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertEquals(1.0, danaRPump.bolusingTreatment?.insulin!!, 0.0) Assert.assertEquals(1.0, danaPump.bolusingTreatment?.insulin!!, 0.0)
} }
} }

View file

@ -19,7 +19,7 @@ class MsgBolusStartTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
`when`(constraintChecker.applyBolusConstraints(Constraint(anyObject()))).thenReturn(Constraint(0.0)) `when`(constraintChecker.applyBolusConstraints(Constraint(anyObject()))).thenReturn(Constraint(0.0))
val packet = MsgBolusStart(aapsLogger, constraintChecker, danaRPump, 1.0) val packet = MsgBolusStart(aapsLogger, constraintChecker, danaPump, 1.0)
// test message decoding // test message decoding
val array = ByteArray(100) val array = ByteArray(100)

View file

@ -19,7 +19,7 @@ class MsgBolusStartWithSpeedTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
Mockito.`when`(constraintChecker.applyBolusConstraints(Constraint(anyObject()))).thenReturn(Constraint(0.0)) Mockito.`when`(constraintChecker.applyBolusConstraints(Constraint(anyObject()))).thenReturn(Constraint(0.0))
val packet = MsgBolusStartWithSpeed(aapsLogger, constraintChecker, danaRPump, 0.0, 0) val packet = MsgBolusStartWithSpeed(aapsLogger, constraintChecker, danaPump, 0.0, 0)
// test message decoding // test message decoding
val array = ByteArray(100) val array = ByteArray(100)

View file

@ -22,11 +22,11 @@ class MsgBolusStopTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
`when`(resourceHelper.gs(R.string.overview_bolusprogress_delivered)).thenReturn("Delivered") `when`(resourceHelper.gs(R.string.overview_bolusprogress_delivered)).thenReturn("Delivered")
danaRPump.bolusingTreatment = Treatment(HasAndroidInjector { AndroidInjector { } }) danaPump.bolusingTreatment = Treatment(HasAndroidInjector { AndroidInjector { } })
val packet = MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaRPump) val packet = MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaPump)
// test message decoding // test message decoding
packet.handleMessage(ByteArray(100)) packet.handleMessage(ByteArray(100))
Assert.assertEquals(true, danaRPump.bolusStopped) Assert.assertEquals(true, danaPump.bolusStopped)
} }
} }

View file

@ -14,12 +14,12 @@ class MsgCheckValueTest : DanaRTestBase() {
@Mock lateinit var danaRPlugin: DanaRPlugin @Mock lateinit var danaRPlugin: DanaRPlugin
@Test fun runTest() { @Test fun runTest() {
val packet = MsgCheckValue(aapsLogger, danaRPump, danaRPlugin) val packet = MsgCheckValue(aapsLogger, danaPump, danaRPlugin)
// test message decoding // test message decoding
val array = ByteArray(100) val array = ByteArray(100)
putByteToArray(array, 0, info.nightscout.androidaps.dana.DanaRPump.EXPORT_MODEL.toByte()) putByteToArray(array, 0, info.nightscout.androidaps.dana.DanaPump.EXPORT_MODEL.toByte())
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertEquals(info.nightscout.androidaps.dana.DanaRPump.EXPORT_MODEL, danaRPump.hwModel) Assert.assertEquals(info.nightscout.androidaps.dana.DanaPump.EXPORT_MODEL, danaPump.hwModel)
} }
} }

View file

@ -22,7 +22,7 @@ class MsgErrorTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
PowerMockito.mockStatic(NSUpload::class.java) PowerMockito.mockStatic(NSUpload::class.java)
val packet = MsgError(aapsLogger, rxBus, resourceHelper, danaRPump, nsUpload) val packet = MsgError(aapsLogger, rxBus, resourceHelper, danaPump, nsUpload)
// test message decoding // test message decoding
val array = ByteArray(100) val array = ByteArray(100)

View file

@ -10,10 +10,10 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistoryAllDoneTest : DanaRTestBase() { class MsgHistoryAllDoneTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryAllDone(aapsLogger, danaRPump) val packet = MsgHistoryAllDone(aapsLogger, danaPump)
// test message decoding // test message decoding
packet.handleMessage(ByteArray(0)) packet.handleMessage(ByteArray(0))
Assert.assertEquals(true, danaRPump.historyDoneReceived) Assert.assertEquals(true, danaPump.historyDoneReceived)
} }
} }

View file

@ -9,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistoryDoneTest : DanaRTestBase() { class MsgHistoryDoneTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryDone(aapsLogger, danaRPump) val packet = MsgHistoryDone(aapsLogger, danaPump)
// nothing left to test // nothing left to test
} }
} }

View file

@ -9,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgHistoryNewDoneTest : DanaRTestBase() { class MsgHistoryNewDoneTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgHistoryNewDone(aapsLogger, danaRPump) val packet = MsgHistoryNewDone(aapsLogger, danaPump)
// nothing left to test // nothing left to test
} }
} }

View file

@ -10,13 +10,13 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgInitConnStatusBasicTest : DanaRTestBase() { class MsgInitConnStatusBasicTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgInitConnStatusBasic(aapsLogger, danaRPump) val packet = MsgInitConnStatusBasic(aapsLogger, danaPump)
// test message decoding // test message decoding
val array = ByteArray(100) val array = ByteArray(100)
putByteToArray(array, 0, 1) putByteToArray(array, 0, 1)
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertEquals(true, danaRPump.pumpSuspended) Assert.assertEquals(true, danaPump.pumpSuspended)
} }
} }

View file

@ -15,7 +15,7 @@ class MsgInitConnStatusBolusTest : DanaRTestBase() {
@Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var resourceHelper: ResourceHelper
@Test fun runTest() { @Test fun runTest() {
val packet = MsgInitConnStatusBolus(aapsLogger, RxBusWrapper(), resourceHelper, danaRPump) val packet = MsgInitConnStatusBolus(aapsLogger, RxBusWrapper(), resourceHelper, danaPump)
// test message decoding // test message decoding
var array = ByteArray(100) var array = ByteArray(100)
@ -26,6 +26,6 @@ class MsgInitConnStatusBolusTest : DanaRTestBase() {
array = ByteArray(20) array = ByteArray(20)
putByteToArray(array, 0, 1) putByteToArray(array, 0, 1)
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertEquals(true, danaRPump.isExtendedBolusEnabled) Assert.assertEquals(true, danaPump.isExtendedBolusEnabled)
} }
} }

View file

@ -23,13 +23,13 @@ class MsgInitConnStatusOptionTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
`when`(activePlugin.activePump).thenReturn(PowerMockito.mock(VirtualPumpPlugin::class.java)) `when`(activePlugin.activePump).thenReturn(PowerMockito.mock(VirtualPumpPlugin::class.java))
val packet = MsgInitConnStatusOption(aapsLogger, RxBusWrapper(), resourceHelper, danaRPump, activePlugin) val packet = MsgInitConnStatusOption(aapsLogger, RxBusWrapper(), resourceHelper, danaPump, activePlugin)
// test message decoding // test message decoding
packet.handleMessage(createArray(20, 1.toByte())) packet.handleMessage(createArray(20, 1.toByte()))
Assert.assertEquals(true, packet.failed) Assert.assertEquals(true, packet.failed)
// message smaller than 21 // message smaller than 21
packet.handleMessage(createArray(22, 1.toByte())) packet.handleMessage(createArray(22, 1.toByte()))
Assert.assertEquals(false, danaRPump.isPasswordOK) Assert.assertEquals(false, danaPump.isPasswordOK)
} }
} }

View file

@ -25,7 +25,7 @@ class MsgInitConnStatusTimeTest : DanaRTestBase() {
@Mock lateinit var commandQueue: CommandQueueProvider @Mock lateinit var commandQueue: CommandQueueProvider
@Test fun runTest() { @Test fun runTest() {
val packet = MsgInitConnStatusTime(aapsLogger, RxBusWrapper(), resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil) val packet = MsgInitConnStatusTime(aapsLogger, RxBusWrapper(), resourceHelper, danaPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil)
// test message decoding // test message decoding
packet.handleMessage(createArray(20, 1.toByte())) packet.handleMessage(createArray(20, 1.toByte()))

View file

@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgSetUserOptionsTest : DanaRTestBase() { class MsgSetUserOptionsTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSetUserOptions(aapsLogger, danaRPump) val packet = MsgSetUserOptions(aapsLogger, danaPump)
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 7.toByte())) packet.handleMessage(createArray(34, 7.toByte()))
Assert.assertEquals(true, packet.failed) Assert.assertEquals(true, packet.failed)

View file

@ -11,10 +11,10 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgSettingActiveProfileTest : DanaRTestBase() { class MsgSettingActiveProfileTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSettingActiveProfile(aapsLogger, danaRPump) val packet = MsgSettingActiveProfile(aapsLogger, danaPump)
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 7.toByte())) packet.handleMessage(createArray(34, 7.toByte()))
Assert.assertEquals(MessageBase.intFromBuff(createArray(34, 7.toByte()), 0, 1), danaRPump.activeProfile) Assert.assertEquals(MessageBase.intFromBuff(createArray(34, 7.toByte()), 0, 1), danaPump.activeProfile)
} }
} }

View file

@ -9,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgSettingBasalProfileAllTest : DanaRTestBase() { class MsgSettingBasalProfileAllTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSettingBasalProfileAll(aapsLogger, danaRPump) val packet = MsgSettingBasalProfileAll(aapsLogger, danaPump)
// test message decoding // test message decoding
packet.handleMessage(createArray(400, 1.toByte())) packet.handleMessage(createArray(400, 1.toByte()))

View file

@ -20,11 +20,11 @@ class MsgSettingBasalTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
`when`(danaRPlugin.getPumpDescription()).thenReturn(PumpDescription()) `when`(danaRPlugin.getPumpDescription()).thenReturn(PumpDescription())
val packet = MsgSettingBasal(aapsLogger, danaRPump, danaRPlugin) val packet = MsgSettingBasal(aapsLogger, danaPump, danaRPlugin)
// test message decoding // test message decoding
packet.handleMessage(createArray(100, 1.toByte())) packet.handleMessage(createArray(100, 1.toByte()))
val expected = MessageBase.intFromBuff(createArray(100, 1.toByte()), 2 * 1, 2) val expected = MessageBase.intFromBuff(createArray(100, 1.toByte()), 2 * 1, 2)
Assert.assertEquals(expected.toDouble() / 100.0, danaRPump.pumpProfiles!![danaRPump.activeProfile][1], 0.0) Assert.assertEquals(expected.toDouble() / 100.0, danaPump.pumpProfiles!![danaPump.activeProfile][1], 0.0)
} }
} }

View file

@ -10,10 +10,10 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgSettingGlucoseTest : DanaRTestBase() { class MsgSettingGlucoseTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSettingGlucose(aapsLogger, danaRPump) val packet = MsgSettingGlucose(aapsLogger, danaPump)
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 1.toByte())) packet.handleMessage(createArray(34, 1.toByte()))
Assert.assertEquals(1, danaRPump.units) Assert.assertEquals(1, danaPump.units)
} }
} }

View file

@ -11,10 +11,10 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgSettingMaxValuesTest : DanaRTestBase() { class MsgSettingMaxValuesTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSettingMaxValues(aapsLogger, danaRPump) val packet = MsgSettingMaxValues(aapsLogger, danaPump)
// 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()), 0, 2).toDouble() / 100.0, danaRPump.maxBolus, 0.0) Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 0, 2).toDouble() / 100.0, danaPump.maxBolus, 0.0)
} }
} }

View file

@ -22,10 +22,10 @@ class MsgSettingMealTest : DanaRTestBase() {
@Mock lateinit var danaRKoreanPlugin: DanaRKoreanPlugin @Mock lateinit var danaRKoreanPlugin: DanaRKoreanPlugin
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSettingMeal(aapsLogger, RxBusWrapper(), resourceHelper, danaRPump, danaRKoreanPlugin) val packet = MsgSettingMeal(aapsLogger, RxBusWrapper(), resourceHelper, danaPump, danaRKoreanPlugin)
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 1.toByte())) packet.handleMessage(createArray(34, 1.toByte()))
Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 1.toByte()), 0, 1).toDouble() / 100.0, danaRPump.bolusStep, 0.0) Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 1.toByte()), 0, 1).toDouble() / 100.0, danaPump.bolusStep, 0.0)
} }
} }

View file

@ -1,6 +1,5 @@
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.danar.comm.MessageBase import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatiosAll import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatiosAll
import org.junit.Assert import org.junit.Assert
@ -12,11 +11,11 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgSettingProfileRatiosAllTest : DanaRTestBase() { class MsgSettingProfileRatiosAllTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSettingProfileRatiosAll(aapsLogger, danaRPump) val packet = MsgSettingProfileRatiosAll(aapsLogger, danaPump)
danaRPump.units = info.nightscout.androidaps.dana.DanaRPump.UNITS_MGDL danaPump.units = info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL
// 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()), 0, 2), danaRPump.morningCIR) Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 0, 2), danaPump.morningCIR)
} }
} }

View file

@ -1,6 +1,5 @@
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.danar.comm.MessageBase import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatios import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatios
import org.junit.Assert import org.junit.Assert
@ -12,10 +11,10 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgSettingProfileRatiosTest : DanaRTestBase() { class MsgSettingProfileRatiosTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSettingProfileRatios(aapsLogger, danaRPump) val packet = MsgSettingProfileRatios(aapsLogger, danaPump)
danaRPump.units = info.nightscout.androidaps.dana.DanaRPump.UNITS_MGDL danaPump.units = info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL
// 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()), 0, 2), danaRPump.currentCIR) Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 0, 2), danaPump.currentCIR)
} }
} }

View file

@ -1,6 +1,5 @@
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.danar.comm.MessageBase import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingPumpTime import info.nightscout.androidaps.danar.comm.MsgSettingPumpTime
import org.junit.Assert import org.junit.Assert
@ -13,8 +12,8 @@ import java.util.*
class MsgSettingPumpTimeTest : DanaRTestBase() { class MsgSettingPumpTimeTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil) val packet = MsgSettingPumpTime(aapsLogger, danaPump, dateUtil)
danaRPump.units = info.nightscout.androidaps.dana.DanaRPump.UNITS_MGDL danaPump.units = info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL
// test message decoding // test message decoding
val bytes = createArray(34, 7.toByte()) val bytes = createArray(34, 7.toByte())
val time = Date( val time = Date(
@ -26,6 +25,6 @@ class MsgSettingPumpTimeTest : DanaRTestBase() {
MessageBase.intFromBuff(bytes, 0, 1) MessageBase.intFromBuff(bytes, 0, 1)
).time ).time
packet.handleMessage(bytes) packet.handleMessage(bytes)
Assert.assertEquals(time, danaRPump.pumpTime) Assert.assertEquals(time, danaPump.pumpTime)
} }
} }

View file

@ -1,6 +1,5 @@
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.danar.comm.MessageBase import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo
import org.junit.Assert import org.junit.Assert
@ -12,10 +11,10 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgSettingShippingInfoTest : DanaRTestBase() { class MsgSettingShippingInfoTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSettingShippingInfo(aapsLogger, danaRPump) val packet = MsgSettingShippingInfo(aapsLogger, danaPump)
danaRPump.units = info.nightscout.androidaps.dana.DanaRPump.UNITS_MGDL danaPump.units = info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 7.toByte())) packet.handleMessage(createArray(34, 7.toByte()))
Assert.assertEquals(MessageBase.stringFromBuff(createArray(34, 7.toByte()), 0, 10), danaRPump.serialNumber) Assert.assertEquals(MessageBase.stringFromBuff(createArray(34, 7.toByte()), 0, 10), danaPump.serialNumber)
} }
} }

View file

@ -1,6 +1,6 @@
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.DanaPump
import info.nightscout.androidaps.danar.comm.MsgSettingUserOptions import info.nightscout.androidaps.danar.comm.MsgSettingUserOptions
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
@ -11,10 +11,10 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgSettingUserOptionsTest : DanaRTestBase() { class MsgSettingUserOptionsTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgSettingUserOptions(aapsLogger, danaRPump) val packet = MsgSettingUserOptions(aapsLogger, danaPump)
danaRPump.units = DanaRPump.UNITS_MGDL danaPump.units = DanaPump.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, danaPump.lcdOnTimeSec)
} }
} }

View file

@ -11,9 +11,9 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgStatusBasicTest : DanaRTestBase() { class MsgStatusBasicTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgStatusBasic(aapsLogger, danaRPump) val packet = MsgStatusBasic(aapsLogger, danaPump)
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 7.toByte())) packet.handleMessage(createArray(34, 7.toByte()))
Assert.assertEquals(MessageBase.intFromBuff(createArray(34, 7.toByte()), 0, 3).toDouble() / 750.0, danaRPump.dailyTotalUnits, 0.0) Assert.assertEquals(MessageBase.intFromBuff(createArray(34, 7.toByte()), 0, 3).toDouble() / 750.0, danaPump.dailyTotalUnits, 0.0)
} }
} }

View file

@ -19,11 +19,11 @@ class MsgStatusBolusExtendedTest : DanaRTestBase() {
@Test @Test
fun runTest() { fun runTest() {
`when`(activePlugin.activeTreatments).thenReturn(treatmentsPlugin) `when`(activePlugin.activeTreatments).thenReturn(treatmentsPlugin)
val packet = MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin, dateUtil) val packet = MsgStatusBolusExtended(injector, aapsLogger, danaPump, activePlugin, dateUtil)
// test message decoding // test message decoding
val array = ByteArray(100) val array = ByteArray(100)
putByteToArray(array, 0, 1) putByteToArray(array, 0, 1)
packet.handleMessage(array) packet.handleMessage(array)
Assert.assertEquals(true, danaRPump.isExtendedInProgress) Assert.assertEquals(true, danaPump.isExtendedInProgress)
} }
} }

View file

@ -1,6 +1,5 @@
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.danar.comm.MessageBase import info.nightscout.androidaps.danar.comm.MessageBase
import info.nightscout.androidaps.danar.comm.MsgStatusProfile import info.nightscout.androidaps.danar.comm.MsgStatusProfile
import org.junit.Assert import org.junit.Assert
@ -12,10 +11,10 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgStatusProfileTest : DanaRTestBase() { class MsgStatusProfileTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgStatusProfile(aapsLogger, danaRPump) val packet = MsgStatusProfile(aapsLogger, danaPump)
danaRPump.units = info.nightscout.androidaps.dana.DanaRPump.UNITS_MGDL danaPump.units = info.nightscout.androidaps.dana.DanaPump.UNITS_MGDL
// 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()), 0, 2), danaRPump.currentCIR) Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 0, 2), danaPump.currentCIR)
} }
} }

View file

@ -21,13 +21,13 @@ class MsgStatusTempBasalTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
`when`(activePlugin.activeTreatments).thenReturn(treatmentsPlugin) `when`(activePlugin.activeTreatments).thenReturn(treatmentsPlugin)
val packet = MsgStatusTempBasal(aapsLogger, danaRPump, activePlugin, injector) val packet = MsgStatusTempBasal(aapsLogger, danaPump, activePlugin, injector)
// test message decoding // test message decoding
// 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, danaPump.isTempBasalInProgress)
// passing an bigger number // passing an bigger number
packet.handleMessage(createArray(34, 2.toByte())) packet.handleMessage(createArray(34, 2.toByte()))
Assert.assertEquals(false, danaRPump.isTempBasalInProgress) Assert.assertEquals(false, danaPump.isTempBasalInProgress)
} }
} }

View file

@ -11,9 +11,9 @@ import org.powermock.modules.junit4.PowerMockRunner
class MsgStatusTest : DanaRTestBase() { class MsgStatusTest : DanaRTestBase() {
@Test fun runTest() { @Test fun runTest() {
val packet = MsgStatus(aapsLogger, danaRPump) val packet = MsgStatus(aapsLogger, danaPump)
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 7.toByte())) packet.handleMessage(createArray(34, 7.toByte()))
Assert.assertEquals(MessageBase.intFromBuff(createArray(34, 7.toByte()), 0, 3).toDouble() / 750.0, danaRPump.dailyTotalUnits, 0.0) Assert.assertEquals(MessageBase.intFromBuff(createArray(34, 7.toByte()), 0, 3).toDouble() / 750.0, danaPump.dailyTotalUnits, 0.0)
} }
} }

View file

@ -6,7 +6,7 @@ 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.dana.DanaPump
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin 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
@ -31,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: DanaRPump lateinit var danaPump: DanaPump
private lateinit var danaRPlugin: DanaRKoreanPlugin private lateinit var danaRPlugin: DanaRKoreanPlugin
@ -45,15 +45,15 @@ 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 = DanaRPump(aapsLogger, sp, injector) danaPump = DanaPump(aapsLogger, sp, injector)
danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, rxBus, danaRPump, context, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, dateUtil, fabricPrivacy) danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, rxBus, danaPump, context, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, dateUtil, fabricPrivacy)
} }
@Test @Throws(Exception::class) @Test @Throws(Exception::class)
fun basalRateShouldBeLimited() { fun basalRateShouldBeLimited() {
danaRPlugin.setPluginEnabled(PluginType.PUMP, true) danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPlugin.setPluginEnabled(PluginType.PUMP, true) danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPump.maxBasal = 0.8 danaPump.maxBasal = 0.8
val c = Constraint(Constants.REALLYHIGHBASALRATE) val c = Constraint(Constants.REALLYHIGHBASALRATE)
danaRPlugin.applyBasalConstraints(c, validProfile) danaRPlugin.applyBasalConstraints(c, validProfile)
Assert.assertEquals(0.8, c.value(), 0.01) Assert.assertEquals(0.8, c.value(), 0.01)
@ -65,7 +65,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() {
fun percentBasalRateShouldBeLimited() { fun percentBasalRateShouldBeLimited() {
danaRPlugin.setPluginEnabled(PluginType.PUMP, true) danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPlugin.setPluginEnabled(PluginType.PUMP, true) danaRPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPump.maxBasal = 0.8 danaPump.maxBasal = 0.8
val c = Constraint(Constants.REALLYHIGHPERCENTBASALRATE) val c = Constraint(Constants.REALLYHIGHPERCENTBASALRATE)
danaRPlugin.applyBasalPercentConstraints(c, validProfile) danaRPlugin.applyBasalPercentConstraints(c, validProfile)
Assert.assertEquals(200, c.value()) Assert.assertEquals(200, c.value())

View file

@ -36,7 +36,7 @@ class MessageHashTableRKoreanTest : DanaRSTestBase() {
@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, databaseHelper, injector) val messageHashTable = MessageHashTableRKorean(aapsLogger, rxBus, resourceHelper, constraintChecker, danaPump, 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

@ -39,7 +39,7 @@ class DanaRSPluginTest : DanaRSTestBase() {
fun basalRateShouldBeLimited() { fun basalRateShouldBeLimited() {
danaRSPlugin.setPluginEnabled(PluginType.PUMP, true) danaRSPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRSPlugin.setPluginEnabled(PluginType.PUMP, true) danaRSPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPump.maxBasal = 0.8 danaPump.maxBasal = 0.8
val c = Constraint(Constants.REALLYHIGHBASALRATE) val c = Constraint(Constants.REALLYHIGHBASALRATE)
danaRSPlugin.applyBasalConstraints(c, validProfile) danaRSPlugin.applyBasalConstraints(c, validProfile)
Assert.assertEquals(java.lang.Double.valueOf(0.8), c.value(), 0.0001) Assert.assertEquals(java.lang.Double.valueOf(0.8), c.value(), 0.0001)
@ -51,7 +51,7 @@ class DanaRSPluginTest : DanaRSTestBase() {
fun percentBasalRateShouldBeLimited() { fun percentBasalRateShouldBeLimited() {
danaRSPlugin.setPluginEnabled(PluginType.PUMP, true) danaRSPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRSPlugin.setPluginEnabled(PluginType.PUMP, true) danaRSPlugin.setPluginEnabled(PluginType.PUMP, true)
danaRPump.maxBasal = 0.8 danaPump.maxBasal = 0.8
val c = Constraint(Constants.REALLYHIGHPERCENTBASALRATE) val c = Constraint(Constants.REALLYHIGHPERCENTBASALRATE)
danaRSPlugin.applyBasalPercentConstraints(c, validProfile) danaRSPlugin.applyBasalPercentConstraints(c, validProfile)
Assert.assertEquals(200, c.value()) Assert.assertEquals(200, c.value())
@ -65,6 +65,6 @@ class DanaRSPluginTest : DanaRSTestBase() {
Mockito.`when`(resourceHelper.gs(eq(R.string.limitingbasalratio), anyObject(), anyObject())).thenReturn("limitingbasalratio") Mockito.`when`(resourceHelper.gs(eq(R.string.limitingbasalratio), anyObject(), anyObject())).thenReturn("limitingbasalratio")
Mockito.`when`(resourceHelper.gs(eq(R.string.limitingpercentrate), anyObject(), anyObject())).thenReturn("limitingpercentrate") Mockito.`when`(resourceHelper.gs(eq(R.string.limitingpercentrate), anyObject(), anyObject())).thenReturn("limitingpercentrate")
danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil, Config()) danaRSPlugin = DanaRSPlugin(HasAndroidInjector { AndroidInjector { Unit } }, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil, Config())
} }
} }

View file

@ -6,7 +6,7 @@ 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.dana.DanaPump
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin 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
@ -31,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: DanaRPump lateinit var danaPump: DanaPump
private lateinit var danaRv2Plugin: DanaRv2Plugin private lateinit var danaRv2Plugin: DanaRv2Plugin
@ -45,15 +45,15 @@ 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 = DanaRPump(aapsLogger, sp, injector) danaPump = DanaPump(aapsLogger, sp, injector)
danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, rxBus, context, danaRPump, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, detailedBolusInfoStorage, dateUtil, fabricPrivacy) danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, rxBus, context, danaPump, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, detailedBolusInfoStorage, dateUtil, fabricPrivacy)
} }
@Test @Test
fun basalRateShouldBeLimited() { fun basalRateShouldBeLimited() {
danaRv2Plugin.setPluginEnabled(PluginType.PUMP, true) danaRv2Plugin.setPluginEnabled(PluginType.PUMP, true)
danaRv2Plugin.setPluginEnabled(PluginType.PUMP, true) danaRv2Plugin.setPluginEnabled(PluginType.PUMP, true)
danaRPump.maxBasal = 0.8 danaPump.maxBasal = 0.8
val c = Constraint(Constants.REALLYHIGHBASALRATE) val c = Constraint(Constants.REALLYHIGHBASALRATE)
danaRv2Plugin.applyBasalConstraints(c, validProfile) danaRv2Plugin.applyBasalConstraints(c, validProfile)
org.junit.Assert.assertEquals(0.8, c.value(), 0.01) org.junit.Assert.assertEquals(0.8, c.value(), 0.01)
@ -65,7 +65,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() {
fun percentBasalRateShouldBeLimited() { fun percentBasalRateShouldBeLimited() {
danaRv2Plugin.setPluginEnabled(PluginType.PUMP, true) danaRv2Plugin.setPluginEnabled(PluginType.PUMP, true)
danaRv2Plugin.setPluginEnabled(PluginType.PUMP, true) danaRv2Plugin.setPluginEnabled(PluginType.PUMP, true)
danaRPump.maxBasal = 0.8 danaPump.maxBasal = 0.8
val c = Constraint(Constants.REALLYHIGHPERCENTBASALRATE) val c = Constraint(Constants.REALLYHIGHPERCENTBASALRATE)
danaRv2Plugin.applyBasalPercentConstraints(c, validProfile) danaRv2Plugin.applyBasalPercentConstraints(c, validProfile)
org.junit.Assert.assertEquals(200, c.value()) org.junit.Assert.assertEquals(200, c.value())

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