RS injection refactor
This commit is contained in:
parent
90f08279d3
commit
a5108ca4c4
140 changed files with 1396 additions and 646 deletions
|
@ -74,7 +74,7 @@ import info.nightscout.androidaps.utils.wizard.BolusWizard
|
|||
import info.nightscout.androidaps.utils.wizard.QuickWizardEntry
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module(includes = [AppModule.AppBindings::class, PluginsModule::class])
|
||||
@Module(includes = [AppModule.AppBindings::class, PluginsModule::class, DanaRSCommModule::class])
|
||||
open class AppModule {
|
||||
|
||||
@Provides
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -1,29 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
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 javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class DanaRSMessageHashTable @Inject constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
resourceHelper: ResourceHelper,
|
||||
danaRPump: DanaRPump,
|
||||
activePlugin: ActivePluginProvider,
|
||||
constraintChecker: ConstraintChecker,
|
||||
detailedBolusInfoStorage: DetailedBolusInfoStorage,
|
||||
sp: SP,
|
||||
injector: HasAndroidInjector
|
||||
val injector: HasAndroidInjector
|
||||
) {
|
||||
|
||||
var messages: HashMap<Int, DanaRS_Packet> = HashMap()
|
||||
|
@ -33,78 +17,78 @@ class DanaRSMessageHashTable @Inject constructor(
|
|||
}
|
||||
|
||||
fun findMessage(command: Int): DanaRS_Packet {
|
||||
return messages[command] ?: DanaRS_Packet()
|
||||
return messages[command] ?: DanaRS_Packet(injector)
|
||||
}
|
||||
|
||||
init {
|
||||
put(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger))
|
||||
put(DanaRS_Packet_Basal_Get_Basal_Rate(aapsLogger, rxBus, resourceHelper, danaRPump))
|
||||
put(DanaRS_Packet_Basal_Get_Profile_Basal_Rate(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Basal_Get_Profile_Number(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Basal_Set_Basal_Rate(aapsLogger, arrayOf()))
|
||||
put(DanaRS_Packet_Basal_Set_Profile_Basal_Rate(aapsLogger, 0, arrayOf()))
|
||||
put(DanaRS_Packet_Basal_Set_Profile_Number(aapsLogger))
|
||||
put(DanaRS_Packet_Basal_Set_Suspend_Off(aapsLogger))
|
||||
put(DanaRS_Packet_Basal_Set_Suspend_On(aapsLogger))
|
||||
put(DanaRS_Packet_Basal_Set_Temporary_Basal(aapsLogger))
|
||||
put(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Bolus_Option(aapsLogger, rxBus, resourceHelper, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Initial_Bolus(aapsLogger))
|
||||
put(DanaRS_Packet_Bolus_Get_Calculation_Information(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_CIR_CF_Array(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Dual_Bolus(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Extended_Bolus(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Set_Bolus_Option(aapsLogger))
|
||||
put(DanaRS_Packet_Bolus_Set_Initial_Bolus(aapsLogger))
|
||||
put(DanaRS_Packet_Bolus_Set_CIR_CF_Array(aapsLogger))
|
||||
put(DanaRS_Packet_Bolus_Set_Dual_Bolus(aapsLogger))
|
||||
put(DanaRS_Packet_Bolus_Set_Extended_Bolus(aapsLogger))
|
||||
put(DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(aapsLogger))
|
||||
put(DanaRS_Packet_Bolus_Set_Step_Bolus_Start(aapsLogger, danaRPump, constraintChecker))
|
||||
put(DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(aapsLogger, rxBus, resourceHelper, danaRPump))
|
||||
put(DanaRS_Packet_Etc_Keep_Connection(aapsLogger))
|
||||
put(DanaRS_Packet_Etc_Set_History_Save(aapsLogger))
|
||||
put(DanaRS_Packet_General_Delivery_Status(aapsLogger))
|
||||
put(DanaRS_Packet_General_Get_Password(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_General_Initial_Screen_Information(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Notify_Alarm(aapsLogger, resourceHelper, rxBus))
|
||||
put(DanaRS_Packet_Notify_Delivery_Complete(aapsLogger, rxBus, resourceHelper, danaRPump))
|
||||
put(DanaRS_Packet_Notify_Delivery_Rate_Display(aapsLogger, rxBus, resourceHelper, danaRPump))
|
||||
put(DanaRS_Packet_Notify_Missed_Bolus_Alarm(aapsLogger))
|
||||
put(DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Option_Get_User_Option(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Option_Set_Pump_Time(aapsLogger))
|
||||
put(DanaRS_Packet_Option_Set_User_Option(aapsLogger, danaRPump))
|
||||
//put(new DanaRS_Packet_History_());
|
||||
put(DanaRS_Packet_History_Alarm(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_All_History(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Basal(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Blood_Glucose(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Bolus(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_Review_Bolus_Avg(aapsLogger))
|
||||
put(DanaRS_Packet_History_Carbohydrate(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Daily(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_General_Get_More_Information(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_General_Get_Pump_Check(aapsLogger, danaRPump, rxBus, resourceHelper))
|
||||
put(DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_General_Get_Today_Delivery_Total(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_General_Get_User_Time_Change_Flag(aapsLogger))
|
||||
put(DanaRS_Packet_History_Prime(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Refill(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_General_Set_History_Upload_Mode(aapsLogger))
|
||||
put(DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(aapsLogger))
|
||||
put(DanaRS_Packet_History_Suspend(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Temporary(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector))
|
||||
put(DanaRS_Packet_Basal_Get_Basal_Rate(injector))
|
||||
put(DanaRS_Packet_Basal_Get_Profile_Basal_Rate(injector))
|
||||
put(DanaRS_Packet_Basal_Get_Profile_Number(injector))
|
||||
put(DanaRS_Packet_Basal_Set_Basal_Rate(injector, arrayOf()))
|
||||
put(DanaRS_Packet_Basal_Set_Profile_Basal_Rate(injector, 0, arrayOf()))
|
||||
put(DanaRS_Packet_Basal_Set_Profile_Number(injector))
|
||||
put(DanaRS_Packet_Basal_Set_Suspend_Off(injector))
|
||||
put(DanaRS_Packet_Basal_Set_Suspend_On(injector))
|
||||
put(DanaRS_Packet_Basal_Set_Temporary_Basal(injector))
|
||||
put(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
|
||||
put(DanaRS_Packet_Bolus_Get_Bolus_Option(injector))
|
||||
put(DanaRS_Packet_Bolus_Get_Initial_Bolus(injector))
|
||||
put(DanaRS_Packet_Bolus_Get_Calculation_Information(injector))
|
||||
put(DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(injector))
|
||||
put(DanaRS_Packet_Bolus_Get_CIR_CF_Array(injector))
|
||||
put(DanaRS_Packet_Bolus_Get_Dual_Bolus(injector))
|
||||
put(DanaRS_Packet_Bolus_Get_Extended_Bolus(injector))
|
||||
put(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(injector))
|
||||
put(DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(injector))
|
||||
put(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(injector))
|
||||
put(DanaRS_Packet_Bolus_Set_Bolus_Option(injector))
|
||||
put(DanaRS_Packet_Bolus_Set_Initial_Bolus(injector))
|
||||
put(DanaRS_Packet_Bolus_Set_CIR_CF_Array(injector))
|
||||
put(DanaRS_Packet_Bolus_Set_Dual_Bolus(injector))
|
||||
put(DanaRS_Packet_Bolus_Set_Extended_Bolus(injector))
|
||||
put(DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(injector))
|
||||
put(DanaRS_Packet_Bolus_Set_Step_Bolus_Start(injector))
|
||||
put(DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(injector))
|
||||
put(DanaRS_Packet_Etc_Keep_Connection(injector))
|
||||
put(DanaRS_Packet_Etc_Set_History_Save(injector))
|
||||
put(DanaRS_Packet_General_Delivery_Status(injector))
|
||||
put(DanaRS_Packet_General_Get_Password(injector))
|
||||
put(DanaRS_Packet_General_Initial_Screen_Information(injector))
|
||||
put(DanaRS_Packet_Notify_Alarm(injector))
|
||||
put(DanaRS_Packet_Notify_Delivery_Complete(injector))
|
||||
put(DanaRS_Packet_Notify_Delivery_Rate_Display(injector))
|
||||
put(DanaRS_Packet_Notify_Missed_Bolus_Alarm(injector))
|
||||
put(DanaRS_Packet_Option_Get_Pump_Time(injector))
|
||||
put(DanaRS_Packet_Option_Get_User_Option(injector))
|
||||
put(DanaRS_Packet_Option_Set_Pump_Time(injector))
|
||||
put(DanaRS_Packet_Option_Set_User_Option(injector))
|
||||
//put(new DanaRS_Packet_History_(injector));
|
||||
put(DanaRS_Packet_History_Alarm(injector))
|
||||
put(DanaRS_Packet_History_All_History(injector))
|
||||
put(DanaRS_Packet_History_Basal(injector))
|
||||
put(DanaRS_Packet_History_Blood_Glucose(injector))
|
||||
put(DanaRS_Packet_History_Bolus(injector))
|
||||
put(DanaRS_Packet_Review_Bolus_Avg(injector))
|
||||
put(DanaRS_Packet_History_Carbohydrate(injector))
|
||||
put(DanaRS_Packet_History_Daily(injector))
|
||||
put(DanaRS_Packet_General_Get_More_Information(injector))
|
||||
put(DanaRS_Packet_General_Get_Pump_Check(injector))
|
||||
put(DanaRS_Packet_General_Get_Shipping_Information(injector))
|
||||
put(DanaRS_Packet_General_Get_Today_Delivery_Total(injector))
|
||||
put(DanaRS_Packet_General_Get_User_Time_Change_Flag(injector))
|
||||
put(DanaRS_Packet_History_Prime(injector))
|
||||
put(DanaRS_Packet_History_Refill(injector))
|
||||
put(DanaRS_Packet_General_Set_History_Upload_Mode(injector))
|
||||
put(DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(injector))
|
||||
put(DanaRS_Packet_History_Suspend(injector))
|
||||
put(DanaRS_Packet_History_Temporary(injector))
|
||||
// APS
|
||||
put(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, 0))
|
||||
put(DanaRS_Packet_APS_History_Events(aapsLogger, rxBus, resourceHelper, activePlugin, danaRPump, detailedBolusInfoStorage, sp, injector, 0))
|
||||
put(DanaRS_Packet_APS_Set_Event_History(aapsLogger, 0, 0, 0, 0))
|
||||
put(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(injector, 0))
|
||||
put(DanaRS_Packet_APS_History_Events(injector, 0))
|
||||
put(DanaRS_Packet_APS_Set_Event_History(injector, 0, 0, 0, 0))
|
||||
// v3
|
||||
put(DanaRS_Packet_General_Get_Shipping_Version(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Review_Get_Pump_Dec_Ratio(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_General_Get_Shipping_Version(injector))
|
||||
put(DanaRS_Packet_Review_Get_Pump_Dec_Ratio(injector))
|
||||
}
|
||||
}
|
|
@ -3,16 +3,26 @@ package info.nightscout.androidaps.plugins.pump.danaRS.comm;
|
|||
import android.annotation.TargetApi;
|
||||
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 org.slf4j.Logger;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
|
||||
|
||||
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 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 opCode;
|
||||
|
||||
public DanaRS_Packet() {
|
||||
public DanaRS_Packet(HasAndroidInjector injector) {
|
||||
received = false;
|
||||
failed = false;
|
||||
this.injector = injector;
|
||||
injector.androidInjector().inject(this);
|
||||
}
|
||||
|
||||
public void setReceived() {
|
||||
|
@ -54,7 +66,7 @@ public class DanaRS_Packet {
|
|||
|
||||
// STATIC FUNCTIONS
|
||||
|
||||
public static int getCommand(byte[] data) {
|
||||
public int getCommand(byte[] data) {
|
||||
int type = byteArrayToInt(getBytes(data, TYPE_START, 1));
|
||||
int opCode = byteArrayToInt(getBytes(data, OPCODE_START, 1));
|
||||
return ((type & 0xFF) << 8) + (opCode & 0xFF);
|
||||
|
@ -70,7 +82,7 @@ public class DanaRS_Packet {
|
|||
return "UNKNOWN_PACKET";
|
||||
}
|
||||
|
||||
protected static byte[] getBytes(byte[] data, int srcStart, int srcLength) {
|
||||
protected byte[] getBytes(byte[] data, int srcStart, int srcLength) {
|
||||
try {
|
||||
byte[] ret = new byte[srcLength];
|
||||
|
||||
|
@ -78,7 +90,7 @@ public class DanaRS_Packet {
|
|||
|
||||
return ret;
|
||||
} catch (Exception e) {
|
||||
log.error("Unhandled exception", e);
|
||||
aapsLogger.error(LTag.PUMPBTCOMM, "Unhandled exception", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -148,7 +160,7 @@ public class DanaRS_Packet {
|
|||
return new String(strbuff, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static long dateFromBuff(byte[] buff, int offset) {
|
||||
public long dateFromBuff(byte[] buff, int offset) {
|
||||
return
|
||||
new Date(
|
||||
100 + byteArrayToInt(getBytes(buff, offset, 1)),
|
||||
|
@ -159,7 +171,7 @@ public class DanaRS_Packet {
|
|||
|
||||
@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];
|
||||
System.arraycopy(buff, offset, strbuff, 0, length);
|
||||
for (int pos = 0; pos < length; pos++)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_APS_Basal_Set_Temporary_Basal(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var percent: Int
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
var temporaryBasalRatio = 0
|
||||
var temporaryBasalDuration = 0
|
||||
|
|
|
@ -10,7 +10,6 @@ import info.nightscout.androidaps.db.TemporaryBasal
|
|||
import info.nightscout.androidaps.dialogs.FillDialog
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
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.sharedPreferences.SP
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
||||
open class DanaRS_Packet_APS_History_Events(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
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,
|
||||
injector: HasAndroidInjector,
|
||||
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 month = 0
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import java.util.*
|
||||
|
||||
class DanaRS_Packet_APS_Set_Event_History(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var packetType: Int,
|
||||
private var time: Long,
|
||||
private var param1: Int,
|
||||
private var param2: Int
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
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.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
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.notifications.Notification
|
||||
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 java.util.*
|
||||
import javax.inject.Inject
|
||||
|
||||
class DanaRS_Packet_Basal_Get_Basal_Rate(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_BASAL_RATE
|
||||
|
@ -31,7 +33,7 @@ class DanaRS_Packet_Basal_Get_Basal_Rate(
|
|||
dataIndex += dataSize
|
||||
dataSize = 1
|
||||
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
|
||||
val size = 24
|
||||
while (i < size) {
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
||||
open class DanaRS_Packet_Basal_Get_Profile_Basal_Rate(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump,
|
||||
injector: HasAndroidInjector,
|
||||
private val profileNumber: Int = 0
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
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) {
|
||||
var dataIndex = DATA_START
|
||||
var dataSize = 2
|
||||
danaRPump.pumpProfiles = Array(4) {Array(48) {0.0} }
|
||||
danaRPump.pumpProfiles = Array(4) { Array(48) { 0.0 } }
|
||||
var i = 0
|
||||
val size = 24
|
||||
while (i < size) {
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_PROFILE_NUMBER
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.ceil
|
||||
|
||||
class DanaRS_Packet_Basal_Get_Temporary_Basal_State(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__TEMPORARY_BASAL_STATE
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Basal_Set_Basal_Rate(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var profileBasalRate: Array<Double>
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
|
||||
init {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(
|
||||
private val aapsLogger: AAPSLogger
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__CANCEL_TEMPORARY_BASAL
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Basal_Set_Profile_Basal_Rate(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var profileNumber: Int,
|
||||
private var profileBasalRate: Array<Double>
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_PROFILE_BASAL_RATE
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Basal_Set_Profile_Number(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var profileNumber: Int = 0
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_PROFILE_NUMBER
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Basal_Set_Suspend_Off(
|
||||
private val aapsLogger: AAPSLogger
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_SUSPEND_OFF
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Basal_Set_Suspend_On(
|
||||
private val aapsLogger: AAPSLogger
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_SUSPEND_ON
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
open class DanaRS_Packet_Basal_Set_Temporary_Basal(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var temporaryBasalRatio: Int = 0,
|
||||
private var temporaryBasalDuration: Int = 0
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__SET_TEMPORARY_BASAL
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
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.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
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.notifications.Notification
|
||||
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 javax.inject.Inject
|
||||
|
||||
class DanaRS_Packet_Bolus_Get_Bolus_Option(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val danaRPump: DanaRPump
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
) : DanaRS_Packet() {
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_BOLUS_OPTION
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CIR_CF_ARRAY
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CALCULATION_INFORMATION
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CARBOHYDRATE_CALCULATION_INFORMATION
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_DUAL_BOLUS
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS_STATE
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_MENU_OPTION_STATE
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Bolus_Get_Initial_Bolus(
|
||||
private val aapsLogger: AAPSLogger
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_BOLUS_RATE
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import org.joda.time.DateTime
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
||||
class DanaRS_Packet_Bolus_Get_Step_Bolus_Information(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_STEP_BOLUS_INFORMATION
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Bolus_Set_Bolus_Option(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var extendedBolusOptionOnOff: Int = 0,
|
||||
private var bolusCalculationOption: 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 missedBolus04EndMin: Int = 0
|
||||
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_BOLUS_OPTION
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Bolus_Set_CIR_CF_Array(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var cir01: Int = 0,
|
||||
private var cir02: 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 cf06: Int = 0,
|
||||
private var cf07: Int = 0
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_CIR_CF_ARRAY
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Bolus_Set_Dual_Bolus(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var amount: Double = 0.0,
|
||||
private var extendedAmount: Double = 0.0,
|
||||
private var extendedBolusDurationInHalfHours: Int = 0
|
||||
) : DanaRS_Packet() {
|
||||
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_DUAL_BOLUS
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Bolus_Set_Extended_Bolus(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var extendedAmount: Double = 0.0,
|
||||
private var extendedBolusDurationInHalfHours: Int = 0
|
||||
) : DanaRS_Packet() {
|
||||
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_EXTENDED_BOLUS
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(
|
||||
private val aapsLogger: AAPSLogger
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_EXTENDED_BOLUS_CANCEL
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Bolus_Set_Initial_Bolus(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var bolusRate01: Int = 0,
|
||||
private var bolusRate02: Int = 0,
|
||||
private var bolusRate03: Int = 0,
|
||||
private var bolusRate04: Int = 0
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_BOLUS_RATE
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.interfaces.Constraint
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
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_Set_Step_Bolus_Start(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump,
|
||||
constraintChecker: ConstraintChecker,
|
||||
injector: HasAndroidInjector,
|
||||
private var amount: Double = 0.0,
|
||||
private var speed: Int = 0
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
@Inject lateinit var constraintChecker: ConstraintChecker
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_STEP_BOLUS_START
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
|
||||
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 javax.inject.Inject
|
||||
|
||||
open class DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_STEP_BOLUS_STOP
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Etc_Keep_Connection(
|
||||
private val aapsLogger: AAPSLogger
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_ETC__KEEP_CONNECTION
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Etc_Set_History_Save(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var historyType: Int = 0,
|
||||
private var historyYear: 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 historyCode: Int = 0,
|
||||
private var historyValue: Int = 0
|
||||
) : DanaRS_Packet() {
|
||||
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_ETC__SET_HISTORY_SAVE
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_General_Delivery_Status(
|
||||
private val aapsLogger: AAPSLogger
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__DELIVERY_STATUS
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
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.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import org.joda.time.DateTime
|
||||
import javax.inject.Inject
|
||||
|
||||
class DanaRS_Packet_General_Get_More_Information(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_MORE_INFORMATION
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PASSWORD
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
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.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import javax.inject.Inject
|
||||
|
||||
class DanaRS_Packet_General_Get_Pump_Check(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PUMP_CHECK
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import javax.inject.Inject
|
||||
|
||||
class DanaRS_Packet_General_Get_Shipping_Information(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_SHIPPING_INFORMATION
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
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.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import java.nio.charset.Charset
|
||||
import javax.inject.Inject
|
||||
|
||||
class DanaRS_Packet_General_Get_Shipping_Version(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_GENERAL__GET_SHIPPING_VERSION
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_TODAY_DELIVERY_TOTAL
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_General_Get_User_Time_Change_Flag(
|
||||
private val aapsLogger: AAPSLogger
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_USER_TIME_CHANGE_FLAG
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
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.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import javax.inject.Inject
|
||||
|
||||
class DanaRS_Packet_General_Initial_Screen_Information(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__INITIAL_SCREEN_INFORMATION
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_General_Set_History_Upload_Mode(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var mode: Int = 0
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SET_HISTORY_UPLOAD_MODE
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SET_USER_TIME_CHANGE_FLAG_CLEAR
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "New message")
|
||||
}
|
||||
|
||||
override fun handleMessage(data: ByteArray) {
|
||||
val result = intFromBuff(data, 0, 1)
|
||||
if (result == 0) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.db.DanaRHistoryRecord
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
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 org.joda.time.DateTime
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
||||
abstract class DanaRS_Packet_History_(
|
||||
protected val aapsLogger: AAPSLogger,
|
||||
protected val rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
protected val from: Long
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
|
||||
protected var year = 0
|
||||
protected var month = 0
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
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(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(injector, from) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__ALARM
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
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(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(injector, from) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__ALL_HISTORY
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
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(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(injector, from) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BASAL
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
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(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(injector, from) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BLOOD_GLUCOSE
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
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(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(injector, from) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BOLUS
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
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(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(injector, from) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__CARBOHYDRATE
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
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(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(injector, from) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__DAILY
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
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(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(injector, from) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__PRIME
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
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(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(injector, from) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__REFILL
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
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.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
|
||||
class DanaRS_Packet_History_Suspend @JvmOverloads constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(injector, from) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__SUSPEND
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
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(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
injector: HasAndroidInjector,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(injector, from) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__TEMPORARY
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
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.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||
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 javax.inject.Inject
|
||||
|
||||
class DanaRS_Packet_Notify_Alarm(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val rxBus: RxBusWrapper
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
|
||||
init {
|
||||
type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
|
||||
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 javax.inject.Inject
|
||||
import kotlin.math.min
|
||||
|
||||
class DanaRS_Packet_Notify_Delivery_Complete(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
|
||||
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 javax.inject.Inject
|
||||
import kotlin.math.min
|
||||
|
||||
class DanaRS_Packet_Notify_Delivery_Rate_Display(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val rxBus: RxBusWrapper,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Notify_Missed_Bolus_Alarm(
|
||||
private val aapsLogger: AAPSLogger
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
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.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import org.joda.time.DateTime
|
||||
import javax.inject.Inject
|
||||
|
||||
class DanaRS_Packet_Option_Get_Pump_Time(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__GET_PUMP_TIME
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__GET_USER_OPTION
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
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.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import org.joda.time.DateTime
|
||||
|
||||
class DanaRS_Packet_Option_Set_Pump_Time(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
injector: HasAndroidInjector,
|
||||
private var time: Long = 0
|
||||
) : DanaRS_Packet() {
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
var error = 0
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
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(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__SET_USER_OPTION
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
|
||||
class DanaRS_Packet_Review_Bolus_Avg(
|
||||
private val aapsLogger: AAPSLogger
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__BOLUS_AVG
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
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.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import javax.inject.Inject
|
||||
|
||||
class DanaRS_Packet_Review_Get_Pump_Dec_Ratio(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
) : DanaRS_Packet() {
|
||||
injector: HasAndroidInjector
|
||||
) : DanaRS_Packet(injector) {
|
||||
|
||||
@Inject lateinit var danaRPump: DanaRPump
|
||||
|
||||
init {
|
||||
opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PUMP_DEC_RATIO
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.os.SystemClock
|
||||
import android.util.Base64
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
|
@ -33,6 +34,7 @@ import javax.inject.Singleton
|
|||
|
||||
@Singleton
|
||||
class BLEComm @Inject internal constructor(
|
||||
private val injector: HasAndroidInjector,
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val resourceHelper: ResourceHelper,
|
||||
private val context: Context,
|
||||
|
@ -695,7 +697,7 @@ class BLEComm @Inject internal constructor(
|
|||
// process common packet response
|
||||
private fun processMessage(decryptedBuffer: ByteArray) {
|
||||
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) {
|
||||
// it's response to last message
|
||||
processedMessage
|
||||
|
|
|
@ -112,25 +112,25 @@ class DanaRSService : DaggerService() {
|
|||
fun readPumpStatus() {
|
||||
try {
|
||||
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)))
|
||||
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)))
|
||||
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)))
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump))
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
|
||||
danaRPump.lastConnection = System.currentTimeMillis()
|
||||
val profile = profileFunction.getProfile()
|
||||
val pump = activePlugin.activePump
|
||||
if (profile != null && abs(danaRPump.currentBasal - profile.basal) >= pump.pumpDescription.basalStep) {
|
||||
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)) {
|
||||
rxBus.send(EventProfileNeedsUpdate())
|
||||
}
|
||||
}
|
||||
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
|
||||
if (danaRPump.pumpTime == 0L) {
|
||||
// initial handshake was not successful
|
||||
|
@ -143,14 +143,14 @@ class DanaRSService : DaggerService() {
|
|||
val now = System.currentTimeMillis()
|
||||
if (danaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !pump.isInitialized) {
|
||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)))
|
||||
sendMessage(DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump)) // serial no
|
||||
sendMessage(DanaRS_Packet_General_Get_Pump_Check(aapsLogger, danaRPump, rxBus, resourceHelper)) // firmware
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Profile_Number(aapsLogger, danaRPump))
|
||||
sendMessage(DanaRS_Packet_Bolus_Get_Bolus_Option(aapsLogger, rxBus, resourceHelper, danaRPump)) // isExtendedEnabled
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Basal_Rate(aapsLogger, rxBus, resourceHelper, danaRPump)) // basal profile, basalStep, maxBasal
|
||||
sendMessage(DanaRS_Packet_Bolus_Get_Calculation_Information(aapsLogger, danaRPump)) // target
|
||||
sendMessage(DanaRS_Packet_Bolus_Get_CIR_CF_Array(aapsLogger, danaRPump))
|
||||
sendMessage(DanaRS_Packet_Option_Get_User_Option(aapsLogger, danaRPump)) // Getting user options
|
||||
sendMessage(DanaRS_Packet_General_Get_Shipping_Information(injector)) // serial no
|
||||
sendMessage(DanaRS_Packet_General_Get_Pump_Check(injector)) // firmware
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Profile_Number(injector))
|
||||
sendMessage(DanaRS_Packet_Bolus_Get_Bolus_Option(injector)) // isExtendedEnabled
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Basal_Rate(injector)) // basal profile, basalStep, maxBasal
|
||||
sendMessage(DanaRS_Packet_Bolus_Get_Calculation_Information(injector)) // target
|
||||
sendMessage(DanaRS_Packet_Bolus_Get_CIR_CF_Array(injector))
|
||||
sendMessage(DanaRS_Packet_Option_Get_User_Option(injector)) // Getting user options
|
||||
danaRPump.lastSettingsRead = now
|
||||
}
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds")
|
||||
|
@ -172,13 +172,13 @@ class DanaRSService : DaggerService() {
|
|||
return
|
||||
} else {
|
||||
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 {
|
||||
waitForWholeMinute() // Dana can set only whole minute
|
||||
// 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
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds")
|
||||
}
|
||||
|
@ -211,10 +211,10 @@ class DanaRSService : DaggerService() {
|
|||
SystemClock.sleep(1000)
|
||||
val msg: DanaRS_Packet_APS_History_Events
|
||||
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")
|
||||
} 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))
|
||||
}
|
||||
sendMessage(msg)
|
||||
|
@ -228,7 +228,7 @@ class DanaRSService : DaggerService() {
|
|||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -243,11 +243,11 @@ class DanaRSService : DaggerService() {
|
|||
danaRPump.bolusStopped = false
|
||||
danaRPump.bolusStopForced = false
|
||||
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) {
|
||||
// MsgSetCarbsEntry msg = new MsgSetCarbsEntry(carbTime, carbs); ####
|
||||
// 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)
|
||||
lastHistoryFetched = min(lastHistoryFetched, carbTime - T.mins(1).msecs())
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ class DanaRSService : DaggerService() {
|
|||
override fun run() {
|
||||
// reread bolus status
|
||||
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
|
||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.disconnecting)))
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ class DanaRSService : DaggerService() {
|
|||
|
||||
fun bolusStop() {
|
||||
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
|
||||
if (isConnected) {
|
||||
sendMessage(stop)
|
||||
|
@ -318,13 +318,13 @@ class DanaRSService : DaggerService() {
|
|||
if (!isConnected) return false
|
||||
if (danaRPump.isTempBasalInProgress) {
|
||||
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)
|
||||
}
|
||||
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)
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump))
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
|
||||
loadEvents()
|
||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
|
||||
return true
|
||||
|
@ -333,12 +333,12 @@ class DanaRSService : DaggerService() {
|
|||
fun highTempBasal(percent: Int): Boolean {
|
||||
if (danaRPump.isTempBasalInProgress) {
|
||||
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)
|
||||
}
|
||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
||||
sendMessage(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, percent))
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump))
|
||||
sendMessage(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(injector, percent))
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
|
||||
loadEvents()
|
||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
|
||||
return true
|
||||
|
@ -351,12 +351,12 @@ class DanaRSService : DaggerService() {
|
|||
}
|
||||
if (danaRPump.isTempBasalInProgress) {
|
||||
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)
|
||||
}
|
||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
||||
sendMessage(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, percent))
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump))
|
||||
sendMessage(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(injector, percent))
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
|
||||
loadEvents()
|
||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
|
||||
return true
|
||||
|
@ -365,8 +365,8 @@ class DanaRSService : DaggerService() {
|
|||
fun tempBasalStop(): Boolean {
|
||||
if (!isConnected) return false
|
||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
||||
sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger))
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump))
|
||||
sendMessage(DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(injector))
|
||||
sendMessage(DanaRS_Packet_Basal_Get_Temporary_Basal_State(injector))
|
||||
loadEvents()
|
||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
|
||||
return true
|
||||
|
@ -375,9 +375,9 @@ class DanaRSService : DaggerService() {
|
|||
fun extendedBolus(insulin: Double, durationInHalfHours: Int): Boolean {
|
||||
if (!isConnected) return false
|
||||
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)
|
||||
sendMessage(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump))
|
||||
sendMessage(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(injector))
|
||||
loadEvents()
|
||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
|
||||
return true
|
||||
|
@ -386,8 +386,8 @@ class DanaRSService : DaggerService() {
|
|||
fun extendedBolusStop(): Boolean {
|
||||
if (!isConnected) return false
|
||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus)))
|
||||
sendMessage(DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(aapsLogger))
|
||||
sendMessage(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump))
|
||||
sendMessage(DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(injector))
|
||||
sendMessage(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(injector))
|
||||
loadEvents()
|
||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
|
||||
return true
|
||||
|
@ -397,9 +397,9 @@ class DanaRSService : DaggerService() {
|
|||
if (!isConnected) return false
|
||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.updatingbasalrates)))
|
||||
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)
|
||||
val msgActivate = DanaRS_Packet_Basal_Set_Profile_Number(aapsLogger, 0)
|
||||
val msgActivate = DanaRS_Packet_Basal_Set_Profile_Number(injector, 0)
|
||||
sendMessage(msgActivate)
|
||||
danaRPump.lastSettingsRead = 0 // force read full settings
|
||||
readPumpStatus()
|
||||
|
@ -412,25 +412,25 @@ class DanaRSService : DaggerService() {
|
|||
if (!isConnected) return result
|
||||
var msg: DanaRS_Packet_History_? = null
|
||||
when (type) {
|
||||
RecordTypes.RECORD_TYPE_ALARM -> msg = DanaRS_Packet_History_Alarm(aapsLogger, rxBus)
|
||||
RecordTypes.RECORD_TYPE_PRIME -> msg = DanaRS_Packet_History_Prime(aapsLogger, rxBus)
|
||||
RecordTypes.RECORD_TYPE_BASALHOUR -> msg = DanaRS_Packet_History_Basal(aapsLogger, rxBus)
|
||||
RecordTypes.RECORD_TYPE_BOLUS -> msg = DanaRS_Packet_History_Bolus(aapsLogger, rxBus)
|
||||
RecordTypes.RECORD_TYPE_CARBO -> msg = DanaRS_Packet_History_Carbohydrate(aapsLogger, rxBus)
|
||||
RecordTypes.RECORD_TYPE_DAILY -> msg = DanaRS_Packet_History_Daily(aapsLogger, rxBus)
|
||||
RecordTypes.RECORD_TYPE_GLUCOSE -> msg = DanaRS_Packet_History_Blood_Glucose(aapsLogger, rxBus)
|
||||
RecordTypes.RECORD_TYPE_REFILL -> msg = DanaRS_Packet_History_Refill(aapsLogger, rxBus)
|
||||
RecordTypes.RECORD_TYPE_SUSPEND -> msg = DanaRS_Packet_History_Suspend(aapsLogger, rxBus)
|
||||
RecordTypes.RECORD_TYPE_ALARM -> msg = DanaRS_Packet_History_Alarm(injector)
|
||||
RecordTypes.RECORD_TYPE_PRIME -> msg = DanaRS_Packet_History_Prime(injector)
|
||||
RecordTypes.RECORD_TYPE_BASALHOUR -> msg = DanaRS_Packet_History_Basal(injector)
|
||||
RecordTypes.RECORD_TYPE_BOLUS -> msg = DanaRS_Packet_History_Bolus(injector)
|
||||
RecordTypes.RECORD_TYPE_CARBO -> msg = DanaRS_Packet_History_Carbohydrate(injector)
|
||||
RecordTypes.RECORD_TYPE_DAILY -> msg = DanaRS_Packet_History_Daily(injector)
|
||||
RecordTypes.RECORD_TYPE_GLUCOSE -> msg = DanaRS_Packet_History_Blood_Glucose(injector)
|
||||
RecordTypes.RECORD_TYPE_REFILL -> msg = DanaRS_Packet_History_Refill(injector)
|
||||
RecordTypes.RECORD_TYPE_SUSPEND -> msg = DanaRS_Packet_History_Suspend(injector)
|
||||
}
|
||||
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)
|
||||
sendMessage(msg)
|
||||
while (!msg.done && isConnected) {
|
||||
SystemClock.sleep(100)
|
||||
}
|
||||
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.comment = "OK"
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
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.Constraint
|
||||
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.plugins.pump.danaRS.DanaRSPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.encryption.BleEncryption
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -16,19 +17,36 @@ import org.powermock.core.classloader.annotations.PrepareForTest
|
|||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class, DanaRSPlugin::class)
|
||||
@PrepareForTest(ConstraintChecker::class, DetailedBolusInfoStorage::class)
|
||||
class DanaRSMessageHashTableTest : DanaRSTestBase() {
|
||||
|
||||
@Mock lateinit var activePlugin: ActivePluginProvider
|
||||
@Mock lateinit var constraintChecker: ConstraintChecker
|
||||
@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
|
||||
fun runTest() {
|
||||
`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
|
||||
|
||||
val danaRSMessageHashTable = DanaRSMessageHashTable(aapsLogger, rxBus, resourceHelper, danaRPump, activePlugin, constraintChecker, detailedBolusInfoStorage, sp, injector)
|
||||
val forTesting: DanaRS_Packet = DanaRS_Packet_APS_Set_Event_History(aapsLogger, DanaRPump.CARBS, 0, 0, 0)
|
||||
val danaRSMessageHashTable = DanaRSMessageHashTable(packetInjector)
|
||||
val forTesting: DanaRS_Packet = DanaRS_Packet_APS_Set_Event_History(packetInjector, DanaRPump.CARBS, 0, 0, 0)
|
||||
val testPacket: DanaRS_Packet = danaRSMessageHashTable.findMessage(forTesting.command)
|
||||
Assert.assertEquals(BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY.toLong(), testPacket.getOpCode().toLong())
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,30 +12,38 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
|
||||
// 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(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration)
|
||||
//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(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration)
|
||||
// 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(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM15MIN, packet.temporaryBasalDuration)
|
||||
// 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(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM30MIN, packet.temporaryBasalDuration)
|
||||
// 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(DanaRS_Packet_APS_Basal_Set_Temporary_Basal.PARAM15MIN, packet.temporaryBasalDuration)
|
||||
// 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
|
||||
Assert.assertEquals(3, generatedCode.size.toLong())
|
||||
Assert.assertEquals(4.toByte(), generatedCode[0])
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
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.plugins.bus.RxBusWrapper
|
||||
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 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() {
|
||||
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
|
||||
val returnedValues = testPacket.requestParams
|
||||
val expectedValues = getCalender(now)
|
||||
|
@ -45,7 +61,7 @@ class DanaRS_Packet_APS_History_EventsTest : DanaRSTestBase() {
|
|||
Assert.assertEquals("APS_HISTORY_EVENTS", testPacket.friendlyName)
|
||||
}
|
||||
|
||||
fun getCalender(from: Long): ByteArray {
|
||||
private fun getCalender(from: Long): ByteArray {
|
||||
val cal = GregorianCalendar()
|
||||
if (from != 0L) cal.timeInMillis = from else cal[2000, 0, 1, 0, 0] = 0
|
||||
val ret = ByteArray(6)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
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.utils.DateUtil
|
||||
import org.junit.Assert
|
||||
|
@ -12,21 +14,29 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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
|
||||
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
|
||||
Assert.assertEquals(0.toByte(), testparams[8])
|
||||
// 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
|
||||
Assert.assertEquals(5.toByte(), testparams[8])
|
||||
// 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
|
||||
Assert.assertEquals(150.toByte(), testparams[8])
|
||||
// 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
|
||||
Assert.assertEquals(5.toByte(), testparams[8])
|
||||
Assert.assertEquals(11, testparams.size)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -11,9 +13,19 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(RxBusWrapper::class)
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Basal_Get_Basal_Rate(aapsLogger, rxBus, resourceHelper, danaRPump)
|
||||
val packet = DanaRS_Packet_Basal_Get_Basal_Rate(packetInjector)
|
||||
// test message decoding
|
||||
// rate is 0.01
|
||||
val array = ByteArray(100)
|
||||
|
|
|
@ -1,23 +1,32 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
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() {
|
||||
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
|
||||
val basal01 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet.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 basal12 = DanaRS_Packet.byteArrayToInt(DanaRS_Packet.getBytes(createArray(50, 12.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(packetInjector).getBytes(createArray(50, 5.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
|
||||
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
|
||||
assertEquals(1.toByte(), params[0])
|
||||
testPacket.handleMessage(createArray(50, 0.toByte()))
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Basal_Get_Profile_Number(aapsLogger, danaRPump)
|
||||
val packet = DanaRS_Packet_Basal_Get_Profile_Number(packetInjector)
|
||||
|
||||
val array = ByteArray(100)
|
||||
putByteToArray(array, 0, 1.toByte())
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump)
|
||||
val packet = DanaRS_Packet_Basal_Get_Temporary_Basal_State(packetInjector)
|
||||
// test message decoding
|
||||
val array = ByteArray(100)
|
||||
putByteToArray(array, 0, 1.toByte())
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,9 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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 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
|
||||
var lookingFor = (5 * 100 and 0xff).toByte()
|
||||
Assert.assertEquals(lookingFor, requested[24])
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,8 +12,16 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger)
|
||||
val packet = DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(packetInjector)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(3, 0.toByte()))
|
||||
Assert.assertEquals(false, packet.failed)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,8 +12,16 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
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
|
||||
val testparams = packet.requestParams
|
||||
// is profile 1
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,8 +12,16 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Basal_Set_Profile_Number(aapsLogger, 1)
|
||||
val packet = DanaRS_Packet_Basal_Set_Profile_Number(packetInjector, 1)
|
||||
// test params
|
||||
val testparams = packet.requestParams
|
||||
// is profile 1
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,8 +12,16 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Basal_Set_Suspend_Off(aapsLogger)
|
||||
val packet = DanaRS_Packet_Basal_Set_Suspend_Off(packetInjector)
|
||||
// test message decoding
|
||||
packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))
|
||||
Assert.assertEquals(false, packet.failed)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,8 +12,16 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Basal_Set_Suspend_On(aapsLogger)
|
||||
val packet = DanaRS_Packet_Basal_Set_Suspend_On(packetInjector)
|
||||
// test message decoding
|
||||
packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte()))
|
||||
Assert.assertEquals(false, packet.failed)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -7,11 +9,18 @@ import org.powermock.core.classloader.annotations.PrepareForTest
|
|||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
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() {
|
||||
val testPacket = DanaRS_Packet_Basal_Set_Temporary_Basal(aapsLogger, 50, 20)
|
||||
val testPacket = DanaRS_Packet_Basal_Set_Temporary_Basal(packetInjector, 50, 20)
|
||||
// params
|
||||
val params = testPacket.requestParams
|
||||
// is ratio 50
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
@ -11,8 +13,19 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest(RxBusWrapper::class)
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Bolus_Get_Bolus_Option(aapsLogger, rxBus, resourceHelper, danaRPump)
|
||||
val packet = DanaRS_Packet_Bolus_Get_Bolus_Option(packetInjector)
|
||||
// test message decoding
|
||||
//if dataArray is 1 pump.isExtendedBolusEnabled should be true
|
||||
packet.handleMessage(createArray(21, 1.toByte()))
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
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 org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Bolus_Get_CIR_CF_Array(aapsLogger, danaRPump)
|
||||
val packet = DanaRS_Packet_Bolus_Get_CIR_CF_Array(packetInjector)
|
||||
// test params
|
||||
Assert.assertEquals(null, packet.requestParams)
|
||||
// test message decoding
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Bolus_Get_Calculation_Information(aapsLogger, danaRPump)
|
||||
val packet = DanaRS_Packet_Bolus_Get_Calculation_Information(packetInjector)
|
||||
Assert.assertEquals(null, packet.requestParams)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(24, 0.toByte()))
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
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)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(24, 0.toByte()))
|
||||
|
|
|
@ -1,17 +1,26 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Bolus_Get_Dual_Bolus(aapsLogger, danaRPump)
|
||||
val packet = DanaRS_Packet_Bolus_Get_Dual_Bolus(packetInjector)
|
||||
// test params
|
||||
Assert.assertEquals(null, packet.requestParams)
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Bolus_Get_Extended_Bolus(aapsLogger, danaRPump)
|
||||
val packet = DanaRS_Packet_Bolus_Get_Extended_Bolus(packetInjector)
|
||||
// test params
|
||||
Assert.assertEquals(null, packet.requestParams)
|
||||
// test message decoding
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -10,8 +12,17 @@ import org.powermock.modules.junit4.PowerMockRunner
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump)
|
||||
val packet = DanaRS_Packet_Bolus_Get_Extended_Bolus_State(packetInjector)
|
||||
// test params
|
||||
Assert.assertEquals(null, packet.requestParams)
|
||||
// test message decoding
|
||||
|
|
|
@ -1,17 +1,26 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
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() {
|
||||
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)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 0.toByte()))
|
||||
|
|
|
@ -1,17 +1,25 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
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() {
|
||||
val packet = DanaRS_Packet_Bolus_Get_Initial_Bolus(aapsLogger)
|
||||
val packet = DanaRS_Packet_Bolus_Get_Initial_Bolus(packetInjector)
|
||||
Assert.assertEquals(null, packet.requestParams)
|
||||
// test message decoding
|
||||
packet.handleMessage(createArray(34, 0.toByte()))
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -11,8 +13,17 @@ import java.util.*
|
|||
@PrepareForTest()
|
||||
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() {
|
||||
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
|
||||
putByteToArray(array, 0, 2) // error 2
|
||||
|
|
|
@ -1,17 +1,25 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
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() {
|
||||
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
|
||||
val testparams = packet.requestParams
|
||||
Assert.assertEquals(0.toByte(), testparams[0])
|
||||
|
|
|
@ -1,17 +1,25 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRS.comm
|
||||
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest
|
||||
import org.powermock.modules.junit4.PowerMockRunner
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest()
|
||||
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() {
|
||||
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
|
||||
val testparams = packet.requestParams
|
||||
Assert.assertEquals(0.toByte(), testparams[0])
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue