RS injection refactor

This commit is contained in:
Milos Kozak 2020-04-29 23:27:48 +02:00
parent 90f08279d3
commit a5108ca4c4
140 changed files with 1396 additions and 646 deletions

View file

@ -74,7 +74,7 @@ import info.nightscout.androidaps.utils.wizard.BolusWizard
import info.nightscout.androidaps.utils.wizard.QuickWizardEntry import info.nightscout.androidaps.utils.wizard.QuickWizardEntry
import javax.inject.Singleton import javax.inject.Singleton
@Module(includes = [AppModule.AppBindings::class, PluginsModule::class]) @Module(includes = [AppModule.AppBindings::class, PluginsModule::class, DanaRSCommModule::class])
open class AppModule { open class AppModule {
@Provides @Provides

View file

@ -0,0 +1,79 @@
package info.nightscout.androidaps.dependencyInjection
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.pump.danaRS.comm.*
@Module
@Suppress("unused")
abstract class DanaRSCommModule {
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet(): DanaRS_Packet
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(): DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Get_Basal_Rate(): DanaRS_Packet_Basal_Get_Basal_Rate
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Get_Profile_Basal_Rate(): DanaRS_Packet_Basal_Get_Profile_Basal_Rate
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Get_Profile_Number(): DanaRS_Packet_Basal_Get_Profile_Number
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Basal_Rate(): DanaRS_Packet_Basal_Set_Basal_Rate
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Profile_Basal_Rate(): DanaRS_Packet_Basal_Set_Profile_Basal_Rate
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Profile_Number(): DanaRS_Packet_Basal_Set_Profile_Number
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Suspend_Off(): DanaRS_Packet_Basal_Set_Suspend_Off
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Suspend_On(): DanaRS_Packet_Basal_Set_Suspend_On
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Set_Temporary_Basal(): DanaRS_Packet_Basal_Set_Temporary_Basal
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Basal_Get_Temporary_Basal_State(): DanaRS_Packet_Basal_Get_Temporary_Basal_State
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Bolus_Option(): DanaRS_Packet_Bolus_Get_Bolus_Option
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Initial_Bolus(): DanaRS_Packet_Bolus_Get_Initial_Bolus
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Calculation_Information(): DanaRS_Packet_Bolus_Get_Calculation_Information
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(): DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_CIR_CF_Array(): DanaRS_Packet_Bolus_Get_CIR_CF_Array
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Dual_Bolus(): DanaRS_Packet_Bolus_Get_Dual_Bolus
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Extended_Bolus(): DanaRS_Packet_Bolus_Get_Extended_Bolus
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Extended_Bolus_State(): DanaRS_Packet_Bolus_Get_Extended_Bolus_State
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(): DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Get_Step_Bolus_Information(): DanaRS_Packet_Bolus_Get_Step_Bolus_Information
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Bolus_Option(): DanaRS_Packet_Bolus_Set_Bolus_Option
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Initial_Bolus(): DanaRS_Packet_Bolus_Set_Initial_Bolus
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_CIR_CF_Array(): DanaRS_Packet_Bolus_Set_CIR_CF_Array
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Dual_Bolus(): DanaRS_Packet_Bolus_Set_Dual_Bolus
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Extended_Bolus(): DanaRS_Packet_Bolus_Set_Extended_Bolus
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(): DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Step_Bolus_Start(): DanaRS_Packet_Bolus_Set_Step_Bolus_Start
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Bolus_Set_Step_Bolus_Stop(): DanaRS_Packet_Bolus_Set_Step_Bolus_Stop
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Etc_Keep_Connection(): DanaRS_Packet_Etc_Keep_Connection
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Etc_Set_History_Save(): DanaRS_Packet_Etc_Set_History_Save
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Delivery_Status(): DanaRS_Packet_General_Delivery_Status
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_Password(): DanaRS_Packet_General_Get_Password
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Initial_Screen_Information(): DanaRS_Packet_General_Initial_Screen_Information
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Notify_Alarm(): DanaRS_Packet_Notify_Alarm
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Notify_Delivery_Complete(): DanaRS_Packet_Notify_Delivery_Complete
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Notify_Delivery_Rate_Display(): DanaRS_Packet_Notify_Delivery_Rate_Display
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Notify_Missed_Bolus_Alarm(): DanaRS_Packet_Notify_Missed_Bolus_Alarm
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Option_Get_Pump_Time(): DanaRS_Packet_Option_Get_Pump_Time
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Option_Get_User_Option(): DanaRS_Packet_Option_Get_User_Option
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Option_Set_Pump_Time(): DanaRS_Packet_Option_Set_Pump_Time
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Option_Set_User_Option(): DanaRS_Packet_Option_Set_User_Option
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_(): DanaRS_Packet_History_
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Alarm(): DanaRS_Packet_History_Alarm
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_All_History(): DanaRS_Packet_History_All_History
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Basal(): DanaRS_Packet_History_Basal
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Blood_Glucose(): DanaRS_Packet_History_Blood_Glucose
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Bolus(): DanaRS_Packet_History_Bolus
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Review_Bolus_Avg(): DanaRS_Packet_Review_Bolus_Avg
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Carbohydrate(): DanaRS_Packet_History_Carbohydrate
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Daily(): DanaRS_Packet_History_Daily
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_More_Information(): DanaRS_Packet_General_Get_More_Information
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_Pump_Check(): DanaRS_Packet_General_Get_Pump_Check
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_Shipping_Information(): DanaRS_Packet_General_Get_Shipping_Information
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_Today_Delivery_Total(): DanaRS_Packet_General_Get_Today_Delivery_Total
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_User_Time_Change_Flag(): DanaRS_Packet_General_Get_User_Time_Change_Flag
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Prime(): DanaRS_Packet_History_Prime
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Refill(): DanaRS_Packet_History_Refill
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Set_History_Upload_Mode(): DanaRS_Packet_General_Set_History_Upload_Mode
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(): DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Suspend(): DanaRS_Packet_History_Suspend
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_History_Temporary(): DanaRS_Packet_History_Temporary
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_APS_Basal_Set_Temporary_Basal(): DanaRS_Packet_APS_Basal_Set_Temporary_Basal
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_APS_History_Events(): DanaRS_Packet_APS_History_Events
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_APS_Set_Event_History(): DanaRS_Packet_APS_Set_Event_History
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_General_Get_Shipping_Version(): DanaRS_Packet_General_Get_Shipping_Version
@ContributesAndroidInjector abstract fun contributesDanaRS_Packet_Review_Get_Pump_Dec_Ratio(): DanaRS_Packet_Review_Get_Pump_Dec_Ratio
}

View file

@ -1,29 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
import java.util.* import java.util.*
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
@Singleton @Singleton
class DanaRSMessageHashTable @Inject constructor( class DanaRSMessageHashTable @Inject constructor(
aapsLogger: AAPSLogger, val injector: HasAndroidInjector
rxBus: RxBusWrapper,
resourceHelper: ResourceHelper,
danaRPump: DanaRPump,
activePlugin: ActivePluginProvider,
constraintChecker: ConstraintChecker,
detailedBolusInfoStorage: DetailedBolusInfoStorage,
sp: SP,
injector: HasAndroidInjector
) { ) {
var messages: HashMap<Int, DanaRS_Packet> = HashMap() var messages: HashMap<Int, DanaRS_Packet> = HashMap()
@ -33,78 +17,78 @@ class DanaRSMessageHashTable @Inject constructor(
} }
fun findMessage(command: Int): DanaRS_Packet { fun findMessage(command: Int): DanaRS_Packet {
return messages[command] ?: DanaRS_Packet() return messages[command] ?: DanaRS_Packet(injector)
} }
init { init {
put(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger)) put(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector))
put(DanaRS_Packet_Basal_Get_Basal_Rate(aapsLogger, rxBus, resourceHelper, danaRPump)) put(DanaRS_Packet_Basal_Get_Basal_Rate(injector))
put(DanaRS_Packet_Basal_Get_Profile_Basal_Rate(aapsLogger, danaRPump)) put(DanaRS_Packet_Basal_Get_Profile_Basal_Rate(injector))
put(DanaRS_Packet_Basal_Get_Profile_Number(aapsLogger, danaRPump)) put(DanaRS_Packet_Basal_Get_Profile_Number(injector))
put(DanaRS_Packet_Basal_Set_Basal_Rate(aapsLogger, arrayOf())) put(DanaRS_Packet_Basal_Set_Basal_Rate(injector, arrayOf()))
put(DanaRS_Packet_Basal_Set_Profile_Basal_Rate(aapsLogger, 0, arrayOf())) put(DanaRS_Packet_Basal_Set_Profile_Basal_Rate(injector, 0, arrayOf()))
put(DanaRS_Packet_Basal_Set_Profile_Number(aapsLogger)) put(DanaRS_Packet_Basal_Set_Profile_Number(injector))
put(DanaRS_Packet_Basal_Set_Suspend_Off(aapsLogger)) put(DanaRS_Packet_Basal_Set_Suspend_Off(injector))
put(DanaRS_Packet_Basal_Set_Suspend_On(aapsLogger)) put(DanaRS_Packet_Basal_Set_Suspend_On(injector))
put(DanaRS_Packet_Basal_Set_Temporary_Basal(aapsLogger)) put(DanaRS_Packet_Basal_Set_Temporary_Basal(injector))
put(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump)) put(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
put(DanaRS_Packet_Bolus_Get_Bolus_Option(aapsLogger, rxBus, resourceHelper, danaRPump)) put(DanaRS_Packet_Bolus_Get_Bolus_Option(injector))
put(DanaRS_Packet_Bolus_Get_Initial_Bolus(aapsLogger)) put(DanaRS_Packet_Bolus_Get_Initial_Bolus(injector))
put(DanaRS_Packet_Bolus_Get_Calculation_Information(aapsLogger, danaRPump)) put(DanaRS_Packet_Bolus_Get_Calculation_Information(injector))
put(DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(aapsLogger, danaRPump)) put(DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(injector))
put(DanaRS_Packet_Bolus_Get_CIR_CF_Array(aapsLogger, danaRPump)) put(DanaRS_Packet_Bolus_Get_CIR_CF_Array(injector))
put(DanaRS_Packet_Bolus_Get_Dual_Bolus(aapsLogger, danaRPump)) put(DanaRS_Packet_Bolus_Get_Dual_Bolus(injector))
put(DanaRS_Packet_Bolus_Get_Extended_Bolus(aapsLogger, danaRPump)) put(DanaRS_Packet_Bolus_Get_Extended_Bolus(injector))
put(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump)) put(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(injector))
put(DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(aapsLogger, danaRPump)) put(DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(injector))
put(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump)) put(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(injector))
put(DanaRS_Packet_Bolus_Set_Bolus_Option(aapsLogger)) put(DanaRS_Packet_Bolus_Set_Bolus_Option(injector))
put(DanaRS_Packet_Bolus_Set_Initial_Bolus(aapsLogger)) put(DanaRS_Packet_Bolus_Set_Initial_Bolus(injector))
put(DanaRS_Packet_Bolus_Set_CIR_CF_Array(aapsLogger)) put(DanaRS_Packet_Bolus_Set_CIR_CF_Array(injector))
put(DanaRS_Packet_Bolus_Set_Dual_Bolus(aapsLogger)) put(DanaRS_Packet_Bolus_Set_Dual_Bolus(injector))
put(DanaRS_Packet_Bolus_Set_Extended_Bolus(aapsLogger)) put(DanaRS_Packet_Bolus_Set_Extended_Bolus(injector))
put(DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(aapsLogger)) put(DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(injector))
put(DanaRS_Packet_Bolus_Set_Step_Bolus_Start(aapsLogger, danaRPump, constraintChecker)) put(DanaRS_Packet_Bolus_Set_Step_Bolus_Start(injector))
put(DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(aapsLogger, rxBus, resourceHelper, danaRPump)) put(DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(injector))
put(DanaRS_Packet_Etc_Keep_Connection(aapsLogger)) put(DanaRS_Packet_Etc_Keep_Connection(injector))
put(DanaRS_Packet_Etc_Set_History_Save(aapsLogger)) put(DanaRS_Packet_Etc_Set_History_Save(injector))
put(DanaRS_Packet_General_Delivery_Status(aapsLogger)) put(DanaRS_Packet_General_Delivery_Status(injector))
put(DanaRS_Packet_General_Get_Password(aapsLogger, danaRPump)) put(DanaRS_Packet_General_Get_Password(injector))
put(DanaRS_Packet_General_Initial_Screen_Information(aapsLogger, danaRPump)) put(DanaRS_Packet_General_Initial_Screen_Information(injector))
put(DanaRS_Packet_Notify_Alarm(aapsLogger, resourceHelper, rxBus)) put(DanaRS_Packet_Notify_Alarm(injector))
put(DanaRS_Packet_Notify_Delivery_Complete(aapsLogger, rxBus, resourceHelper, danaRPump)) put(DanaRS_Packet_Notify_Delivery_Complete(injector))
put(DanaRS_Packet_Notify_Delivery_Rate_Display(aapsLogger, rxBus, resourceHelper, danaRPump)) put(DanaRS_Packet_Notify_Delivery_Rate_Display(injector))
put(DanaRS_Packet_Notify_Missed_Bolus_Alarm(aapsLogger)) put(DanaRS_Packet_Notify_Missed_Bolus_Alarm(injector))
put(DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump)) put(DanaRS_Packet_Option_Get_Pump_Time(injector))
put(DanaRS_Packet_Option_Get_User_Option(aapsLogger, danaRPump)) put(DanaRS_Packet_Option_Get_User_Option(injector))
put(DanaRS_Packet_Option_Set_Pump_Time(aapsLogger)) put(DanaRS_Packet_Option_Set_Pump_Time(injector))
put(DanaRS_Packet_Option_Set_User_Option(aapsLogger, danaRPump)) put(DanaRS_Packet_Option_Set_User_Option(injector))
//put(new DanaRS_Packet_History_()); //put(new DanaRS_Packet_History_(injector));
put(DanaRS_Packet_History_Alarm(aapsLogger, rxBus)) put(DanaRS_Packet_History_Alarm(injector))
put(DanaRS_Packet_History_All_History(aapsLogger, rxBus)) put(DanaRS_Packet_History_All_History(injector))
put(DanaRS_Packet_History_Basal(aapsLogger, rxBus)) put(DanaRS_Packet_History_Basal(injector))
put(DanaRS_Packet_History_Blood_Glucose(aapsLogger, rxBus)) put(DanaRS_Packet_History_Blood_Glucose(injector))
put(DanaRS_Packet_History_Bolus(aapsLogger, rxBus)) put(DanaRS_Packet_History_Bolus(injector))
put(DanaRS_Packet_Review_Bolus_Avg(aapsLogger)) put(DanaRS_Packet_Review_Bolus_Avg(injector))
put(DanaRS_Packet_History_Carbohydrate(aapsLogger, rxBus)) put(DanaRS_Packet_History_Carbohydrate(injector))
put(DanaRS_Packet_History_Daily(aapsLogger, rxBus)) put(DanaRS_Packet_History_Daily(injector))
put(DanaRS_Packet_General_Get_More_Information(aapsLogger, danaRPump)) put(DanaRS_Packet_General_Get_More_Information(injector))
put(DanaRS_Packet_General_Get_Pump_Check(aapsLogger, danaRPump, rxBus, resourceHelper)) put(DanaRS_Packet_General_Get_Pump_Check(injector))
put(DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump)) put(DanaRS_Packet_General_Get_Shipping_Information(injector))
put(DanaRS_Packet_General_Get_Today_Delivery_Total(aapsLogger, danaRPump)) put(DanaRS_Packet_General_Get_Today_Delivery_Total(injector))
put(DanaRS_Packet_General_Get_User_Time_Change_Flag(aapsLogger)) put(DanaRS_Packet_General_Get_User_Time_Change_Flag(injector))
put(DanaRS_Packet_History_Prime(aapsLogger, rxBus)) put(DanaRS_Packet_History_Prime(injector))
put(DanaRS_Packet_History_Refill(aapsLogger, rxBus)) put(DanaRS_Packet_History_Refill(injector))
put(DanaRS_Packet_General_Set_History_Upload_Mode(aapsLogger)) put(DanaRS_Packet_General_Set_History_Upload_Mode(injector))
put(DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(aapsLogger)) put(DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(injector))
put(DanaRS_Packet_History_Suspend(aapsLogger, rxBus)) put(DanaRS_Packet_History_Suspend(injector))
put(DanaRS_Packet_History_Temporary(aapsLogger, rxBus)) put(DanaRS_Packet_History_Temporary(injector))
// APS // APS
put(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, 0)) put(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(injector, 0))
put(DanaRS_Packet_APS_History_Events(aapsLogger, rxBus, resourceHelper, activePlugin, danaRPump, detailedBolusInfoStorage, sp, injector, 0)) put(DanaRS_Packet_APS_History_Events(injector, 0))
put(DanaRS_Packet_APS_Set_Event_History(aapsLogger, 0, 0, 0, 0)) put(DanaRS_Packet_APS_Set_Event_History(injector, 0, 0, 0, 0))
// v3 // v3
put(DanaRS_Packet_General_Get_Shipping_Version(aapsLogger, danaRPump)) put(DanaRS_Packet_General_Get_Shipping_Version(injector))
put(DanaRS_Packet_Review_Get_Pump_Dec_Ratio(aapsLogger, danaRPump)) put(DanaRS_Packet_Review_Get_Pump_Dec_Ratio(injector))
} }
} }

View file

@ -3,16 +3,26 @@ package info.nightscout.androidaps.plugins.pump.danaRS.comm;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.os.Build; import android.os.Build;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption; import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption;
import org.slf4j.Logger; import org.slf4j.Logger;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Date; import java.util.Date;
import javax.inject.Inject;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
public class DanaRS_Packet { public class DanaRS_Packet {
private static final Logger log = StacktraceLoggerWrapper.getLogger(DanaRS_Packet.class);
@Inject AAPSLogger aapsLogger;
protected HasAndroidInjector injector;
protected static final int TYPE_START = 0; protected static final int TYPE_START = 0;
protected static final int OPCODE_START = 1; protected static final int OPCODE_START = 1;
@ -23,9 +33,11 @@ public class DanaRS_Packet {
protected int type = BleEncryption.DANAR_PACKET__TYPE_RESPONSE; // most of the messages, should be changed for others protected int type = BleEncryption.DANAR_PACKET__TYPE_RESPONSE; // most of the messages, should be changed for others
protected int opCode; protected int opCode;
public DanaRS_Packet() { public DanaRS_Packet(HasAndroidInjector injector) {
received = false; received = false;
failed = false; failed = false;
this.injector = injector;
injector.androidInjector().inject(this);
} }
public void setReceived() { public void setReceived() {
@ -54,7 +66,7 @@ public class DanaRS_Packet {
// STATIC FUNCTIONS // STATIC FUNCTIONS
public static int getCommand(byte[] data) { public int getCommand(byte[] data) {
int type = byteArrayToInt(getBytes(data, TYPE_START, 1)); int type = byteArrayToInt(getBytes(data, TYPE_START, 1));
int opCode = byteArrayToInt(getBytes(data, OPCODE_START, 1)); int opCode = byteArrayToInt(getBytes(data, OPCODE_START, 1));
return ((type & 0xFF) << 8) + (opCode & 0xFF); return ((type & 0xFF) << 8) + (opCode & 0xFF);
@ -70,7 +82,7 @@ public class DanaRS_Packet {
return "UNKNOWN_PACKET"; return "UNKNOWN_PACKET";
} }
protected static byte[] getBytes(byte[] data, int srcStart, int srcLength) { protected byte[] getBytes(byte[] data, int srcStart, int srcLength) {
try { try {
byte[] ret = new byte[srcLength]; byte[] ret = new byte[srcLength];
@ -78,7 +90,7 @@ public class DanaRS_Packet {
return ret; return ret;
} catch (Exception e) { } catch (Exception e) {
log.error("Unhandled exception", e); aapsLogger.error(LTag.PUMPBTCOMM, "Unhandled exception", e);
} }
return null; return null;
} }
@ -148,7 +160,7 @@ public class DanaRS_Packet {
return new String(strbuff, StandardCharsets.UTF_8); return new String(strbuff, StandardCharsets.UTF_8);
} }
public static long dateFromBuff(byte[] buff, int offset) { public long dateFromBuff(byte[] buff, int offset) {
return return
new Date( new Date(
100 + byteArrayToInt(getBytes(buff, offset, 1)), 100 + byteArrayToInt(getBytes(buff, offset, 1)),
@ -159,7 +171,7 @@ public class DanaRS_Packet {
@TargetApi(Build.VERSION_CODES.KITKAT) @TargetApi(Build.VERSION_CODES.KITKAT)
public static String asciiStringFromBuff(byte[] buff, int offset, int length) { public String asciiStringFromBuff(byte[] buff, int offset, int length) {
byte[] strbuff = new byte[length]; byte[] strbuff = new byte[length];
System.arraycopy(buff, offset, strbuff, 0, length); System.arraycopy(buff, offset, strbuff, 0, length);
for (int pos = 0; pos < length; pos++) for (int pos = 0; pos < length; pos++)

View file

@ -1,13 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_APS_Basal_Set_Temporary_Basal( class DanaRS_Packet_APS_Basal_Set_Temporary_Basal(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var percent: Int private var percent: Int
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
var temporaryBasalRatio = 0 var temporaryBasalRatio = 0
var temporaryBasalDuration = 0 var temporaryBasalDuration = 0

View file

@ -10,7 +10,6 @@ import info.nightscout.androidaps.db.TemporaryBasal
import info.nightscout.androidaps.dialogs.FillDialog import info.nightscout.androidaps.dialogs.FillDialog
import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
@ -20,18 +19,19 @@ import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import java.util.* import java.util.*
import javax.inject.Inject
open class DanaRS_Packet_APS_History_Events( open class DanaRS_Packet_APS_History_Events(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private val rxBus: RxBusWrapper,
private val resourceHelper: ResourceHelper,
private val activePlugin: ActivePluginProvider,
private val danaRPump: DanaRPump,
private val detailedBolusInfoStorage: DetailedBolusInfoStorage,
private val sp: SP,
private val injector: HasAndroidInjector,
private var from: Long private var from: Long
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
@Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var danaRPump: DanaRPump
@Inject lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
@Inject lateinit var sp: SP
private var year = 0 private var year = 0
private var month = 0 private var month = 0

View file

@ -1,19 +1,19 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import java.util.* import java.util.*
class DanaRS_Packet_APS_Set_Event_History( class DanaRS_Packet_APS_Set_Event_History(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var packetType: Int, private var packetType: Int,
private var time: Long, private var time: Long,
private var param1: Int, private var param1: Int,
private var param2: Int private var param2: Int
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY opCode = BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY

View file

@ -1,23 +1,25 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import java.util.* import java.util.*
import javax.inject.Inject
class DanaRS_Packet_Basal_Get_Basal_Rate( class DanaRS_Packet_Basal_Get_Basal_Rate(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val rxBus: RxBusWrapper, ) : DanaRS_Packet(injector) {
private val resourceHelper: ResourceHelper,
private val danaRPump: DanaRPump @Inject lateinit var rxBus: RxBusWrapper
) : DanaRS_Packet() { @Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_BASAL_RATE opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_BASAL_RATE
@ -31,7 +33,7 @@ class DanaRS_Packet_Basal_Get_Basal_Rate(
dataIndex += dataSize dataIndex += dataSize
dataSize = 1 dataSize = 1
danaRPump.basalStep = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0 danaRPump.basalStep = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100.0
danaRPump.pumpProfiles = Array(4) {Array(48) {0.0} } danaRPump.pumpProfiles = Array(4) { Array(48) { 0.0 } }
var i = 0 var i = 0
val size = 24 val size = 24
while (i < size) { while (i < size) {

View file

@ -1,16 +1,18 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import java.util.* import java.util.*
import javax.inject.Inject
open class DanaRS_Packet_Basal_Get_Profile_Basal_Rate( open class DanaRS_Packet_Basal_Get_Profile_Basal_Rate(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private val danaRPump: DanaRPump,
private val profileNumber: Int = 0 private val profileNumber: Int = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_PROFILE_BASAL_RATE opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_PROFILE_BASAL_RATE
@ -26,7 +28,7 @@ open class DanaRS_Packet_Basal_Get_Profile_Basal_Rate(
override fun handleMessage(data: ByteArray) { override fun handleMessage(data: ByteArray) {
var dataIndex = DATA_START var dataIndex = DATA_START
var dataSize = 2 var dataSize = 2
danaRPump.pumpProfiles = Array(4) {Array(48) {0.0} } danaRPump.pumpProfiles = Array(4) { Array(48) { 0.0 } }
var i = 0 var i = 0
val size = 24 val size = 24
while (i < size) { while (i < size) {

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Basal_Get_Profile_Number( class DanaRS_Packet_Basal_Get_Profile_Number(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_PROFILE_NUMBER opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_PROFILE_NUMBER

View file

@ -1,16 +1,18 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import javax.inject.Inject
import kotlin.math.ceil import kotlin.math.ceil
class DanaRS_Packet_Basal_Get_Temporary_Basal_State( class DanaRS_Packet_Basal_Get_Temporary_Basal_State(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__TEMPORARY_BASAL_STATE opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__TEMPORARY_BASAL_STATE

View file

@ -1,13 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Basal_Set_Basal_Rate( class DanaRS_Packet_Basal_Set_Basal_Rate(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var profileBasalRate: Array<Double> private var profileBasalRate: Array<Double>
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal( class DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(
private val aapsLogger: AAPSLogger injector: HasAndroidInjector
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__CANCEL_TEMPORARY_BASAL opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__CANCEL_TEMPORARY_BASAL

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Basal_Set_Profile_Basal_Rate( class DanaRS_Packet_Basal_Set_Profile_Basal_Rate(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var profileNumber: Int, private var profileNumber: Int,
private var profileBasalRate: Array<Double> private var profileBasalRate: Array<Double>
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_PROFILE_BASAL_RATE opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_PROFILE_BASAL_RATE

View file

@ -1,13 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Basal_Set_Profile_Number( class DanaRS_Packet_Basal_Set_Profile_Number(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var profileNumber: Int = 0 private var profileNumber: Int = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_PROFILE_NUMBER opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_PROFILE_NUMBER

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Basal_Set_Suspend_Off( class DanaRS_Packet_Basal_Set_Suspend_Off(
private val aapsLogger: AAPSLogger injector: HasAndroidInjector
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_SUSPEND_OFF opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_SUSPEND_OFF

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Basal_Set_Suspend_On( class DanaRS_Packet_Basal_Set_Suspend_On(
private val aapsLogger: AAPSLogger injector: HasAndroidInjector
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_SUSPEND_ON opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_SUSPEND_ON

View file

@ -1,14 +1,14 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
open class DanaRS_Packet_Basal_Set_Temporary_Basal( open class DanaRS_Packet_Basal_Set_Temporary_Basal(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var temporaryBasalRatio: Int = 0, private var temporaryBasalRatio: Int = 0,
private var temporaryBasalDuration: Int = 0 private var temporaryBasalDuration: Int = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_TEMPORARY_BASAL opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_TEMPORARY_BASAL

View file

@ -1,23 +1,24 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
class DanaRS_Packet_Bolus_Get_Bolus_Option( class DanaRS_Packet_Bolus_Get_Bolus_Option(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val rxBus: RxBusWrapper, ) : DanaRS_Packet(injector) {
private val resourceHelper: ResourceHelper,
private val danaRPump: DanaRPump
) : DanaRS_Packet() { @Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_BOLUS_OPTION opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_BOLUS_OPTION

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Bolus_Get_CIR_CF_Array( class DanaRS_Packet_Bolus_Get_CIR_CF_Array(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CIR_CF_ARRAY opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CIR_CF_ARRAY

View file

@ -1,15 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Bolus_Get_Calculation_Information( class DanaRS_Packet_Bolus_Get_Calculation_Information(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CALCULATION_INFORMATION opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CALCULATION_INFORMATION

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information( class DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CARBOHYDRATE_CALCULATION_INFORMATION opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CARBOHYDRATE_CALCULATION_INFORMATION

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Bolus_Get_Dual_Bolus( class DanaRS_Packet_Bolus_Get_Dual_Bolus(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_DUAL_BOLUS opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_DUAL_BOLUS

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Bolus_Get_Extended_Bolus( class DanaRS_Packet_Bolus_Get_Extended_Bolus(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Bolus_Get_Extended_Bolus_State( class DanaRS_Packet_Bolus_Get_Extended_Bolus_State(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS_STATE opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS_STATE

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State( class DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_MENU_OPTION_STATE opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_MENU_OPTION_STATE

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Bolus_Get_Initial_Bolus( class DanaRS_Packet_Bolus_Get_Initial_Bolus(
private val aapsLogger: AAPSLogger injector: HasAndroidInjector
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_BOLUS_RATE opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_BOLUS_RATE

View file

@ -1,17 +1,18 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import org.joda.time.DateTime import org.joda.time.DateTime
import java.util.* import javax.inject.Inject
class DanaRS_Packet_Bolus_Get_Step_Bolus_Information( class DanaRS_Packet_Bolus_Get_Step_Bolus_Information(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_STEP_BOLUS_INFORMATION opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_STEP_BOLUS_INFORMATION

View file

@ -1,11 +1,11 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Bolus_Set_Bolus_Option( class DanaRS_Packet_Bolus_Set_Bolus_Option(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var extendedBolusOptionOnOff: Int = 0, private var extendedBolusOptionOnOff: Int = 0,
private var bolusCalculationOption: Int = 0, private var bolusCalculationOption: Int = 0,
private var missedBolusConfig: Int = 0, private var missedBolusConfig: Int = 0,
@ -26,7 +26,7 @@ class DanaRS_Packet_Bolus_Set_Bolus_Option(
private var missedBolus04EndHour: Int = 0, private var missedBolus04EndHour: Int = 0,
private var missedBolus04EndMin: Int = 0 private var missedBolus04EndMin: Int = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_BOLUS_OPTION opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_BOLUS_OPTION

View file

@ -1,11 +1,11 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Bolus_Set_CIR_CF_Array( class DanaRS_Packet_Bolus_Set_CIR_CF_Array(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var cir01: Int = 0, private var cir01: Int = 0,
private var cir02: Int = 0, private var cir02: Int = 0,
private var cir03: Int = 0, private var cir03: Int = 0,
@ -20,7 +20,7 @@ class DanaRS_Packet_Bolus_Set_CIR_CF_Array(
private var cf05: Int = 0, private var cf05: Int = 0,
private var cf06: Int = 0, private var cf06: Int = 0,
private var cf07: Int = 0 private var cf07: Int = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_CIR_CF_ARRAY opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_CIR_CF_ARRAY

View file

@ -1,16 +1,15 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Bolus_Set_Dual_Bolus( class DanaRS_Packet_Bolus_Set_Dual_Bolus(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var amount: Double = 0.0, private var amount: Double = 0.0,
private var extendedAmount: Double = 0.0, private var extendedAmount: Double = 0.0,
private var extendedBolusDurationInHalfHours: Int = 0 private var extendedBolusDurationInHalfHours: Int = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_DUAL_BOLUS opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_DUAL_BOLUS

View file

@ -1,15 +1,14 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Bolus_Set_Extended_Bolus( class DanaRS_Packet_Bolus_Set_Extended_Bolus(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var extendedAmount: Double = 0.0, private var extendedAmount: Double = 0.0,
private var extendedBolusDurationInHalfHours: Int = 0 private var extendedBolusDurationInHalfHours: Int = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_EXTENDED_BOLUS opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_EXTENDED_BOLUS

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel( class DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(
private val aapsLogger: AAPSLogger injector: HasAndroidInjector
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_EXTENDED_BOLUS_CANCEL opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_EXTENDED_BOLUS_CANCEL

View file

@ -1,16 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Bolus_Set_Initial_Bolus( class DanaRS_Packet_Bolus_Set_Initial_Bolus(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var bolusRate01: Int = 0, private var bolusRate01: Int = 0,
private var bolusRate02: Int = 0, private var bolusRate02: Int = 0,
private var bolusRate03: Int = 0, private var bolusRate03: Int = 0,
private var bolusRate04: Int = 0 private var bolusRate04: Int = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_BOLUS_RATE opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_BOLUS_RATE

View file

@ -1,20 +1,21 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Bolus_Set_Step_Bolus_Start( class DanaRS_Packet_Bolus_Set_Step_Bolus_Start(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private val danaRPump: DanaRPump,
constraintChecker: ConstraintChecker,
private var amount: Double = 0.0, private var amount: Double = 0.0,
private var speed: Int = 0 private var speed: Int = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
@Inject lateinit var danaRPump: DanaRPump
@Inject lateinit var constraintChecker: ConstraintChecker
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_STEP_BOLUS_START opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_STEP_BOLUS_START

View file

@ -1,21 +1,22 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
open class DanaRS_Packet_Bolus_Set_Step_Bolus_Stop( open class DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val rxBus: RxBusWrapper, ) : DanaRS_Packet(injector) {
private val resourceHelper: ResourceHelper,
private val danaRPump: DanaRPump
) : DanaRS_Packet() {
@Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_STEP_BOLUS_STOP opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_STEP_BOLUS_STOP

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Etc_Keep_Connection( class DanaRS_Packet_Etc_Keep_Connection(
private val aapsLogger: AAPSLogger injector: HasAndroidInjector
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_ETC__KEEP_CONNECTION opCode = BleEncryption.DANAR_PACKET__OPCODE_ETC__KEEP_CONNECTION

View file

@ -1,11 +1,11 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Etc_Set_History_Save( class DanaRS_Packet_Etc_Set_History_Save(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var historyType: Int = 0, private var historyType: Int = 0,
private var historyYear: Int = 0, private var historyYear: Int = 0,
private var historyMonth: Int = 0, private var historyMonth: Int = 0,
@ -15,8 +15,7 @@ class DanaRS_Packet_Etc_Set_History_Save(
private var historySecond: Int = 0, private var historySecond: Int = 0,
private var historyCode: Int = 0, private var historyCode: Int = 0,
private var historyValue: Int = 0 private var historyValue: Int = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_ETC__SET_HISTORY_SAVE opCode = BleEncryption.DANAR_PACKET__OPCODE_ETC__SET_HISTORY_SAVE

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_General_Delivery_Status( class DanaRS_Packet_General_Delivery_Status(
private val aapsLogger: AAPSLogger injector: HasAndroidInjector
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__DELIVERY_STATUS opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__DELIVERY_STATUS

View file

@ -1,16 +1,18 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.logging.AAPSLogger import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import org.joda.time.DateTime import org.joda.time.DateTime
import javax.inject.Inject
class DanaRS_Packet_General_Get_More_Information( class DanaRS_Packet_General_Get_More_Information(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_MORE_INFORMATION opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_MORE_INFORMATION

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_General_Get_Password( class DanaRS_Packet_General_Get_Password(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PASSWORD opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PASSWORD

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
@ -9,13 +9,15 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
class DanaRS_Packet_General_Get_Pump_Check( class DanaRS_Packet_General_Get_Pump_Check(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump, ) : DanaRS_Packet(injector) {
private val rxBus: RxBusWrapper,
private val resourceHelper: ResourceHelper @Inject lateinit var rxBus: RxBusWrapper
) : DanaRS_Packet() { @Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PUMP_CHECK opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PUMP_CHECK

View file

@ -1,15 +1,17 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import javax.inject.Inject
class DanaRS_Packet_General_Get_Shipping_Information( class DanaRS_Packet_General_Get_Shipping_Information(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_SHIPPING_INFORMATION opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_SHIPPING_INFORMATION

View file

@ -1,15 +1,17 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.logging.AAPSLogger import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import java.nio.charset.Charset import java.nio.charset.Charset
import javax.inject.Inject
class DanaRS_Packet_General_Get_Shipping_Version( class DanaRS_Packet_General_Get_Shipping_Version(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_GENERAL__GET_SHIPPING_VERSION opCode = BleEncryption.DANAR_PACKET__OPCODE_GENERAL__GET_SHIPPING_VERSION

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_General_Get_Today_Delivery_Total( class DanaRS_Packet_General_Get_Today_Delivery_Total(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_TODAY_DELIVERY_TOTAL opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_TODAY_DELIVERY_TOTAL

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_General_Get_User_Time_Change_Flag( class DanaRS_Packet_General_Get_User_Time_Change_Flag(
private val aapsLogger: AAPSLogger injector: HasAndroidInjector
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_USER_TIME_CHANGE_FLAG opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_USER_TIME_CHANGE_FLAG

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.logging.AAPSLogger import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_General_Initial_Screen_Information( class DanaRS_Packet_General_Initial_Screen_Information(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__INITIAL_SCREEN_INFORMATION opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__INITIAL_SCREEN_INFORMATION

View file

@ -1,13 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_General_Set_History_Upload_Mode( class DanaRS_Packet_General_Set_History_Upload_Mode(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var mode: Int = 0 private var mode: Int = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SET_HISTORY_UPLOAD_MODE opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SET_HISTORY_UPLOAD_MODE

View file

@ -1,17 +1,18 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear( class DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(
private val aapsLogger: AAPSLogger injector: HasAndroidInjector
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SET_USER_TIME_CHANGE_FLAG_CLEAR opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SET_USER_TIME_CHANGE_FLAG_CLEAR
aapsLogger.debug(LTag.PUMPCOMM, "New message") aapsLogger.debug(LTag.PUMPCOMM, "New message")
} }
override fun handleMessage(data: ByteArray) { override fun handleMessage(data: ByteArray) {
val result = intFromBuff(data, 0, 1) val result = intFromBuff(data, 0, 1)
if (result == 0) { if (result == 0) {

View file

@ -1,8 +1,8 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.db.DanaRHistoryRecord import info.nightscout.androidaps.db.DanaRHistoryRecord
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.danaR.comm.RecordTypes import info.nightscout.androidaps.plugins.pump.danaR.comm.RecordTypes
@ -10,12 +10,14 @@ import info.nightscout.androidaps.plugins.pump.danaR.events.EventDanaRSyncStatus
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import org.joda.time.DateTime import org.joda.time.DateTime
import java.util.* import java.util.*
import javax.inject.Inject
abstract class DanaRS_Packet_History_( abstract class DanaRS_Packet_History_(
protected val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
protected val rxBus: RxBusWrapper,
protected val from: Long protected val from: Long
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
@Inject lateinit var rxBus: RxBusWrapper
protected var year = 0 protected var year = 0
protected var month = 0 protected var month = 0

View file

@ -1,15 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_History_Alarm @JvmOverloads constructor( class DanaRS_Packet_History_Alarm @JvmOverloads constructor(
aapsLogger: AAPSLogger, injector: HasAndroidInjector,
rxBus: RxBusWrapper,
from: Long = 0 from: Long = 0
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) { ) : DanaRS_Packet_History_(injector, from) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__ALARM opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__ALARM

View file

@ -1,15 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_History_All_History( class DanaRS_Packet_History_All_History(
aapsLogger: AAPSLogger, injector: HasAndroidInjector,
rxBus: RxBusWrapper,
from: Long = 0 from: Long = 0
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) { ) : DanaRS_Packet_History_(injector, from) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__ALL_HISTORY opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__ALL_HISTORY

View file

@ -1,15 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_History_Basal @JvmOverloads constructor( class DanaRS_Packet_History_Basal @JvmOverloads constructor(
aapsLogger: AAPSLogger, injector: HasAndroidInjector,
rxBus: RxBusWrapper,
from: Long = 0 from: Long = 0
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) { ) : DanaRS_Packet_History_(injector, from) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BASAL opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BASAL

View file

@ -1,15 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_History_Blood_Glucose @JvmOverloads constructor( class DanaRS_Packet_History_Blood_Glucose @JvmOverloads constructor(
aapsLogger: AAPSLogger, injector: HasAndroidInjector,
rxBus: RxBusWrapper,
from: Long = 0 from: Long = 0
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) { ) : DanaRS_Packet_History_(injector, from) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BLOOD_GLUCOSE opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BLOOD_GLUCOSE

View file

@ -1,15 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_History_Bolus @JvmOverloads constructor( class DanaRS_Packet_History_Bolus @JvmOverloads constructor(
aapsLogger: AAPSLogger, injector: HasAndroidInjector,
rxBus: RxBusWrapper,
from: Long = 0 from: Long = 0
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) { ) : DanaRS_Packet_History_(injector, from) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BOLUS opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BOLUS

View file

@ -1,15 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_History_Carbohydrate @JvmOverloads constructor( class DanaRS_Packet_History_Carbohydrate @JvmOverloads constructor(
aapsLogger: AAPSLogger, injector: HasAndroidInjector,
rxBus: RxBusWrapper,
from: Long = 0 from: Long = 0
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) { ) : DanaRS_Packet_History_(injector, from) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__CARBOHYDRATE opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__CARBOHYDRATE

View file

@ -1,15 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_History_Daily @JvmOverloads constructor( class DanaRS_Packet_History_Daily @JvmOverloads constructor(
aapsLogger: AAPSLogger, injector: HasAndroidInjector,
rxBus: RxBusWrapper,
from: Long = 0 from: Long = 0
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) { ) : DanaRS_Packet_History_(injector, from) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__DAILY opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__DAILY

View file

@ -1,15 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_History_Prime @JvmOverloads constructor( class DanaRS_Packet_History_Prime @JvmOverloads constructor(
aapsLogger: AAPSLogger, injector: HasAndroidInjector,
rxBus: RxBusWrapper,
from: Long = 0 from: Long = 0
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) { ) : DanaRS_Packet_History_(injector, from) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__PRIME opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__PRIME

View file

@ -1,15 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_History_Refill @JvmOverloads constructor( class DanaRS_Packet_History_Refill @JvmOverloads constructor(
aapsLogger: AAPSLogger, injector: HasAndroidInjector,
rxBus: RxBusWrapper,
from: Long = 0 from: Long = 0
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) { ) : DanaRS_Packet_History_(injector, from) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__REFILL opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__REFILL

View file

@ -1,15 +1,15 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
class DanaRS_Packet_History_Suspend @JvmOverloads constructor( class DanaRS_Packet_History_Suspend @JvmOverloads constructor(
aapsLogger: AAPSLogger, injector: HasAndroidInjector,
rxBus: RxBusWrapper,
from: Long = 0 from: Long = 0
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) { ) : DanaRS_Packet_History_(injector, from) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SUSPEND opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SUSPEND

View file

@ -1,15 +1,13 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_History_Temporary( class DanaRS_Packet_History_Temporary(
aapsLogger: AAPSLogger, injector: HasAndroidInjector,
rxBus: RxBusWrapper,
from: Long = 0 from: Long = 0
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) { ) : DanaRS_Packet_History_(injector, from) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__TEMPORARY opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__TEMPORARY

View file

@ -1,20 +1,22 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
class DanaRS_Packet_Notify_Alarm( class DanaRS_Packet_Notify_Alarm(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val resourceHelper: ResourceHelper, ) : DanaRS_Packet(injector) {
private val rxBus: RxBusWrapper
) : DanaRS_Packet() { @Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var resourceHelper: ResourceHelper
init { init {
type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY

View file

@ -1,21 +1,23 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
import kotlin.math.min import kotlin.math.min
class DanaRS_Packet_Notify_Delivery_Complete( class DanaRS_Packet_Notify_Delivery_Complete(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val rxBus: RxBusWrapper, ) : DanaRS_Packet(injector) {
private val resourceHelper: ResourceHelper,
private val danaRPump: DanaRPump @Inject lateinit var rxBus: RxBusWrapper
) : DanaRS_Packet() { @Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var danaRPump: DanaRPump
init { init {
type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY

View file

@ -1,22 +1,23 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
import kotlin.math.min import kotlin.math.min
class DanaRS_Packet_Notify_Delivery_Rate_Display( class DanaRS_Packet_Notify_Delivery_Rate_Display(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val rxBus: RxBusWrapper, ) : DanaRS_Packet(injector) {
private val resourceHelper: ResourceHelper,
private val danaRPump: DanaRPump
) : DanaRS_Packet() {
@Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var resourceHelper: ResourceHelper
@Inject lateinit var danaRPump: DanaRPump
init { init {
type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Notify_Missed_Bolus_Alarm( class DanaRS_Packet_Notify_Missed_Bolus_Alarm(
private val aapsLogger: AAPSLogger injector: HasAndroidInjector
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY

View file

@ -1,16 +1,18 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.logging.AAPSLogger import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import org.joda.time.DateTime import org.joda.time.DateTime
import javax.inject.Inject
class DanaRS_Packet_Option_Get_Pump_Time( class DanaRS_Packet_Option_Get_Pump_Time(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__GET_PUMP_TIME opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__GET_PUMP_TIME

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Option_Get_User_Option( class DanaRS_Packet_Option_Get_User_Option(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__GET_USER_OPTION opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__GET_USER_OPTION

View file

@ -1,15 +1,15 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.logging.AAPSLogger import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import org.joda.time.DateTime import org.joda.time.DateTime
class DanaRS_Packet_Option_Set_Pump_Time( class DanaRS_Packet_Option_Set_Pump_Time(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector,
private var time: Long = 0 private var time: Long = 0
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
var error = 0 var error = 0

View file

@ -1,15 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Option_Set_User_Option( class DanaRS_Packet_Option_Set_User_Option(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__SET_USER_OPTION opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__SET_USER_OPTION

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
class DanaRS_Packet_Review_Bolus_Avg( class DanaRS_Packet_Review_Bolus_Avg(
private val aapsLogger: AAPSLogger injector: HasAndroidInjector
) : DanaRS_Packet() { ) : DanaRS_Packet(injector) {
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BOLUS_AVG opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BOLUS_AVG

View file

@ -1,14 +1,16 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import info.nightscout.androidaps.logging.AAPSLogger import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import javax.inject.Inject
class DanaRS_Packet_Review_Get_Pump_Dec_Ratio( class DanaRS_Packet_Review_Get_Pump_Dec_Ratio(
private val aapsLogger: AAPSLogger, injector: HasAndroidInjector
private val danaRPump: DanaRPump ) : DanaRS_Packet(injector) {
) : DanaRS_Packet() {
@Inject lateinit var danaRPump: DanaRPump
init { init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PUMP_DEC_RATIO opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PUMP_DEC_RATIO

View file

@ -5,6 +5,7 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.SystemClock import android.os.SystemClock
import android.util.Base64 import android.util.Base64
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
@ -33,6 +34,7 @@ import javax.inject.Singleton
@Singleton @Singleton
class BLEComm @Inject internal constructor( class BLEComm @Inject internal constructor(
private val injector: HasAndroidInjector,
private val aapsLogger: AAPSLogger, private val aapsLogger: AAPSLogger,
private val resourceHelper: ResourceHelper, private val resourceHelper: ResourceHelper,
private val context: Context, private val context: Context,
@ -695,7 +697,7 @@ class BLEComm @Inject internal constructor(
// process common packet response // process common packet response
private fun processMessage(decryptedBuffer: ByteArray) { private fun processMessage(decryptedBuffer: ByteArray) {
val originalCommand = processedMessage?.command ?: 0xFFFF val originalCommand = processedMessage?.command ?: 0xFFFF
val receivedCommand = DanaRS_Packet.getCommand(decryptedBuffer) val receivedCommand = DanaRS_Packet(injector).getCommand(decryptedBuffer)
val message: DanaRS_Packet? = if (originalCommand == receivedCommand) { val message: DanaRS_Packet? = if (originalCommand == receivedCommand) {
// it's response to last message // it's response to last message
processedMessage processedMessage

View file

@ -112,25 +112,25 @@ class DanaRSService : DaggerService() {
fun readPumpStatus() { fun readPumpStatus() {
try { try {
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpstatus))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpstatus)))
sendMessage(DanaRS_Packet_General_Initial_Screen_Information(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_General_Initial_Screen_Information(injector))
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingextendedbolusstatus))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingextendedbolusstatus)))
sendMessage(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(injector))
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus)))
sendMessage(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump)) // last bolus, bolusStep, maxBolus sendMessage(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(injector)) // last bolus, bolusStep, maxBolus
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingtempbasalstatus))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingtempbasalstatus)))
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
danaRPump.lastConnection = System.currentTimeMillis() danaRPump.lastConnection = System.currentTimeMillis()
val profile = profileFunction.getProfile() val profile = profileFunction.getProfile()
val pump = activePlugin.activePump val pump = activePlugin.activePump
if (profile != null && abs(danaRPump.currentBasal - profile.basal) >= pump.pumpDescription.basalStep) { if (profile != null && abs(danaRPump.currentBasal - profile.basal) >= pump.pumpDescription.basalStep) {
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)))
sendMessage(DanaRS_Packet_Basal_Get_Basal_Rate(aapsLogger, rxBus, resourceHelper, danaRPump)) // basal profile, basalStep, maxBasal sendMessage(DanaRS_Packet_Basal_Get_Basal_Rate(injector)) // basal profile, basalStep, maxBasal
if (!pump.isThisProfileSet(profile) && !commandQueue.isRunning(Command.CommandType.BASAL_PROFILE)) { if (!pump.isThisProfileSet(profile) && !commandQueue.isRunning(Command.CommandType.BASAL_PROFILE)) {
rxBus.send(EventProfileNeedsUpdate()) rxBus.send(EventProfileNeedsUpdate())
} }
} }
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumptime))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumptime)))
sendMessage(DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Option_Get_Pump_Time(injector))
var timeDiff = (danaRPump.pumpTime - System.currentTimeMillis()) / 1000L var timeDiff = (danaRPump.pumpTime - System.currentTimeMillis()) / 1000L
if (danaRPump.pumpTime == 0L) { if (danaRPump.pumpTime == 0L) {
// initial handshake was not successful // initial handshake was not successful
@ -143,14 +143,14 @@ class DanaRSService : DaggerService() {
val now = System.currentTimeMillis() val now = System.currentTimeMillis()
if (danaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !pump.isInitialized) { if (danaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !pump.isInitialized) {
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)))
sendMessage(DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump)) // serial no sendMessage(DanaRS_Packet_General_Get_Shipping_Information(injector)) // serial no
sendMessage(DanaRS_Packet_General_Get_Pump_Check(aapsLogger, danaRPump, rxBus, resourceHelper)) // firmware sendMessage(DanaRS_Packet_General_Get_Pump_Check(injector)) // firmware
sendMessage(DanaRS_Packet_Basal_Get_Profile_Number(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Basal_Get_Profile_Number(injector))
sendMessage(DanaRS_Packet_Bolus_Get_Bolus_Option(aapsLogger, rxBus, resourceHelper, danaRPump)) // isExtendedEnabled sendMessage(DanaRS_Packet_Bolus_Get_Bolus_Option(injector)) // isExtendedEnabled
sendMessage(DanaRS_Packet_Basal_Get_Basal_Rate(aapsLogger, rxBus, resourceHelper, danaRPump)) // basal profile, basalStep, maxBasal sendMessage(DanaRS_Packet_Basal_Get_Basal_Rate(injector)) // basal profile, basalStep, maxBasal
sendMessage(DanaRS_Packet_Bolus_Get_Calculation_Information(aapsLogger, danaRPump)) // target sendMessage(DanaRS_Packet_Bolus_Get_Calculation_Information(injector)) // target
sendMessage(DanaRS_Packet_Bolus_Get_CIR_CF_Array(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Bolus_Get_CIR_CF_Array(injector))
sendMessage(DanaRS_Packet_Option_Get_User_Option(aapsLogger, danaRPump)) // Getting user options sendMessage(DanaRS_Packet_Option_Get_User_Option(injector)) // Getting user options
danaRPump.lastSettingsRead = now danaRPump.lastSettingsRead = now
} }
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds") aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds")
@ -172,13 +172,13 @@ class DanaRSService : DaggerService() {
return return
} else { } else {
if (danaRPump.protocol >= 6) { if (danaRPump.protocol >= 6) {
sendMessage(DanaRS_Packet_Option_Set_Pump_Time(aapsLogger, DateUtil.now())) sendMessage(DanaRS_Packet_Option_Set_Pump_Time(injector, DateUtil.now()))
} else { } else {
waitForWholeMinute() // Dana can set only whole minute waitForWholeMinute() // Dana can set only whole minute
// add 10sec to be sure we are over minute (will be cut off anyway) // add 10sec to be sure we are over minute (will be cut off anyway)
sendMessage(DanaRS_Packet_Option_Set_Pump_Time(aapsLogger, DateUtil.now() + T.secs(10).msecs())) sendMessage(DanaRS_Packet_Option_Set_Pump_Time(injector, DateUtil.now() + T.secs(10).msecs()))
} }
sendMessage(DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Option_Get_Pump_Time(injector))
timeDiff = (danaRPump.pumpTime - System.currentTimeMillis()) / 1000L timeDiff = (danaRPump.pumpTime - System.currentTimeMillis()) / 1000L
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds") aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds")
} }
@ -211,10 +211,10 @@ class DanaRSService : DaggerService() {
SystemClock.sleep(1000) SystemClock.sleep(1000)
val msg: DanaRS_Packet_APS_History_Events val msg: DanaRS_Packet_APS_History_Events
if (lastHistoryFetched == 0L) { if (lastHistoryFetched == 0L) {
msg = DanaRS_Packet_APS_History_Events(aapsLogger, rxBus, resourceHelper, activePlugin, danaRPump, detailedBolusInfoStorage, sp, injector, 0) msg = DanaRS_Packet_APS_History_Events(injector, 0)
aapsLogger.debug(LTag.PUMPCOMM, "Loading complete event history") aapsLogger.debug(LTag.PUMPCOMM, "Loading complete event history")
} else { } else {
msg = DanaRS_Packet_APS_History_Events(aapsLogger, rxBus, resourceHelper, activePlugin, danaRPump, detailedBolusInfoStorage, sp, injector, lastHistoryFetched) msg = DanaRS_Packet_APS_History_Events(injector, lastHistoryFetched)
aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + DateUtil.dateAndTimeString(lastHistoryFetched)) aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + DateUtil.dateAndTimeString(lastHistoryFetched))
} }
sendMessage(msg) sendMessage(msg)
@ -228,7 +228,7 @@ class DanaRSService : DaggerService() {
} }
fun setUserSettings(): PumpEnactResult { fun setUserSettings(): PumpEnactResult {
sendMessage(DanaRS_Packet_Option_Get_User_Option(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Option_Get_User_Option(injector))
return PumpEnactResult(injector).success(true) return PumpEnactResult(injector).success(true)
} }
@ -243,11 +243,11 @@ class DanaRSService : DaggerService() {
danaRPump.bolusStopped = false danaRPump.bolusStopped = false
danaRPump.bolusStopForced = false danaRPump.bolusStopForced = false
danaRPump.bolusProgressLastTimeStamp = DateUtil.now() danaRPump.bolusProgressLastTimeStamp = DateUtil.now()
val start = DanaRS_Packet_Bolus_Set_Step_Bolus_Start(aapsLogger, danaRPump, constraintChecker, insulin, preferencesSpeed) val start = DanaRS_Packet_Bolus_Set_Step_Bolus_Start(injector, insulin, preferencesSpeed)
if (carbs > 0) { if (carbs > 0) {
// MsgSetCarbsEntry msg = new MsgSetCarbsEntry(carbTime, carbs); #### // MsgSetCarbsEntry msg = new MsgSetCarbsEntry(carbTime, carbs); ####
// sendMessage(msg); // sendMessage(msg);
val msgSetHistoryEntryV2 = DanaRS_Packet_APS_Set_Event_History(aapsLogger, DanaRPump.CARBS, carbTime, carbs, 0) val msgSetHistoryEntryV2 = DanaRS_Packet_APS_Set_Event_History(injector, DanaRPump.CARBS, carbTime, carbs, 0)
sendMessage(msgSetHistoryEntryV2) sendMessage(msgSetHistoryEntryV2)
lastHistoryFetched = min(lastHistoryFetched, carbTime - T.mins(1).msecs()) lastHistoryFetched = min(lastHistoryFetched, carbTime - T.mins(1).msecs())
} }
@ -291,7 +291,7 @@ class DanaRSService : DaggerService() {
override fun run() { override fun run() {
// reread bolus status // reread bolus status
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus)))
sendMessage(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump)) // last bolus sendMessage(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(injector)) // last bolus
bolusingEvent.percent = 100 bolusingEvent.percent = 100
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.disconnecting))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.disconnecting)))
} }
@ -301,7 +301,7 @@ class DanaRSService : DaggerService() {
fun bolusStop() { fun bolusStop() {
aapsLogger.debug(LTag.PUMPCOMM, "bolusStop >>>>> @ " + if (bolusingTreatment == null) "" else bolusingTreatment?.insulin) aapsLogger.debug(LTag.PUMPCOMM, "bolusStop >>>>> @ " + if (bolusingTreatment == null) "" else bolusingTreatment?.insulin)
val stop = DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(aapsLogger, rxBus, resourceHelper, danaRPump) val stop = DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(injector)
danaRPump.bolusStopForced = true danaRPump.bolusStopForced = true
if (isConnected) { if (isConnected) {
sendMessage(stop) sendMessage(stop)
@ -318,13 +318,13 @@ class DanaRSService : DaggerService() {
if (!isConnected) return false if (!isConnected) return false
if (danaRPump.isTempBasalInProgress) { if (danaRPump.isTempBasalInProgress) {
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger)) sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector))
SystemClock.sleep(500) SystemClock.sleep(500)
} }
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
sendMessage(DanaRS_Packet_Basal_Set_Temporary_Basal(aapsLogger, percent, durationInHours)) sendMessage(DanaRS_Packet_Basal_Set_Temporary_Basal(injector, percent, durationInHours))
SystemClock.sleep(200) SystemClock.sleep(200)
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
loadEvents() loadEvents()
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING)) rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
return true return true
@ -333,12 +333,12 @@ class DanaRSService : DaggerService() {
fun highTempBasal(percent: Int): Boolean { fun highTempBasal(percent: Int): Boolean {
if (danaRPump.isTempBasalInProgress) { if (danaRPump.isTempBasalInProgress) {
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger)) sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector))
SystemClock.sleep(500) SystemClock.sleep(500)
} }
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
sendMessage(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, percent)) sendMessage(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(injector, percent))
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
loadEvents() loadEvents()
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING)) rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
return true return true
@ -351,12 +351,12 @@ class DanaRSService : DaggerService() {
} }
if (danaRPump.isTempBasalInProgress) { if (danaRPump.isTempBasalInProgress) {
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger)) sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector))
SystemClock.sleep(500) SystemClock.sleep(500)
} }
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
sendMessage(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, percent)) sendMessage(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(injector, percent))
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
loadEvents() loadEvents()
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING)) rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
return true return true
@ -365,8 +365,8 @@ class DanaRSService : DaggerService() {
fun tempBasalStop(): Boolean { fun tempBasalStop(): Boolean {
if (!isConnected) return false if (!isConnected) return false
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger)) sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector))
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
loadEvents() loadEvents()
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING)) rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
return true return true
@ -375,9 +375,9 @@ class DanaRSService : DaggerService() {
fun extendedBolus(insulin: Double, durationInHalfHours: Int): Boolean { fun extendedBolus(insulin: Double, durationInHalfHours: Int): Boolean {
if (!isConnected) return false if (!isConnected) return false
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingextendedbolus))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingextendedbolus)))
sendMessage(DanaRS_Packet_Bolus_Set_Extended_Bolus(aapsLogger, insulin, durationInHalfHours)) sendMessage(DanaRS_Packet_Bolus_Set_Extended_Bolus(injector, insulin, durationInHalfHours))
SystemClock.sleep(200) SystemClock.sleep(200)
sendMessage(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(injector))
loadEvents() loadEvents()
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING)) rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
return true return true
@ -386,8 +386,8 @@ class DanaRSService : DaggerService() {
fun extendedBolusStop(): Boolean { fun extendedBolusStop(): Boolean {
if (!isConnected) return false if (!isConnected) return false
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus)))
sendMessage(DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(aapsLogger)) sendMessage(DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(injector))
sendMessage(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump)) sendMessage(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(injector))
loadEvents() loadEvents()
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING)) rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
return true return true
@ -397,9 +397,9 @@ class DanaRSService : DaggerService() {
if (!isConnected) return false if (!isConnected) return false
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.updatingbasalrates))) rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.updatingbasalrates)))
val basal = danaRPump.buildDanaRProfileRecord(profile) val basal = danaRPump.buildDanaRProfileRecord(profile)
val msgSet = DanaRS_Packet_Basal_Set_Profile_Basal_Rate(aapsLogger, 0, basal) val msgSet = DanaRS_Packet_Basal_Set_Profile_Basal_Rate(injector, 0, basal)
sendMessage(msgSet) sendMessage(msgSet)
val msgActivate = DanaRS_Packet_Basal_Set_Profile_Number(aapsLogger, 0) val msgActivate = DanaRS_Packet_Basal_Set_Profile_Number(injector, 0)
sendMessage(msgActivate) sendMessage(msgActivate)
danaRPump.lastSettingsRead = 0 // force read full settings danaRPump.lastSettingsRead = 0 // force read full settings
readPumpStatus() readPumpStatus()
@ -412,25 +412,25 @@ class DanaRSService : DaggerService() {
if (!isConnected) return result if (!isConnected) return result
var msg: DanaRS_Packet_History_? = null var msg: DanaRS_Packet_History_? = null
when (type) { when (type) {
RecordTypes.RECORD_TYPE_ALARM -> msg = DanaRS_Packet_History_Alarm(aapsLogger, rxBus) RecordTypes.RECORD_TYPE_ALARM -> msg = DanaRS_Packet_History_Alarm(injector)
RecordTypes.RECORD_TYPE_PRIME -> msg = DanaRS_Packet_History_Prime(aapsLogger, rxBus) RecordTypes.RECORD_TYPE_PRIME -> msg = DanaRS_Packet_History_Prime(injector)
RecordTypes.RECORD_TYPE_BASALHOUR -> msg = DanaRS_Packet_History_Basal(aapsLogger, rxBus) RecordTypes.RECORD_TYPE_BASALHOUR -> msg = DanaRS_Packet_History_Basal(injector)
RecordTypes.RECORD_TYPE_BOLUS -> msg = DanaRS_Packet_History_Bolus(aapsLogger, rxBus) RecordTypes.RECORD_TYPE_BOLUS -> msg = DanaRS_Packet_History_Bolus(injector)
RecordTypes.RECORD_TYPE_CARBO -> msg = DanaRS_Packet_History_Carbohydrate(aapsLogger, rxBus) RecordTypes.RECORD_TYPE_CARBO -> msg = DanaRS_Packet_History_Carbohydrate(injector)
RecordTypes.RECORD_TYPE_DAILY -> msg = DanaRS_Packet_History_Daily(aapsLogger, rxBus) RecordTypes.RECORD_TYPE_DAILY -> msg = DanaRS_Packet_History_Daily(injector)
RecordTypes.RECORD_TYPE_GLUCOSE -> msg = DanaRS_Packet_History_Blood_Glucose(aapsLogger, rxBus) RecordTypes.RECORD_TYPE_GLUCOSE -> msg = DanaRS_Packet_History_Blood_Glucose(injector)
RecordTypes.RECORD_TYPE_REFILL -> msg = DanaRS_Packet_History_Refill(aapsLogger, rxBus) RecordTypes.RECORD_TYPE_REFILL -> msg = DanaRS_Packet_History_Refill(injector)
RecordTypes.RECORD_TYPE_SUSPEND -> msg = DanaRS_Packet_History_Suspend(aapsLogger, rxBus) RecordTypes.RECORD_TYPE_SUSPEND -> msg = DanaRS_Packet_History_Suspend(injector)
} }
if (msg != null) { if (msg != null) {
sendMessage(DanaRS_Packet_General_Set_History_Upload_Mode(aapsLogger, 1)) sendMessage(DanaRS_Packet_General_Set_History_Upload_Mode(injector, 1))
SystemClock.sleep(200) SystemClock.sleep(200)
sendMessage(msg) sendMessage(msg)
while (!msg.done && isConnected) { while (!msg.done && isConnected) {
SystemClock.sleep(100) SystemClock.sleep(100)
} }
SystemClock.sleep(200) SystemClock.sleep(200)
sendMessage(DanaRS_Packet_General_Set_History_Upload_Mode(aapsLogger, 0)) sendMessage(DanaRS_Packet_General_Set_History_Upload_Mode(injector, 0))
} }
result.success = true result.success = true
result.comment = "OK" result.comment = "OK"

View file

@ -1,11 +1,12 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.interfaces.ActivePluginProvider 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.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
@ -16,19 +17,36 @@ import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class, DanaRSPlugin::class) @PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class)
class DanaRSMessageHashTableTest : DanaRSTestBase() { class DanaRSMessageHashTableTest : DanaRSTestBase() {
@Mock lateinit var activePlugin: ActivePluginProvider @Mock lateinit var activePlugin: ActivePluginProvider
@Mock lateinit var constraintChecker: ConstraintChecker @Mock lateinit var constraintChecker: ConstraintChecker
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet) {
it.aapsLogger = aapsLogger
}
if (it is DanaRS_Packet_Bolus_Set_Step_Bolus_Start) {
it.constraintChecker = constraintChecker
}
if (it is DanaRS_Packet_Bolus_Set_Step_Bolus_Start) {
it.danaRPump = danaRPump
}
if (it is DanaRS_Packet_APS_History_Events) {
it.danaRPump = danaRPump
}
}
}
@Test @Test
fun runTest() { fun runTest() {
`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) `when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
val danaRSMessageHashTable = DanaRSMessageHashTable(aapsLogger, rxBus, resourceHelper, danaRPump, activePlugin, constraintChecker, detailedBolusInfoStorage, sp, injector) val danaRSMessageHashTable = DanaRSMessageHashTable(packetInjector)
val forTesting: DanaRS_Packet = DanaRS_Packet_APS_Set_Event_History(aapsLogger, DanaRPump.CARBS, 0, 0, 0) val forTesting: DanaRS_Packet = DanaRS_Packet_APS_Set_Event_History(packetInjector, DanaRPump.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

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,30 +12,38 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_APS_Basal_Set_Temporary_BasalTest : DanaRSTestBase() { class DanaRS_Packet_APS_Basal_Set_Temporary_BasalTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_APS_Basal_Set_Temporary_Basal) {
it.aapsLogger = aapsLogger
}
}
}
@Test fun runTest() { @Test fun runTest() {
// under 100% should last 30 min // under 100% should last 30 min
var packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, 0) var packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, 0)
Assert.assertEquals(0, packet.temporaryBasalRatio) Assert.assertEquals(0, packet.temporaryBasalRatio)
Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration) Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration)
//constructor with param //constructor with param
packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, 10) packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, 10)
Assert.assertEquals(10, packet.temporaryBasalRatio) Assert.assertEquals(10, packet.temporaryBasalRatio)
Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration) Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration)
// over 100% should last 15 min // over 100% should last 15 min
packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, 150) packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, 150)
Assert.assertEquals(150, packet.temporaryBasalRatio) Assert.assertEquals(150, packet.temporaryBasalRatio)
Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM15MIN, packet.temporaryBasalDuration) Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM15MIN, packet.temporaryBasalDuration)
// test low hard limit // test low hard limit
packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, -1) packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, -1)
Assert.assertEquals(0, packet.temporaryBasalRatio) Assert.assertEquals(0, packet.temporaryBasalRatio)
Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration) Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration)
// test high hard limit // test high hard limit
packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, 550) packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, 550)
Assert.assertEquals(500, packet.temporaryBasalRatio) Assert.assertEquals(500, packet.temporaryBasalRatio)
Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM15MIN, packet.temporaryBasalDuration) Assert.assertEquals(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM15MIN, packet.temporaryBasalDuration)
// test message generation // test message generation
packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, 260) packet = DanaRS_Packet_APS_Basal_Set_Temporary_Basal(packetInjector, 260)
val generatedCode = packet.requestParams val generatedCode = packet.requestParams
Assert.assertEquals(3, generatedCode.size.toLong()) Assert.assertEquals(3, generatedCode.size.toLong())
Assert.assertEquals(4.toByte(), generatedCode[0]) Assert.assertEquals(4.toByte(), generatedCode[0])

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
@ -20,10 +22,24 @@ class DanaRS_Packet_APS_History_EventsTest : DanaRSTestBase() {
@Mock lateinit var activePlugin: ActivePluginProvider @Mock lateinit var activePlugin: ActivePluginProvider
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_APS_History_Events) {
it.aapsLogger = aapsLogger
it.rxBus = rxBus
it.resourceHelper = resourceHelper
it.activePlugin = activePlugin
it.danaRPump = danaRPump
it.detailedBolusInfoStorage = detailedBolusInfoStorage
it.sp = sp
}
}
}
@Test fun runTest() { @Test fun runTest() {
val now = DateUtil.now() val now = DateUtil.now()
val testPacket = DanaRS_Packet_APS_History_Events(aapsLogger, rxBus, resourceHelper, activePlugin, danaRPump, detailedBolusInfoStorage, sp, injector, now) val testPacket = DanaRS_Packet_APS_History_Events(packetInjector, now)
// test getRequestedParams // test getRequestedParams
val returnedValues = testPacket.requestParams val returnedValues = testPacket.requestParams
val expectedValues = getCalender(now) val expectedValues = getCalender(now)
@ -45,7 +61,7 @@ class DanaRS_Packet_APS_History_EventsTest : DanaRSTestBase() {
Assert.assertEquals("APS_HISTORY_EVENTS", testPacket.friendlyName) Assert.assertEquals("APS_HISTORY_EVENTS", testPacket.friendlyName)
} }
fun getCalender(from: Long): ByteArray { private fun getCalender(from: Long): ByteArray {
val cal = GregorianCalendar() val cal = GregorianCalendar()
if (from != 0L) cal.timeInMillis = from else cal[2000, 0, 1, 0, 0] = 0 if (from != 0L) cal.timeInMillis = from else cal[2000, 0, 1, 0, 0] = 0
val ret = ByteArray(6) val ret = ByteArray(6)

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import org.junit.Assert import org.junit.Assert
@ -12,21 +14,29 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_APS_Set_Event_HistoryTest : DanaRSTestBase() { class DanaRS_Packet_APS_Set_Event_HistoryTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_APS_Set_Event_History) {
it.aapsLogger = aapsLogger
}
}
}
@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(aapsLogger, DanaRPump.CARBS, now, -1, 0) var historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, DanaRPump.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(aapsLogger, DanaRPump.CARBS, now, 5, 0) historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, DanaRPump.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(aapsLogger, DanaRPump.CARBS, now, 150, 0) historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, DanaRPump.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(aapsLogger, DanaRPump.CARBS, now, 5, 0) historyTest = DanaRS_Packet_APS_Set_Event_History(packetInjector, DanaRPump.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)

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
@ -11,9 +13,19 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest(RxBusWrapper::class) @PrepareForTest(RxBusWrapper::class)
class DanaRS_Packet_Basal_Get_Basal_RateTest : DanaRSTestBase() { class DanaRS_Packet_Basal_Get_Basal_RateTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Basal_Get_Basal_Rate) {
it.aapsLogger = aapsLogger
it.rxBus = rxBus
it.resourceHelper = resourceHelper
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Basal_Get_Basal_Rate(aapsLogger, rxBus, resourceHelper, danaRPump) val packet = DanaRS_Packet_Basal_Get_Basal_Rate(packetInjector)
// test message decoding // test message decoding
// rate is 0.01 // rate is 0.01
val array = ByteArray(100) val array = ByteArray(100)

View file

@ -1,23 +1,32 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest()
class DanaRS_Packet_Basal_Get_Profile_Basal_RateTest : DanaRSTestBase() { class DanaRS_Packet_Basal_Get_Profile_Basal_RateTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Basal_Get_Profile_Basal_Rate) {
it.aapsLogger = aapsLogger
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val testPacket = DanaRS_Packet_Basal_Get_Profile_Basal_Rate(aapsLogger, danaRPump, 1) val testPacket = DanaRS_Packet_Basal_Get_Profile_Basal_Rate(packetInjector, 1)
// test if pumpProfile array is set right // test if pumpProfile array is set right
val basal01 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet.getBytes(createArray(50, 1.toByte()), 2, 2)) / 100.0 val basal01 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet(packetInjector).getBytes(createArray(50, 1.toByte()), 2, 2)) / 100.0
val basal05 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet.getBytes(createArray(50, 5.toByte()), 2, 2)) / 100.0 val basal05 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet(packetInjector).getBytes(createArray(50, 5.toByte()), 2, 2)) / 100.0
val basal12 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet.getBytes(createArray(50, 12.toByte()), 2, 2)) / 100.0 val basal12 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet(packetInjector).getBytes(createArray(50, 12.toByte()), 2, 2)) / 100.0
// basal rate > 1U/hr // basal rate > 1U/hr
val basal120 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet.getBytes(createArray(50, 120.toByte()), 2, 2)) / 100.0 val basal120 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet(packetInjector).getBytes(createArray(50, 120.toByte()), 2, 2)) / 100.0
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()))

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Basal_Get_Profile_NumberTest : DanaRSTestBase() { class DanaRS_Packet_Basal_Get_Profile_NumberTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Basal_Get_Profile_Number) {
it.aapsLogger = aapsLogger
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Basal_Get_Profile_Number(aapsLogger, danaRPump) val packet = DanaRS_Packet_Basal_Get_Profile_Number(packetInjector)
val array = ByteArray(100) val array = ByteArray(100)
putByteToArray(array, 0, 1.toByte()) putByteToArray(array, 0, 1.toByte())

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest : DanaRSTestBase() { class DanaRS_Packet_Basal_Get_Temporary_Basal_StateTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Basal_Get_Temporary_Basal_State) {
it.aapsLogger = aapsLogger
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump) val packet = DanaRS_Packet_Basal_Get_Temporary_Basal_State(packetInjector)
// test message decoding // test message decoding
val array = ByteArray(100) val array = ByteArray(100)
putByteToArray(array, 0, 1.toByte()) putByteToArray(array, 0, 1.toByte())

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,9 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Basal_Set_Basal_RateTest : DanaRSTestBase() { class DanaRS_Packet_Basal_Set_Basal_RateTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Basal_Set_Basal_Rate) {
it.aapsLogger = aapsLogger
}
}
}
@Test fun runTest() { @Test fun runTest() {
// test message decoding // test message decoding
val packet = DanaRS_Packet_Basal_Set_Basal_Rate(aapsLogger, createArray(24, 5.0)) val packet = DanaRS_Packet_Basal_Set_Basal_Rate(packetInjector, createArray(24, 5.0))
val requested = packet.requestParams val requested = packet.requestParams
var lookingFor = (5 * 100 and 0xff).toByte() var lookingFor = (5 * 100 and 0xff).toByte()
Assert.assertEquals(lookingFor, requested[24]) Assert.assertEquals(lookingFor, requested[24])

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,8 +12,16 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Basal_Set_Cancel_Temporary_BasalTest : DanaRSTestBase() { class DanaRS_Packet_Basal_Set_Cancel_Temporary_BasalTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal) {
it.aapsLogger = aapsLogger
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger) val packet = DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(packetInjector)
// 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

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,8 +12,16 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Basal_Set_Profile_Basal_RateTest : DanaRSTestBase() { class DanaRS_Packet_Basal_Set_Profile_Basal_RateTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Basal_Set_Profile_Basal_Rate) {
it.aapsLogger = aapsLogger
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Basal_Set_Profile_Basal_Rate(aapsLogger, 1, createArray(24, 1.0)) val packet = DanaRS_Packet_Basal_Set_Profile_Basal_Rate(packetInjector, 1, createArray(24, 1.0))
// test params // test params
val testparams = packet.requestParams val testparams = packet.requestParams
// is profile 1 // is profile 1

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,8 +12,16 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Basal_Set_Profile_NumberTest : DanaRSTestBase() { class DanaRS_Packet_Basal_Set_Profile_NumberTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Basal_Set_Profile_Number) {
it.aapsLogger = aapsLogger
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Basal_Set_Profile_Number(aapsLogger, 1) val packet = DanaRS_Packet_Basal_Set_Profile_Number(packetInjector, 1)
// test params // test params
val testparams = packet.requestParams val testparams = packet.requestParams
// is profile 1 // is profile 1

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,8 +12,16 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Basal_Set_Suspend_OffTest : DanaRSTestBase() { class DanaRS_Packet_Basal_Set_Suspend_OffTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Basal_Set_Suspend_Off) {
it.aapsLogger = aapsLogger
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Basal_Set_Suspend_Off(aapsLogger) val packet = DanaRS_Packet_Basal_Set_Suspend_Off(packetInjector)
// test message decoding // test message decoding
packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte())) packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))
Assert.assertEquals(false, packet.failed) Assert.assertEquals(false, packet.failed)

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,8 +12,16 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Basal_Set_Suspend_OnTest : DanaRSTestBase() { class DanaRS_Packet_Basal_Set_Suspend_OnTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Basal_Set_Suspend_On) {
it.aapsLogger = aapsLogger
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Basal_Set_Suspend_On(aapsLogger) val packet = DanaRS_Packet_Basal_Set_Suspend_On(packetInjector)
// test message decoding // test message decoding
packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte())) packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))
Assert.assertEquals(false, packet.failed) Assert.assertEquals(false, packet.failed)

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -7,11 +9,18 @@ import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest()
class DanaRS_Packet_Basal_Set_Temporary_BasalTest : DanaRSTestBase() { class DanaRS_Packet_Basal_Set_Temporary_BasalTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Basal_Set_Temporary_Basal) {
it.aapsLogger = aapsLogger
}
}
}
@Test fun runTest() { @Test fun runTest() {
val testPacket = DanaRS_Packet_Basal_Set_Temporary_Basal(aapsLogger, 50, 20) val testPacket = DanaRS_Packet_Basal_Set_Temporary_Basal(packetInjector, 50, 20)
// params // params
val params = testPacket.requestParams val params = testPacket.requestParams
// is ratio 50 // is ratio 50

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
@ -11,8 +13,19 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest(RxBusWrapper::class) @PrepareForTest(RxBusWrapper::class)
class DanaRS_Packet_Bolus_Get_Bolus_OptionTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Get_Bolus_OptionTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Bolus_Option) {
it.aapsLogger = aapsLogger
it.rxBus = rxBus
it.resourceHelper = resourceHelper
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Get_Bolus_Option(aapsLogger, rxBus, resourceHelper, danaRPump) val packet = DanaRS_Packet_Bolus_Get_Bolus_Option(packetInjector)
// test message decoding // test message decoding
//if dataArray is 1 pump.isExtendedBolusEnabled should be true //if dataArray is 1 pump.isExtendedBolusEnabled should be true
packet.handleMessage(createArray(21, 1.toByte())) packet.handleMessage(createArray(21, 1.toByte()))

View file

@ -1,18 +1,27 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump import info.nightscout.androidaps.plugins.pump.danaR.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
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest()
class DanaRS_Packet_Bolus_Get_CIR_CF_ArrayTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Get_CIR_CF_ArrayTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_CIR_CF_Array) {
it.aapsLogger = aapsLogger
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Get_CIR_CF_Array(aapsLogger, danaRPump) val packet = DanaRS_Packet_Bolus_Get_CIR_CF_Array(packetInjector)
// test params // test params
Assert.assertEquals(null, packet.requestParams) Assert.assertEquals(null, packet.requestParams)
// test message decoding // test message decoding

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Bolus_Get_Calculation_InformationTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Get_Calculation_InformationTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Calculation_Information) {
it.aapsLogger = aapsLogger
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Get_Calculation_Information(aapsLogger, danaRPump) val packet = DanaRS_Packet_Bolus_Get_Calculation_Information(packetInjector)
Assert.assertEquals(null, packet.requestParams) Assert.assertEquals(null, packet.requestParams)
// test message decoding // test message decoding
packet.handleMessage(createArray(24, 0.toByte())) packet.handleMessage(createArray(24, 0.toByte()))

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information) {
it.aapsLogger = aapsLogger
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(aapsLogger, danaRPump) val packet = DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(packetInjector)
Assert.assertEquals(null, packet.requestParams) Assert.assertEquals(null, packet.requestParams)
// test message decoding // test message decoding
packet.handleMessage(createArray(24, 0.toByte())) packet.handleMessage(createArray(24, 0.toByte()))

View file

@ -1,17 +1,26 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest()
class DanaRS_Packet_Bolus_Get_Dual_BolusTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Get_Dual_BolusTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Dual_Bolus) {
it.aapsLogger = aapsLogger
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Get_Dual_Bolus(aapsLogger, danaRPump) val packet = DanaRS_Packet_Bolus_Get_Dual_Bolus(packetInjector)
// test params // test params
Assert.assertEquals(null, packet.requestParams) Assert.assertEquals(null, packet.requestParams)

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Bolus_Get_Extended_BolusTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Get_Extended_BolusTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Extended_Bolus) {
it.aapsLogger = aapsLogger
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Get_Extended_Bolus(aapsLogger, danaRPump) val packet = DanaRS_Packet_Bolus_Get_Extended_Bolus(packetInjector)
// test params // test params
Assert.assertEquals(null, packet.requestParams) Assert.assertEquals(null, packet.requestParams)
// test message decoding // test message decoding

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Get_Extended_Bolus_StateTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Extended_Bolus_State) {
it.aapsLogger = aapsLogger
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump) val packet = DanaRS_Packet_Bolus_Get_Extended_Bolus_State(packetInjector)
// test params // test params
Assert.assertEquals(null, packet.requestParams) Assert.assertEquals(null, packet.requestParams)
// test message decoding // test message decoding

View file

@ -1,17 +1,26 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest()
class DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State) {
it.aapsLogger = aapsLogger
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(aapsLogger, danaRPump) val packet = DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(packetInjector)
Assert.assertEquals(null, packet.requestParams) Assert.assertEquals(null, packet.requestParams)
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 0.toByte())) packet.handleMessage(createArray(34, 0.toByte()))

View file

@ -1,17 +1,25 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest()
class DanaRS_Packet_Bolus_Get_Initial_BolusTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Get_Initial_BolusTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Initial_Bolus) {
it.aapsLogger = aapsLogger
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Get_Initial_Bolus(aapsLogger) val packet = DanaRS_Packet_Bolus_Get_Initial_Bolus(packetInjector)
Assert.assertEquals(null, packet.requestParams) Assert.assertEquals(null, packet.requestParams)
// test message decoding // test message decoding
packet.handleMessage(createArray(34, 0.toByte())) packet.handleMessage(createArray(34, 0.toByte()))

View file

@ -1,5 +1,7 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -11,8 +13,17 @@ import java.util.*
@PrepareForTest() @PrepareForTest()
class DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Get_Step_Bolus_Information) {
it.aapsLogger = aapsLogger
it.danaRPump = danaRPump
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump) val packet = DanaRS_Packet_Bolus_Get_Step_Bolus_Information(packetInjector)
val array = createArray(13, 0.toByte()) // 11 + 2 val array = createArray(13, 0.toByte()) // 11 + 2
putByteToArray(array, 0, 2) // error 2 putByteToArray(array, 0, 2) // error 2

View file

@ -1,17 +1,25 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest()
class DanaRS_Packet_Bolus_Set_Bolus_OptionTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Set_Bolus_OptionTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Set_Bolus_Option) {
it.aapsLogger = aapsLogger
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Set_Bolus_Option(aapsLogger, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) val packet = DanaRS_Packet_Bolus_Set_Bolus_Option(packetInjector, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
// test params // test params
val testparams = packet.requestParams val testparams = packet.requestParams
Assert.assertEquals(0.toByte(), testparams[0]) Assert.assertEquals(0.toByte(), testparams[0])

View file

@ -1,17 +1,25 @@
package info.nightscout.androidaps.plugins.pump.danaRS.comm package info.nightscout.androidaps.plugins.pump.danaRS.comm
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
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
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.junit4.PowerMockRunner import org.powermock.modules.junit4.PowerMockRunner
@RunWith(PowerMockRunner::class) @RunWith(PowerMockRunner::class)
@PrepareForTest()
class DanaRS_Packet_Bolus_Set_CIR_CF_ArrayTest : DanaRSTestBase() { class DanaRS_Packet_Bolus_Set_CIR_CF_ArrayTest : DanaRSTestBase() {
private val packetInjector = HasAndroidInjector {
AndroidInjector {
if (it is DanaRS_Packet_Bolus_Set_CIR_CF_Array) {
it.aapsLogger = aapsLogger
}
}
}
@Test fun runTest() { @Test fun runTest() {
val packet = DanaRS_Packet_Bolus_Set_CIR_CF_Array(aapsLogger, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) val packet = DanaRS_Packet_Bolus_Set_CIR_CF_Array(packetInjector, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
// test params // test params
val testparams = packet.requestParams val testparams = packet.requestParams
Assert.assertEquals(0.toByte(), testparams[0]) Assert.assertEquals(0.toByte(), testparams[0])

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