From 311f9dd119cc91d79880e061489c39e1b925e3a6 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 10 May 2020 11:03:19 +0200 Subject: [PATCH] danar module --- app/build.gradle | 1 + .../nightscout/androidaps/RealPumpTest.kt | 4 +- app/src/main/AndroidManifest.xml | 6 +- .../activities/MyPreferenceFragment.kt | 6 +- .../dependencyInjection/AppModule.kt | 2 + .../dependencyInjection/PluginsModule.kt | 12 +-- .../dependencyInjection/ServicesModule.kt | 10 +-- .../configBuilder/ConfigBuilderPlugin.kt | 4 +- .../general/wear/ActionStringHandler.kt | 10 +-- .../services/AbstractSerialIOThread.java | 13 --- .../plugins/pump/virtual/VirtualPumpPlugin.kt | 1 - app/src/main/res/values/strings.xml | 14 --- .../androidaps/danars/comm/DanaRSTestBase.kt | 2 +- .../interfaces/ConstraintsCheckerTest.kt | 10 +-- .../plugins/pump/danaR/DanaRPluginTest.kt | 6 +- .../plugins/pump/danaR/comm/DanaRTestBase.kt | 12 ++- .../pump/danaR/comm/MessageHashTableRTest.kt | 7 +- .../danaR/comm/MessageOriginalNamesTest.kt | 1 + .../pump/danaR/comm/MsgBolusProgressTest.kt | 3 +- .../pump/danaR/comm/MsgBolusStartTest.kt | 1 + .../danaR/comm/MsgBolusStartWithSpeedTest.kt | 1 + .../pump/danaR/comm/MsgBolusStopTest.kt | 1 + .../pump/danaR/comm/MsgCheckValueTest.kt | 4 +- .../plugins/pump/danaR/comm/MsgErrorTest.kt | 1 + .../pump/danaR/comm/MsgHistoryAlarmTest.kt | 3 +- .../pump/danaR/comm/MsgHistoryAllDoneTest.kt | 1 + .../pump/danaR/comm/MsgHistoryAllTest.kt | 3 +- .../danaR/comm/MsgHistoryBasalHourTest.kt | 3 +- .../pump/danaR/comm/MsgHistoryBolusTest.kt | 3 +- .../pump/danaR/comm/MsgHistoryCarboTest.kt | 3 +- .../danaR/comm/MsgHistoryDailyInsulinTest.kt | 3 +- .../pump/danaR/comm/MsgHistoryDoneTest.kt | 1 + .../pump/danaR/comm/MsgHistoryErrorTest.kt | 3 +- .../pump/danaR/comm/MsgHistoryGlucoseTest.kt | 3 +- .../pump/danaR/comm/MsgHistoryNewDoneTest.kt | 1 + .../pump/danaR/comm/MsgHistoryNewTest.kt | 3 +- .../pump/danaR/comm/MsgHistoryRefillTest.kt | 3 +- .../pump/danaR/comm/MsgHistorySuspendTest.kt | 3 +- .../danaR/comm/MsgInitConnStatusBasicTest.kt | 1 + .../danaR/comm/MsgInitConnStatusBolusTest.kt | 1 + .../danaR/comm/MsgInitConnStatusOptionTest.kt | 1 + .../danaR/comm/MsgInitConnStatusTimeTest.kt | 7 +- .../pump/danaR/comm/MsgPCCommStartTest.kt | 1 + .../pump/danaR/comm/MsgPCCommStopTest.kt | 1 + .../comm/MsgSetActivateBasalProfileTest.kt | 1 + .../pump/danaR/comm/MsgSetBasalProfileTest.kt | 1 + .../pump/danaR/comm/MsgSetCarbsEntryTest.kt | 1 + .../comm/MsgSetExtendedBolusStartTest.kt | 1 + .../danaR/comm/MsgSetExtendedBolusStopTest.kt | 1 + .../comm/MsgSetSingleBasalProfileTest.kt | 1 + .../danaR/comm/MsgSetTempBasalStartTest.kt | 1 + .../plugins/pump/danaR/comm/MsgSetTimeTest.kt | 1 + .../pump/danaR/comm/MsgSetUserOptionsTest.kt | 1 + .../danaR/comm/MsgSettingActiveProfileTest.kt | 2 + .../comm/MsgSettingBasalProfileAllTest.kt | 1 + .../pump/danaR/comm/MsgSettingBasalTest.kt | 6 +- .../pump/danaR/comm/MsgSettingGlucoseTest.kt | 1 + .../danaR/comm/MsgSettingMaxValuesTest.kt | 2 + .../pump/danaR/comm/MsgSettingMealTest.kt | 8 +- .../comm/MsgSettingProfileRatiosAllTest.kt | 2 + .../danaR/comm/MsgSettingProfileRatiosTest.kt | 2 + .../pump/danaR/comm/MsgSettingPumpTimeTest.kt | 2 + .../danaR/comm/MsgSettingShippingInfoTest.kt | 2 + .../danaR/comm/MsgSettingUserOptionsTest.kt | 3 +- .../pump/danaR/comm/MsgStatusBasicTest.kt | 2 + .../danaR/comm/MsgStatusBolusExtendedTest.kt | 1 + .../pump/danaR/comm/MsgStatusProfileTest.kt | 2 + .../pump/danaR/comm/MsgStatusTempBasalTest.kt | 1 + .../plugins/pump/danaR/comm/MsgStatusTest.kt | 2 + .../pump/danaRKorean/DanaRKoreanPluginTest.kt | 9 +- .../comm/MessageHashTableRKoreanTest.kt | 9 +- .../plugins/pump/danaRv2/DanaRv2PluginTest.kt | 9 +- .../danaRv2/comm/MessageHashTable_rv2Test.kt | 12 +-- .../pump/danaRv2/comm/MsgCheckValue_v2Test.kt | 8 +- .../danaRv2/comm/MsgHistoryEvents_v2Test.kt | 6 +- .../comm/MsgSetAPSTempBasalStart_v2Test.kt | 16 ++-- .../danaRv2/comm/MsgSetHistoryEntry_v2Test.kt | 2 +- .../pump/danaRv2/comm/MsgStatusAPS_v2Test.kt | 4 +- .../comm/MsgStatusBolusExtended_v2Test.kt | 4 +- .../danaRv2/comm/MsgStatusTempBasal_v2Test.kt | 2 +- .../androidaps/events/EventBTChange.kt | 0 .../events/EventPreferenceChange.kt | 2 - .../androidaps/events/EventRebuildTabs.kt | 0 .../interfaces/ConfigBuilderInterface.kt | 5 ++ .../info/nightscout/androidaps/utils/CRC.java | 0 dana/src/main/res/values/strings.xml | 14 +++ danar/.gitignore | 1 + danar/build.gradle | 82 +++++++++++++++++ danar/consumer-rules.pro | 0 danar/proguard-rules.pro | 21 +++++ danar/src/main/AndroidManifest.xml | 5 ++ .../danaRKorean/DanaRKoreanPlugin.java | 45 +++++----- .../comm/MessageHashTableRKorean.kt | 34 ++++---- .../danaRKorean/comm/MsgCheckValue_k.kt | 10 +-- .../comm/MsgInitConnStatusBasic_k.kt | 10 +-- .../comm/MsgInitConnStatusBolus_k.kt | 10 +-- .../comm/MsgInitConnStatusTime_k.kt | 18 ++-- .../comm/MsgSettingBasalProfileAll_k.kt | 8 +- .../danaRKorean/comm/MsgSettingBasal_k.kt | 12 +-- .../danaRKorean/comm/MsgStatusBasic_k.kt | 8 +- .../danaRKorean/comm/MsgStatus_k.kt | 8 +- .../services/DanaRKoreanExecutionService.java | 56 ++++++------ .../androidaps}/danaRv2/DanaRv2Plugin.java | 42 ++++----- .../danaRv2/comm/MessageHashTableRv2.kt | 50 +++++------ .../danaRv2/comm/MsgCheckValue_v2.kt | 20 ++--- .../danaRv2/comm/MsgHistoryEvents_v2.kt | 33 ++++--- .../comm/MsgSetAPSTempBasalStart_v2.kt | 4 +- .../danaRv2/comm/MsgSetHistoryEntry_v2.kt | 4 +- .../danaRv2/comm/MsgStatusAPS_v2.kt | 6 +- .../danaRv2/comm/MsgStatusBolusExtended_v2.kt | 6 +- .../danaRv2/comm/MsgStatusTempBasal_v2.kt | 6 +- .../services/DanaRv2ExecutionService.java | 87 +++++++++---------- .../danar}/AbstractDanaRPlugin.java | 41 +++++---- .../danar}/BluetoothDevicePreference.java | 2 +- .../androidaps/danar}/DanaRPlugin.java | 42 ++++----- .../androidaps/danar}/SerialIOThread.java | 64 ++++++-------- .../androidaps/danar}/comm/MessageBase.java | 2 +- .../danar}/comm/MessageHashTableBase.kt | 2 +- .../danar}/comm/MessageHashTableR.kt | 38 ++++---- .../danar}/comm/MessageOriginalNames.kt | 2 +- .../danar}/comm/MsgBolusProgress.kt | 8 +- .../androidaps/danar}/comm/MsgBolusStart.kt | 4 +- .../danar}/comm/MsgBolusStartWithSpeed.kt | 4 +- .../androidaps/danar}/comm/MsgBolusStop.kt | 8 +- .../androidaps/danar}/comm/MsgCheckValue.kt | 8 +- .../androidaps/danar}/comm/MsgError.kt | 8 +- .../androidaps/danar}/comm/MsgHistoryAlarm.kt | 8 +- .../androidaps/danar}/comm/MsgHistoryAll.kt | 11 +-- .../danar}/comm/MsgHistoryAllDone.kt | 4 +- .../danar}/comm/MsgHistoryBasalHour.kt | 8 +- .../androidaps/danar}/comm/MsgHistoryBolus.kt | 8 +- .../androidaps/danar}/comm/MsgHistoryCarbo.kt | 8 +- .../danar}/comm/MsgHistoryDailyInsulin.kt | 8 +- .../androidaps/danar}/comm/MsgHistoryDone.kt | 4 +- .../androidaps/danar}/comm/MsgHistoryError.kt | 8 +- .../danar}/comm/MsgHistoryGlucose.kt | 8 +- .../androidaps/danar}/comm/MsgHistoryNew.kt | 8 +- .../danar}/comm/MsgHistoryNewDone.kt | 4 +- .../danar}/comm/MsgHistoryRefill.kt | 8 +- .../danar}/comm/MsgHistorySuspend.kt | 8 +- .../danar}/comm/MsgInitConnStatusBasic.kt | 4 +- .../danar}/comm/MsgInitConnStatusBolus.kt | 8 +- .../danar}/comm/MsgInitConnStatusOption.kt | 8 +- .../danar}/comm/MsgInitConnStatusTime.kt | 16 ++-- .../androidaps/danar}/comm/MsgPCCommStart.kt | 2 +- .../androidaps/danar}/comm/MsgPCCommStop.kt | 2 +- .../danar}/comm/MsgSetActivateBasalProfile.kt | 2 +- .../danar}/comm/MsgSetBasalProfile.kt | 4 +- .../danar}/comm/MsgSetCarbsEntry.kt | 2 +- .../danar}/comm/MsgSetExtendedBolusStart.kt | 2 +- .../danar}/comm/MsgSetExtendedBolusStop.kt | 2 +- .../danar}/comm/MsgSetSingleBasalProfile.kt | 4 +- .../danar}/comm/MsgSetTempBasalStart.kt | 2 +- .../danar}/comm/MsgSetTempBasalStop.kt | 2 +- .../androidaps/danar}/comm/MsgSetTime.kt | 2 +- .../danar}/comm/MsgSetUserOptions.kt | 4 +- .../danar}/comm/MsgSettingActiveProfile.kt | 4 +- .../androidaps/danar}/comm/MsgSettingBasal.kt | 6 +- .../danar}/comm/MsgSettingBasalProfileAll.kt | 4 +- .../danar}/comm/MsgSettingGlucose.kt | 4 +- .../danar}/comm/MsgSettingMaxValues.kt | 4 +- .../androidaps/danar}/comm/MsgSettingMeal.kt | 10 +-- .../danar}/comm/MsgSettingProfileRatios.kt | 4 +- .../danar}/comm/MsgSettingProfileRatiosAll.kt | 4 +- .../danar}/comm/MsgSettingPumpTime.kt | 4 +- .../danar}/comm/MsgSettingShippingInfo.kt | 4 +- .../danar}/comm/MsgSettingUserOptions.kt | 4 +- .../androidaps/danar}/comm/MsgStatus.kt | 4 +- .../androidaps/danar}/comm/MsgStatusBasic.kt | 4 +- .../danar}/comm/MsgStatusBolusExtended.kt | 4 +- .../danar}/comm/MsgStatusProfile.kt | 4 +- .../danar}/comm/MsgStatusTempBasal.kt | 4 +- .../AbstractDanaRExecutionService.java | 55 ++++++------ .../services/DanaRExecutionService.java | 68 +++++++-------- .../src/main/res/xml/pref_danar.xml | 2 +- .../src/main/res/xml/pref_danarkorean.xml | 2 +- .../src/main/res/xml/pref_danarv2.xml | 2 +- .../androidaps/danars/DanaRSPlugin.kt | 3 +- .../comm/DanaRS_Packet_APS_History_Events.kt | 2 +- .../DanaRS_Packet_Basal_Get_Basal_Rate.kt | 2 +- ...aRS_Packet_Basal_Get_Profile_Basal_Rate.kt | 2 +- .../DanaRS_Packet_Basal_Get_Profile_Number.kt | 2 +- ..._Packet_Basal_Get_Temporary_Basal_State.kt | 2 +- .../DanaRS_Packet_Bolus_Get_Bolus_Option.kt | 2 +- .../DanaRS_Packet_Bolus_Get_CIR_CF_Array.kt | 2 +- ...acket_Bolus_Get_Calculation_Information.kt | 2 +- ...et_Carbohydrate_Calculation_Information.kt | 2 +- .../DanaRS_Packet_Bolus_Get_Dual_Bolus.kt | 2 +- .../DanaRS_Packet_Bolus_Get_Extended_Bolus.kt | 2 +- ...S_Packet_Bolus_Get_Extended_Bolus_State.kt | 2 +- ...et_Bolus_Get_Extended_Menu_Option_State.kt | 2 +- ...Packet_Bolus_Get_Step_Bolus_Information.kt | 2 +- ...anaRS_Packet_Bolus_Set_Step_Bolus_Start.kt | 2 +- ...DanaRS_Packet_Bolus_Set_Step_Bolus_Stop.kt | 2 +- ...aRS_Packet_General_Get_More_Information.kt | 2 +- .../DanaRS_Packet_General_Get_Password.kt | 2 +- .../DanaRS_Packet_General_Get_Pump_Check.kt | 2 +- ...Packet_General_Get_Shipping_Information.kt | 2 +- ...aRS_Packet_General_Get_Shipping_Version.kt | 2 +- ...Packet_General_Get_Today_Delivery_Total.kt | 2 +- ...cket_General_Initial_Screen_Information.kt | 2 +- .../DanaRS_Packet_Notify_Delivery_Complete.kt | 2 +- ...aRS_Packet_Notify_Delivery_Rate_Display.kt | 2 +- .../DanaRS_Packet_Option_Get_Pump_Time.kt | 2 +- .../DanaRS_Packet_Option_Get_User_Option.kt | 2 +- .../DanaRS_Packet_Option_Set_User_Option.kt | 2 +- ...DanaRS_Packet_Review_Get_Pump_Dec_Ratio.kt | 2 +- .../androidaps/danars/services/BLEComm.kt | 2 +- .../danars/services/DanaRSService.kt | 2 +- settings.gradle | 1 + 210 files changed, 893 insertions(+), 692 deletions(-) delete mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/AbstractSerialIOThread.java rename {app => core}/src/main/java/info/nightscout/androidaps/events/EventBTChange.kt (100%) rename {app => core}/src/main/java/info/nightscout/androidaps/events/EventPreferenceChange.kt (86%) rename {app => core}/src/main/java/info/nightscout/androidaps/events/EventRebuildTabs.kt (100%) create mode 100644 core/src/main/java/info/nightscout/androidaps/interfaces/ConfigBuilderInterface.kt rename {app => core}/src/main/java/info/nightscout/androidaps/utils/CRC.java (100%) create mode 100644 danar/.gitignore create mode 100644 danar/build.gradle create mode 100644 danar/consumer-rules.pro create mode 100644 danar/proguard-rules.pro create mode 100644 danar/src/main/AndroidManifest.xml rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRKorean/DanaRKoreanPlugin.java (91%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRKorean/comm/MessageHashTableRKorean.kt (77%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRKorean/comm/MsgCheckValue_k.kt (81%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRKorean/comm/MsgInitConnStatusBasic_k.kt (90%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRKorean/comm/MsgInitConnStatusBolus_k.kt (90%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRKorean/comm/MsgInitConnStatusTime_k.kt (84%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRKorean/comm/MsgSettingBasalProfileAll_k.kt (92%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRKorean/comm/MsgSettingBasal_k.kt (73%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRKorean/comm/MsgStatusBasic_k.kt (86%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRKorean/comm/MsgStatus_k.kt (88%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRKorean/services/DanaRKoreanExecutionService.java (86%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRv2/DanaRv2Plugin.java (92%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRv2/comm/MessageHashTableRv2.kt (75%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRv2/comm/MsgCheckValue_v2.kt (86%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRv2/comm/MsgHistoryEvents_v2.kt (88%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRv2/comm/MsgSetAPSTempBasalStart_v2.kt (91%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRv2/comm/MsgSetHistoryEntry_v2.kt (88%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRv2/comm/MsgStatusAPS_v2.kt (77%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRv2/comm/MsgStatusBolusExtended_v2.kt (92%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRv2/comm/MsgStatusTempBasal_v2.kt (91%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump => danar/src/main/java/info/nightscout/androidaps}/danaRv2/services/DanaRv2ExecutionService.java (86%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/AbstractDanaRPlugin.java (93%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/BluetoothDevicePreference.java (94%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/DanaRPlugin.java (91%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/SerialIOThread.java (70%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MessageBase.java (99%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MessageHashTableBase.kt (66%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MessageHashTableR.kt (77%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MessageOriginalNames.kt (99%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgBolusProgress.kt (89%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgBolusStart.kt (89%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgBolusStartWithSpeed.kt (90%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgBolusStop.kt (88%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgCheckValue.kt (79%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgError.kt (91%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryAlarm.kt (63%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryAll.kt (95%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryAllDone.kt (81%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryBasalHour.kt (63%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryBolus.kt (63%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryCarbo.kt (63%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryDailyInsulin.kt (64%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryDone.kt (81%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryError.kt (63%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryGlucose.kt (63%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryNew.kt (63%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryNewDone.kt (81%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistoryRefill.kt (63%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgHistorySuspend.kt (63%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgInitConnStatusBasic.kt (96%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgInitConnStatusBolus.kt (92%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgInitConnStatusOption.kt (93%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgInitConnStatusTime.kt (85%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgPCCommStart.kt (87%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgPCCommStop.kt (87%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSetActivateBasalProfile.kt (92%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSetBasalProfile.kt (94%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSetCarbsEntry.kt (96%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSetExtendedBolusStart.kt (95%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSetExtendedBolusStop.kt (92%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSetSingleBasalProfile.kt (94%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSetTempBasalStart.kt (95%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSetTempBasalStop.kt (92%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSetTime.kt (92%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSetUserOptions.kt (93%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSettingActiveProfile.kt (81%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSettingBasal.kt (83%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSettingBasalProfileAll.kt (94%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSettingGlucose.kt (86%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSettingMaxValues.kt (86%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSettingMeal.kt (91%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSettingProfileRatios.kt (93%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSettingProfileRatiosAll.kt (95%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSettingPumpTime.kt (89%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSettingShippingInfo.kt (86%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgSettingUserOptions.kt (95%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgStatus.kt (92%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgStatusBasic.kt (94%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgStatusBolusExtended.kt (97%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgStatusProfile.kt (92%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/comm/MsgStatusTempBasal.kt (97%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/services/AbstractDanaRExecutionService.java (87%) rename {app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR => danar/src/main/java/info/nightscout/androidaps/danar}/services/DanaRExecutionService.java (87%) rename {app => danar}/src/main/res/xml/pref_danar.xml (96%) rename {app => danar}/src/main/res/xml/pref_danarkorean.xml (96%) rename {app => danar}/src/main/res/xml/pref_danarv2.xml (95%) diff --git a/app/build.gradle b/app/build.gradle index 4bf7ed83e4..b2cb9db72f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -244,6 +244,7 @@ dependencies { implementation project(':core') implementation project(':dana') implementation project(':danars') + implementation project(':danar') implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.google.android.gms:play-services-wearable:17.0.0' diff --git a/app/src/androidTest/java/info/nightscout/androidaps/RealPumpTest.kt b/app/src/androidTest/java/info/nightscout/androidaps/RealPumpTest.kt index 9158c5f119..0a99af2948 100644 --- a/app/src/androidTest/java/info/nightscout/androidaps/RealPumpTest.kt +++ b/app/src/androidTest/java/info/nightscout/androidaps/RealPumpTest.kt @@ -16,7 +16,7 @@ import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugi import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin import info.nightscout.androidaps.plugins.insulin.InsulinOrefUltraRapidActingPlugin import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin -import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin +import info.nightscout.androidaps.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.plugins.source.RandomBgPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin @@ -42,7 +42,7 @@ class RealPumpTest { private val validProfile = "{\"dia\":\"6\",\"carbratio\":[{\"time\":\"00:00\",\"value\":\"30\"}],\"carbs_hr\":\"20\",\"delay\":\"20\",\"sens\":[{\"time\":\"00:00\",\"value\":\"10\"},{\"time\":\"2:00\",\"value\":\"11\"}],\"timezone\":\"UTC\",\"basal\":[{\"time\":\"00:00\",\"value\":\"0.1\"}],\"target_low\":[{\"time\":\"00:00\",\"value\":\"4\"}],\"target_high\":[{\"time\":\"00:00\",\"value\":\"5\"}],\"startDate\":\"1970-01-01T00:00:00.000Z\",\"units\":\"mmol\"}" - @Inject lateinit var pump : DanaRv2Plugin + @Inject lateinit var pump : info.nightscout.androidaps.danaRv2.DanaRv2Plugin @Inject lateinit var randomBgPlugin :RandomBgPlugin @Inject lateinit var localProfilePlugin: LocalProfilePlugin @Inject lateinit var profileFunction: ProfileFunction diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 59f2a2d054..2a3dd58566 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -154,15 +154,15 @@ android:name=".services.LocationService" android:exported="false" /> Provides the profile you have defined in Nightscout Define a profile with only one time block. Pump integration for Accu-Chek Combo pumps, requires having ruffy installed - Pump integration for DANA Diabecare R pumps - Pump integration for domestic DANA Diabecare R pumps - Pump integration for DANA Diabecare R pumps with upgraded firmware Pump integration for people who do multiple daily injections for their diabetes therapy Pump integration for pumps which don\'t have any driver yet (Open Loop) Sensitivity is calculated the same way like Oref0, but you can specify timeframe to the past. Minimal carb absorption is calculated from max carb absorption time from preferences. @@ -279,14 +276,11 @@ exported less than hour ago in directory: %1$s - DanaR Dana pump settings End User License Agreement MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. I UNDERSTAND AND AGREE Save - No bluetooth adapter found - Selected device not found Pump IOB Daily units Last bolus @@ -400,11 +394,7 @@ Wear Resend All Data Open Settings on Wear - DanaR Korean Basal rate: - Setting of basal profile failed - Disable EasyUI mode in pump - Change mode from U/d to U/h on pump Basal value below minimum. Profile not set! BG: Last BG: @@ -434,7 +424,6 @@ SP OAPS LP - DANA HOME VPUMP NSPROFILE @@ -494,7 +483,6 @@ Paused nsclientinternal_url nsclientinternal_api_secret - danar_bt_name Clear log nsclientinternal_autoscroll nsclientinternal_paused @@ -548,7 +536,6 @@ Superbolus Log app start to NS Exiting application to apply settings. - DanaRv2 Which type of insulin are you using? Fast Acting Insulin Novorapid, Novolog, Humalog @@ -714,7 +701,6 @@ Fat ]]> Command is executed right now - Pump driver corrected Pump unreachable Missed BG readings raise_urgent_alarms_as_android_notification diff --git a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSTestBase.kt b/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSTestBase.kt index c12d651eea..74f6bbd89f 100644 --- a/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSTestBase.kt +++ b/app/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSTestBase.kt @@ -24,7 +24,7 @@ open class DanaRSTestBase : TestBaseWithProfile() { } } - lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + lateinit var danaRPump: DanaRPump fun createArray(length: Int, fillWith: Byte): ByteArray { val ret = ByteArray(length) diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt index 30ac7a766c..0f229116de 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -7,6 +7,7 @@ import info.nightscout.androidaps.Config import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBaseWithProfile +import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin @@ -19,8 +20,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin @@ -63,7 +63,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { @Mock lateinit var uploadQueue: UploadQueue private var buildHelper = BuildHelper(Config()) - lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + lateinit var danaRPump: DanaRPump lateinit var constraintChecker: ConstraintChecker private lateinit var safetyPlugin: SafetyPlugin @@ -113,11 +113,11 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { `when`(activePlugin.activePump).thenReturn(virtualPumpPlugin) constraintChecker = ConstraintChecker(activePlugin) - danaRPump = info.nightscout.androidaps.dana.DanaRPump(aapsLogger, sp, injector) + danaRPump = DanaRPump(aapsLogger, sp, injector) hardLimits = HardLimits(aapsLogger, rxBus, sp, resourceHelper, context, nsUpload) objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, resourceHelper, activePlugin, sp, Config()) comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, resourceHelper, profileFunction, treatmentsPlugin, sp, commandQueue, context) - danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, danaRPump, dateUtil) + danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, activePlugin, sp, commandQueue, danaRPump, dateUtil, fabricPrivacy) danaRSPlugin = DanaRSPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, activePluginProvider, sp, commandQueue, danaRPump, detailedBolusInfoStorage, fabricPrivacy, dateUtil, Config()) insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, treatmentsPlugin, sp, commandQueue, profileFunction, nsUpload, context, uploadQueue, Config(), dateUtil) openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsPlugin, iobCobCalculatorPlugin, hardLimits, profiler, fabricPrivacy) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt index f7fb9ac936..86f6e01c2a 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPluginTest.kt @@ -6,6 +6,8 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBaseWithProfile +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType @@ -29,7 +31,7 @@ class DanaRPluginTest : TestBaseWithProfile() { @Mock lateinit var sp: SP @Mock lateinit var commandQueue: CommandQueueProvider - lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + lateinit var danaRPump: DanaRPump private lateinit var danaRPlugin: DanaRPlugin @@ -44,7 +46,7 @@ class DanaRPluginTest : TestBaseWithProfile() { `when`(resourceHelper.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(resourceHelper.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") danaRPump = info.nightscout.androidaps.dana.DanaRPump(aapsLogger, sp, injector) - danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, danaRPump, dateUtil) + danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, danaRPump, dateUtil, fabricPrivacy) } @Test @Throws(Exception::class) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt index 2a46bd697c..c632b3eec0 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/DanaRTestBase.kt @@ -7,10 +7,13 @@ import info.nightscout.androidaps.db.TemporaryBasal import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface +import info.nightscout.androidaps.interfaces.TreatmentsInterface import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Before import org.mockito.Mock +import org.mockito.Mockito.`when` open class DanaRTestBase : TestBase() { @@ -18,6 +21,13 @@ open class DanaRTestBase : TestBase() { @Mock lateinit var profileFunction: ProfileFunction @Mock lateinit var activePluginProvider: ActivePluginProvider @Mock lateinit var dateUtil: DateUtil + @Mock lateinit var databaseHelper: DatabaseHelperInterface + @Mock lateinit var treatmentsInterface: TreatmentsInterface + + @Before + fun prepareMock() { + `when`(activePluginProvider.activeTreatments).thenReturn(treatmentsInterface) + } val injector = HasAndroidInjector { AndroidInjector { @@ -30,7 +40,7 @@ open class DanaRTestBase : TestBase() { } } - lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + lateinit var danaRPump: DanaRPump fun createArray(length: Int, fillWith: Byte): ByteArray { val ret = ByteArray(length) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt index b17f8efc8d..bea0bc17e5 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableRTest.kt @@ -1,5 +1,8 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danar.comm.MessageHashTableR import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint @@ -8,8 +11,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert @@ -38,7 +39,7 @@ class MessageHashTableRTest : DanaRTestBase() { @Test fun runTest() { Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) - val messageHashTable = MessageHashTableR(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, activePlugin, nsUpload, injector, dateUtil) + val messageHashTable = MessageHashTableR(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, activePlugin, nsUpload, injector, databaseHelper, dateUtil) val testMessage = messageHashTable.findMessage(0x41f2) Assert.assertEquals("CMD_HISTORY_ALL", testMessage.messageName) } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt index 0b9c519177..beca8d68d5 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNamesTest.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.TestBase +import info.nightscout.androidaps.danar.comm.MessageOriginalNames import org.junit.Assert import org.junit.Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt index b98ac3e378..dee4524a10 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgressTest.kt @@ -3,8 +3,9 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.androidaps.plugins.bus.RxBusWrapper +import info.nightscout.androidaps.danar.comm.MsgBolusProgress import info.nightscout.androidaps.db.Treatment +import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert import org.junit.Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt index 87cec753d7..8494fa1106 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgBolusStart import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import org.junit.Assert diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt index 34c0024a99..3b43441b0a 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeedTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgBolusStartWithSpeed import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import org.junit.Assert diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt index e64df1a055..7f4f1c24e7 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStopTest.kt @@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R +import info.nightscout.androidaps.danar.comm.MsgBolusStop import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.utils.resources.ResourceHelper diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt index d6b43ff775..42a4a6ba59 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValueTest.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danar.comm.MsgCheckValue import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt index d03dbf6f20..37dcc2bb21 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgErrorTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgError import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.utils.resources.ResourceHelper diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt index e70a9bfe9a..ffea0e4dbe 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarmTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryAlarm import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Test import org.junit.runner.RunWith @@ -11,7 +12,7 @@ class MsgHistoryAlarmTest : DanaRTestBase() { val rxBus = RxBusWrapper() @Test fun runTest() { - val packet = MsgHistoryAlarm(aapsLogger, rxBus, dateUtil) + val packet = MsgHistoryAlarm(aapsLogger, rxBus, dateUtil, databaseHelper) // nothing left to test } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt index 7da9c4c241..d4509345db 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDoneTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryAllDone import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt index 694a523a67..7384ce84d7 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllTest.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.MainApp +import info.nightscout.androidaps.danar.comm.MsgHistoryAll import info.nightscout.androidaps.db.DatabaseHelper import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Assert @@ -18,7 +19,7 @@ class MsgHistoryAllTest : DanaRTestBase() { @Test fun runTest() { PowerMockito.mockStatic(MainApp::class.java) `when`(MainApp.getDbHelper()).thenReturn(PowerMockito.mock(DatabaseHelper::class.java)) - val packet = MsgHistoryAll(aapsLogger, RxBusWrapper(), dateUtil) + val packet = MsgHistoryAll(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper) // test message decoding val array = ByteArray(100) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt index 4240454bb9..79ec7d8fdc 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHourTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryBasalHour import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Test import org.junit.runner.RunWith @@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryBasalHourTest : DanaRTestBase() { @Test fun runTest() { - val packet = MsgHistoryBasalHour(aapsLogger, RxBusWrapper(), dateUtil) + val packet = MsgHistoryBasalHour(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper) // nothing left to test } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt index f93be7d72e..9852196047 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolusTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryBolus import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Test import org.junit.runner.RunWith @@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryBolusTest : DanaRTestBase() { @Test fun runTest() { - val packet = MsgHistoryBolus(aapsLogger, RxBusWrapper(), dateUtil) + val packet = MsgHistoryBolus(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper) // nothing left to test } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt index e30cf23e14..e455a469ba 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarboTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryCarbo import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Test import org.junit.runner.RunWith @@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryCarboTest : DanaRTestBase() { @Test fun runTest() { - val packet = MsgHistoryCarbo(aapsLogger, RxBusWrapper(), dateUtil) + val packet = MsgHistoryCarbo(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper) // nothing left to test } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt index 9c52a30bde..0d00fab90a 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulinTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryDailyInsulin import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Test import org.junit.runner.RunWith @@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryDailyInsulinTest : DanaRTestBase() { @Test fun runTest() { - val packet = MsgHistoryDailyInsulin(aapsLogger, RxBusWrapper(), dateUtil) + val packet = MsgHistoryDailyInsulin(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper) // nothing left to test } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt index 8530b9baec..ee77380db4 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDoneTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryDone import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt index e32d657577..f13bcadec9 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryErrorTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryError import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Test import org.junit.runner.RunWith @@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryErrorTest : DanaRTestBase() { @Test fun runTest() { - val packet = MsgHistoryError(aapsLogger, RxBusWrapper(), dateUtil) + val packet = MsgHistoryError(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper) // nothing left to test } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt index 1e01007392..bc3ab42785 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucoseTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryGlucose import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Test import org.junit.runner.RunWith @@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryGlucoseTest : DanaRTestBase() { @Test fun runTest() { - val packet = MsgHistoryGlucose(aapsLogger, RxBusWrapper(), dateUtil) + val packet = MsgHistoryGlucose(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper) // nothing left to test } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt index c5c9ec4f11..5f9f4a9896 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDoneTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryNewDone import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt index 9cf8f16263..daf56f0b10 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryNew import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Test import org.junit.runner.RunWith @@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryNewTest : DanaRTestBase() { @Test fun runTest() { - val packet = MsgHistoryNew(aapsLogger, RxBusWrapper(), dateUtil) + val packet = MsgHistoryNew(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper) // nothing left to test } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt index 1cfbee9c64..fc6a9d3fbd 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefillTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistoryRefill import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Test import org.junit.runner.RunWith @@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistoryRefillTest : DanaRTestBase() { @Test fun runTest() { - val packet = MsgHistoryRefill(aapsLogger, RxBusWrapper(), dateUtil) + val packet = MsgHistoryRefill(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper) // nothing left to test } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt index d9b6576cda..dcc199df53 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspendTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgHistorySuspend import info.nightscout.androidaps.plugins.bus.RxBusWrapper import org.junit.Test import org.junit.runner.RunWith @@ -9,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgHistorySuspendTest : DanaRTestBase() { @Test fun runTest() { - val packet = MsgHistorySuspend(aapsLogger, RxBusWrapper(), dateUtil) + val packet = MsgHistorySuspend(aapsLogger, RxBusWrapper(), dateUtil, databaseHelper) // nothing left to test } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt index eba32dbf35..4e3294ca69 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasicTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgInitConnStatusBasic import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt index 28039329a7..6e0e2718e4 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolusTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgInitConnStatusBolus import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt index 3b2f7b9045..a6364df74f 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOptionTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgInitConnStatusOption import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt index 678842b9ae..ad33c1e690 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTimeTest.kt @@ -3,8 +3,9 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.comm.MsgInitConnStatusTime import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert import org.junit.Test @@ -14,7 +15,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(DanaRKoreanPlugin::class, DanaRPlugin::class, ConfigBuilderPlugin::class) +@PrepareForTest(info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin::class, info.nightscout.androidaps.danar.DanaRPlugin::class, ConfigBuilderPlugin::class) class MsgInitConnStatusTimeTest : DanaRTestBase() { @Mock lateinit var resourceHelper: ResourceHelper diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt index 8a4856ffab..235d5e6757 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStartTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgPCCommStart import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt index 89b3c6a334..10452ad547 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStopTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgPCCommStop import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt index 47875c29a7..24be4bf480 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfileTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgSetActivateBasalProfile import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt index 9f6dbeb07e..a74a940e0f 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfileTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgSetBasalProfile import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt index 2de9486752..9bedcdf29c 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntryTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgSetCarbsEntry import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt index 8971cee5f3..ad28decac2 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStartTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStart import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import org.junit.Assert diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt index 5ed8ed4dcb..a870698fdf 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStopTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStop import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt index 36fdee444e..f2b1de97da 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfileTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgSetSingleBasalProfile import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt index cee42aea82..f67d0f2aad 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStartTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgSetTempBasalStart import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt index 1b5ed6e857..db01c3c138 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTimeTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgSetTime import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt index d151b539c0..f62d73b85e 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptionsTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgSetUserOptions import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt index 3af752abe9..7978729ba6 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfileTest.kt @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MsgSettingActiveProfile import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt index 2d38ce7bd7..015419579a 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAllTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgSettingBasalProfileAll import org.junit.Test import org.junit.runner.RunWith import org.powermock.modules.junit4.PowerMockRunner diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt index 158a364a6d..dad9c144f5 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalTest.kt @@ -1,7 +1,9 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.interfaces.PumpDescription -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danar.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MsgSettingBasal import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -11,7 +13,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(DanaRPlugin::class) +@PrepareForTest(info.nightscout.androidaps.danar.DanaRPlugin::class) class MsgSettingBasalTest : DanaRTestBase() { @Mock lateinit var danaRPlugin: DanaRPlugin diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt index 99da2bbc92..498801d889 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucoseTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgSettingGlucose import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt index 07500d1ce5..000bfa56ea 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValuesTest.kt @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MsgSettingMaxValues import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt index a56270ad09..949af62d60 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMealTest.kt @@ -1,8 +1,10 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MsgSettingMeal import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert import org.junit.Test @@ -12,7 +14,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest import org.powermock.modules.junit4.PowerMockRunner @RunWith(PowerMockRunner::class) -@PrepareForTest(DanaRPlugin::class, DanaRKoreanPlugin::class) +@PrepareForTest(info.nightscout.androidaps.danar.DanaRPlugin::class, info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin::class) class MsgSettingMealTest : DanaRTestBase() { @Mock lateinit var resourceHelper: ResourceHelper diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt index c263cf9134..01457d0669 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAllTest.kt @@ -1,6 +1,8 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatiosAll import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt index f33f608b56..31c34db6ec 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosTest.kt @@ -1,6 +1,8 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatios import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt index 8b5c462142..57525da3bb 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTimeTest.kt @@ -1,6 +1,8 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MsgSettingPumpTime import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt index 8001eec0df..ef1a7402e1 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfoTest.kt @@ -1,6 +1,8 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt index 0d1b936aef..3c73bab86e 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptionsTest.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.comm.MsgSettingUserOptions import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -11,7 +12,7 @@ class MsgSettingUserOptionsTest : DanaRTestBase() { @Test fun runTest() { val packet = MsgSettingUserOptions(aapsLogger, danaRPump) - danaRPump.units = info.nightscout.androidaps.dana.DanaRPump.UNITS_MGDL + danaRPump.units = DanaRPump.UNITS_MGDL // test message decoding packet.handleMessage(createArray(48, 7.toByte())) Assert.assertEquals(7, danaRPump.lcdOnTimeSec) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt index b627d55c86..eba8672e28 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasicTest.kt @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MsgStatusBasic import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt index 74bf318496..bd12040a0c 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtendedTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import org.junit.Assert diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt index bb9fa76163..bbe5068aa7 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfileTest.kt @@ -1,6 +1,8 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MsgStatusProfile import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt index 7c8fc242cd..ae613c4685 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasalTest.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt index 8bde4483c0..9ef8ff10ce 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTest.kt @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm +import info.nightscout.androidaps.danar.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MsgStatus import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt index defc719499..06c9376188 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPluginTest.kt @@ -6,11 +6,12 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBaseWithProfile +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker -import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert import org.junit.Before @@ -30,7 +31,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() { @Mock lateinit var sp: SP @Mock lateinit var commandQueue: CommandQueueProvider - lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + lateinit var danaRPump: DanaRPump private lateinit var danaRPlugin: DanaRKoreanPlugin @@ -44,8 +45,8 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() { `when`(resourceHelper.gs(R.string.pumplimit)).thenReturn("pump limit") `when`(resourceHelper.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(resourceHelper.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") - danaRPump = info.nightscout.androidaps.dana.DanaRPump(aapsLogger, sp, injector) - danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, rxBus, danaRPump, context, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, dateUtil) + danaRPump = DanaRPump(aapsLogger, sp, injector) + danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, rxBus, danaRPump, context, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, dateUtil, fabricPrivacy) } @Test @Throws(Exception::class) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt index eb5660a162..28618f8281 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKoreanTest.kt @@ -8,8 +8,10 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danaRKorean.comm.MessageHashTableRKorean +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -30,10 +32,11 @@ class MessageHashTableRKoreanTest : DanaRSTestBase() { @Mock lateinit var activePlugin: ActivePluginProvider @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Mock lateinit var nsUpload: NSUpload + @Mock lateinit var databaseHelper: DatabaseHelperInterface @Test fun runTest() { Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) - val messageHashTable = MessageHashTableRKorean(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, activePlugin, dateUtil, nsUpload, injector) + val messageHashTable = MessageHashTableRKorean(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, activePlugin, dateUtil, nsUpload, databaseHelper, injector) val testMessage = messageHashTable.findMessage(0x41f2) Assert.assertEquals("CMD_HISTORY_ALL", testMessage.messageName) } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt index 28e45ef20f..dd1f284a63 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2PluginTest.kt @@ -6,12 +6,13 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants import info.nightscout.androidaps.R import info.nightscout.androidaps.TestBaseWithProfile +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage -import info.nightscout.androidaps.dana.DanaRPump import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -30,7 +31,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() { @Mock lateinit var commandQueue: CommandQueueProvider @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage - lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + lateinit var danaRPump: DanaRPump private lateinit var danaRv2Plugin: DanaRv2Plugin @@ -44,8 +45,8 @@ class DanaRv2PluginTest : TestBaseWithProfile() { `when`(resourceHelper.gs(R.string.pumplimit)).thenReturn("pump limit") `when`(resourceHelper.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s") `when`(resourceHelper.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s") - danaRPump = info.nightscout.androidaps.dana.DanaRPump(aapsLogger, sp, injector) - danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, rxBus, context, danaRPump, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, detailedBolusInfoStorage, dateUtil) + danaRPump = DanaRPump(aapsLogger, sp, injector) + danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, rxBus, context, danaRPump, resourceHelper, constraintChecker, activePluginProvider, sp, commandQueue, detailedBolusInfoStorage, dateUtil, fabricPrivacy) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTable_rv2Test.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTable_rv2Test.kt index 28d07d33d9..53c454780d 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTable_rv2Test.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTable_rv2Test.kt @@ -1,6 +1,12 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import android.content.Context +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danaRv2.DanaRv2Plugin +import info.nightscout.androidaps.danaRv2.comm.MessageHashTableRv2 +import info.nightscout.androidaps.danaRv2.comm.MsgStatusAPS_v2 +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.Constraint @@ -9,11 +15,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin -import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.resources.ResourceHelper @@ -46,7 +48,7 @@ class MessageHashTable_rv2Test : DanaRTestBase() { @Test fun runTest() { `when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0)) - val messageHashTableRv2 = MessageHashTableRv2(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue, activePlugin, detailedBolusInfoStorage, treatmentsPlugin, nsUpload, injector, DateUtil(context, resourceHelper)) + val messageHashTableRv2 = MessageHashTableRv2(aapsLogger, rxBus, resourceHelper, constraintChecker, danaRPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue, activePlugin, detailedBolusInfoStorage, nsUpload, injector, DateUtil(context, resourceHelper), databaseHelper) val forTesting: MessageBase = MsgStatusAPS_v2(aapsLogger, danaRPump) val testPacket: MessageBase = messageHashTableRv2.findMessage(forTesting.command) Assert.assertEquals(0xE001, testPacket.command.toLong()) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValue_v2Test.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValue_v2Test.kt index cc064d48b6..0c6c105342 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValue_v2Test.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValue_v2Test.kt @@ -3,11 +3,11 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin -import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danaRv2.DanaRv2Plugin +import info.nightscout.androidaps.danaRv2.comm.MsgCheckValue_v2 import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert import org.junit.Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEvents_v2Test.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEvents_v2Test.kt index bcfacf1e81..6192aec5e8 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEvents_v2Test.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEvents_v2Test.kt @@ -1,11 +1,10 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import android.content.Context +import info.nightscout.androidaps.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase -import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.resources.ResourceHelper import org.junit.Assert @@ -23,10 +22,9 @@ class MsgHistoryEvents_v2Test : DanaRTestBase() { @Mock lateinit var resourceHelper: ResourceHelper @Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Mock lateinit var danaRv2Plugin: DanaRv2Plugin - @Mock lateinit var treatmentsPlugin: TreatmentsPlugin @Test @Throws(Exception::class) fun runTest() { - var packet = MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, RxBusWrapper(), treatmentsPlugin, injector, DateUtil(context, resourceHelper), 0) + val packet = info.nightscout.androidaps.danaRv2.comm.MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, RxBusWrapper(), activePluginProvider, injector, DateUtil(context, resourceHelper), 0) // test message decoding val array = ByteArray(100) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStart_v2Test.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStart_v2Test.kt index 901596d7ff..0a275c8418 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStart_v2Test.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStart_v2Test.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase.intFromBuff +import info.nightscout.androidaps.danar.comm.MessageBase.intFromBuff import info.nightscout.androidaps.danars.comm.DanaRS_Packet_APS_Basal_Set_Temporary_Basal.Companion.PARAM30MIN import org.junit.Assert import org.junit.Test @@ -14,31 +14,31 @@ class MsgSetAPSTempBasalStart_v2Test : DanaRTestBase() { @Test fun runTest() { // test low hard limit - var packet = MsgSetAPSTempBasalStart_v2(aapsLogger, -1, true, false) + var packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, -1, true, false) Assert.assertEquals(0, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1)) // test high hard limit - packet = MsgSetAPSTempBasalStart_v2(aapsLogger, 550, true, false) + packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 550, true, false) Assert.assertEquals(500, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1)) // test setting 15 min - packet = MsgSetAPSTempBasalStart_v2(aapsLogger, 50, true, false) + packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 50, true, false) Assert.assertEquals(50, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1)) // test setting 30 min - packet = MsgSetAPSTempBasalStart_v2(aapsLogger, 50, false, true) + packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 50, false, true) Assert.assertEquals(50, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(PARAM30MIN, intFromBuff(packet.buffer, 2, 1)) // over 200% set always 15 min - packet = MsgSetAPSTempBasalStart_v2(aapsLogger, 250, false, true) + packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 250, false, true) Assert.assertEquals(250, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1)) // test low hard limit - packet = MsgSetAPSTempBasalStart_v2(aapsLogger, -1, false, true) + packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, -1, false, true) Assert.assertEquals(0, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(PARAM30MIN, intFromBuff(packet.buffer, 2, 1)) // test high hard limit - packet = MsgSetAPSTempBasalStart_v2(aapsLogger, 550, false, true) + packet = info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2(aapsLogger, 550, false, true) Assert.assertEquals(500, intFromBuff(packet.buffer, 0, 2)) Assert.assertEquals(packet.PARAM15MIN, intFromBuff(packet.buffer, 2, 1)) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntry_v2Test.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntry_v2Test.kt index 34b0fc8b7b..0510313426 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntry_v2Test.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntry_v2Test.kt @@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgSetHistoryEntry_v2Test : DanaRTestBase() { @Test fun runTest() { - var packet = MsgSetHistoryEntry_v2(aapsLogger, 1, System.currentTimeMillis(), 1, 0) + var packet = info.nightscout.androidaps.danaRv2.comm.MsgSetHistoryEntry_v2(aapsLogger, 1, System.currentTimeMillis(), 1, 0) // test message decoding // != 1 fails packet.handleMessage(createArray(34, 2.toByte())) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPS_v2Test.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPS_v2Test.kt index c873d4619b..268e8721c3 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPS_v2Test.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPS_v2Test.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MessageBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -12,7 +12,7 @@ class MsgStatusAPS_v2Test : DanaRTestBase() { @Test fun runTest() { - val packet = MsgStatusAPS_v2(aapsLogger, danaRPump) + val packet = info.nightscout.androidaps.danaRv2.comm.MsgStatusAPS_v2(aapsLogger, danaRPump) // test iob //TODO Find a way to mock treatments plugin val testArray = createArray(34, 7.toByte()) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2Test.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2Test.kt index 2f55887d29..6a30acd7e4 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2Test.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2Test.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.pump.danaRv2.comm import info.nightscout.androidaps.plugins.pump.danaR.comm.DanaRTestBase -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MessageBase import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -12,7 +12,7 @@ class MsgStatusBolusExtended_v2Test : DanaRTestBase() { @Test fun runTest() { - val packet = MsgStatusBolusExtended_v2(aapsLogger, danaRPump) + val packet = info.nightscout.androidaps.danaRv2.comm.MsgStatusBolusExtended_v2(aapsLogger, danaRPump) // test message decoding packet.handleMessage(createArray(34, 7.toByte())) Assert.assertEquals(MessageBase.intFromBuff(createArray(10, 7.toByte()), 2, 2).toDouble() / 100.0, danaRPump.extendedBolusAmount, 0.0) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2Test.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2Test.kt index fefc050457..a1cb55b1e2 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2Test.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2Test.kt @@ -10,7 +10,7 @@ import org.powermock.modules.junit4.PowerMockRunner class MsgStatusTempBasal_v2Test : DanaRTestBase() { @Test fun runTest() { - val packet = MsgStatusTempBasal_v2(aapsLogger, danaRPump, dateUtil) + val packet = info.nightscout.androidaps.danaRv2.comm.MsgStatusTempBasal_v2(aapsLogger, danaRPump, dateUtil) // test message decoding packet.handleMessage(createArray(34, 1.toByte())) Assert.assertEquals(true, danaRPump.isTempBasalInProgress) diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventBTChange.kt b/core/src/main/java/info/nightscout/androidaps/events/EventBTChange.kt similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/events/EventBTChange.kt rename to core/src/main/java/info/nightscout/androidaps/events/EventBTChange.kt diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventPreferenceChange.kt b/core/src/main/java/info/nightscout/androidaps/events/EventPreferenceChange.kt similarity index 86% rename from app/src/main/java/info/nightscout/androidaps/events/EventPreferenceChange.kt rename to core/src/main/java/info/nightscout/androidaps/events/EventPreferenceChange.kt index 1f7856b7cd..d30f0d9a54 100644 --- a/app/src/main/java/info/nightscout/androidaps/events/EventPreferenceChange.kt +++ b/core/src/main/java/info/nightscout/androidaps/events/EventPreferenceChange.kt @@ -1,7 +1,5 @@ package info.nightscout.androidaps.events -import android.content.res.Resources -import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.utils.resources.ResourceHelper class EventPreferenceChange : Event { diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventRebuildTabs.kt b/core/src/main/java/info/nightscout/androidaps/events/EventRebuildTabs.kt similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/events/EventRebuildTabs.kt rename to core/src/main/java/info/nightscout/androidaps/events/EventRebuildTabs.kt diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigBuilderInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigBuilderInterface.kt new file mode 100644 index 0000000000..effafb788a --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/ConfigBuilderInterface.kt @@ -0,0 +1,5 @@ +package info.nightscout.androidaps.interfaces + +interface ConfigBuilderInterface { + fun storeSettings(from: String) +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/utils/CRC.java b/core/src/main/java/info/nightscout/androidaps/utils/CRC.java similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/utils/CRC.java rename to core/src/main/java/info/nightscout/androidaps/utils/CRC.java diff --git a/dana/src/main/res/values/strings.xml b/dana/src/main/res/values/strings.xml index 14f8864d67..ada62ece9c 100644 --- a/dana/src/main/res/values/strings.xml +++ b/dana/src/main/res/values/strings.xml @@ -11,6 +11,7 @@ danars_v3_randomsync_key_ rs_logcanulachange rs_loginsulinchange + danar_bt_name Pairing No device found so far @@ -89,5 +90,18 @@ Shutdown [hours] Low reservoir [Units] Save options to pump + Pump integration for DANA Diabecare R pumps + Pump integration for domestic DANA Diabecare R pumps + Pump integration for DANA Diabecare R pumps with upgraded firmware + DANA + No bluetooth adapter found + Selected device not found + Change mode from U/d to U/h on pump + DanaR Korean + DanaR + Pump driver corrected + DanaRv2 + Disable EasyUI mode in pump + Setting of basal profile failed diff --git a/danar/.gitignore b/danar/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/danar/.gitignore @@ -0,0 +1 @@ +/build diff --git a/danar/build.gradle b/danar/build.gradle new file mode 100644 index 0000000000..dc0b51d60e --- /dev/null +++ b/danar/build.gradle @@ -0,0 +1,82 @@ +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' +apply plugin: 'kotlin-kapt' + +android { + compileSdkVersion 28 + + defaultConfig { + minSdkVersion 23 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles 'consumer-rules.pro' + } + + kotlinOptions { + jvmTarget = '1.8' + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + debug { + testCoverageEnabled(project.hasProperty('coverage')) + } + firebaseDisable { + System.setProperty("disableFirebase", "true") + ext.enableCrashlytics = false + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + +} + +dependencies { + implementation project(':core') + implementation project(':dana') + + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" + + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.core:core-ktx:1.2.0' + implementation "androidx.preference:preference-ktx:1.1.1" + implementation "androidx.activity:activity:${activityVersion}" + implementation "androidx.activity:activity-ktx:${activityVersion}" + + implementation "io.reactivex.rxjava2:rxandroid:2.1.1" + + // remove after conversion to aapslogger + implementation 'org.slf4j:slf4j-api:1.7.30' + + // Graphview cannot be upgraded + implementation "com.jjoe64:graphview:4.0.1" + + implementation 'net.danlew:android.joda:2.10.6' + + implementation "com.google.dagger:dagger-android:$dagger_version" + implementation "com.google.dagger:dagger-android-support:$dagger_version" + annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" + annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version" + kapt "com.google.dagger:dagger-android-processor:$dagger_version" + kapt "com.google.dagger:dagger-compiler:$dagger_version" + + //RxBus + implementation "io.reactivex.rxjava2:rxandroid:2.1.1" + + testImplementation 'junit:junit:4.13' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' +} diff --git a/danar/consumer-rules.pro b/danar/consumer-rules.pro new file mode 100644 index 0000000000..e69de29bb2 diff --git a/danar/proguard-rules.pro b/danar/proguard-rules.pro new file mode 100644 index 0000000000..f1b424510d --- /dev/null +++ b/danar/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/danar/src/main/AndroidManifest.xml b/danar/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..75256d3b75 --- /dev/null +++ b/danar/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.java similarity index 91% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPlugin.java rename to danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.java index 01b70b63aa..d504b9a24a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/DanaRKoreanPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaRKorean; +package info.nightscout.androidaps.danaRKorean; import android.content.ComponentName; import android.content.Context; @@ -12,15 +12,19 @@ import javax.inject.Inject; import javax.inject.Singleton; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.R; import info.nightscout.androidaps.dana.DanaRPump; +import info.nightscout.androidaps.danaRKorean.services.DanaRKoreanExecutionService; +import info.nightscout.androidaps.danar.AbstractDanaRPlugin; +import info.nightscout.androidaps.danar.R; import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.TemporaryBasal; +import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventPreferenceChange; +import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.PluginType; @@ -29,10 +33,6 @@ import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; -import info.nightscout.androidaps.plugins.pump.danaR.AbstractDanaRPlugin; -import info.nightscout.androidaps.plugins.pump.danaRKorean.services.DanaRKoreanExecutionService; -import info.nightscout.androidaps.db.Treatment; -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.Round; @@ -49,6 +49,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { private final Context context; private final ResourceHelper resourceHelper; private final ConstraintChecker constraintChecker; + private final FabricPrivacy fabricPrivacy; @Inject public DanaRKoreanPlugin( @@ -59,16 +60,18 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { Context context, ResourceHelper resourceHelper, ConstraintChecker constraintChecker, - TreatmentsPlugin treatmentsPlugin, + ActivePluginProvider activePlugin, SP sp, CommandQueueProvider commandQueue, - DateUtil dateUtil + DateUtil dateUtil, + FabricPrivacy fabricPrivacy ) { - super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, treatmentsPlugin, sp, dateUtil); + super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, activePlugin, sp, dateUtil); this.aapsLogger = aapsLogger; this.context = context; this.resourceHelper = resourceHelper; this.constraintChecker = constraintChecker; + this.fabricPrivacy = fabricPrivacy; getPluginDescription().description(R.string.description_pump_dana_r_korean); useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false); @@ -87,16 +90,16 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { boolean previousValue = useExtendedBoluses; useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false); - if (useExtendedBoluses != previousValue && treatmentsPlugin.isInHistoryExtendedBoluslInProgress()) { + if (useExtendedBoluses != previousValue && activePlugin.getActiveTreatments().isInHistoryExtendedBoluslInProgress()) { sExecutionService.extendedBolusStop(); } } - }, exception -> FabricPrivacy.getInstance().logException(exception)) + }, fabricPrivacy::logException) ); disposable.add(rxBus .toObservable(EventAppExit.class) .observeOn(Schedulers.io()) - .subscribe(event -> context.unbindService(mConnection), exception -> FabricPrivacy.getInstance().logException(exception)) + .subscribe(event -> context.unbindService(mConnection), fabricPrivacy::logException) ); super.onStart(); } @@ -171,11 +174,11 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { if (!result.success) result.comment = resourceHelper.gs(R.string.boluserrorcode, detailedBolusInfo.insulin, t.insulin, danaRPump.getBolusStartErrorCode()); else - result.comment = resourceHelper.gs(R.string.virtualpump_resultok); + result.comment = resourceHelper.gs(R.string.ok); aapsLogger.debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered); detailedBolusInfo.insulin = t.insulin; detailedBolusInfo.date = System.currentTimeMillis(); - treatmentsPlugin.addToHistoryTreatment(detailedBolusInfo, false); + activePlugin.getActiveTreatments().addToHistoryTreatment(detailedBolusInfo, false); return result; } else { PumpEnactResult result = new PumpEnactResult(getInjector()); @@ -206,8 +209,8 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { final boolean doExtendedTemp = absoluteRate > getBaseBasalRate() && useExtendedBoluses; long now = System.currentTimeMillis(); - TemporaryBasal activeTemp = treatmentsPlugin.getRealTempBasalFromHistory(now); - ExtendedBolus activeExtended = treatmentsPlugin.getExtendedBolusFromHistory(now); + TemporaryBasal activeTemp = activePlugin.getActiveTreatments().getRealTempBasalFromHistory(now); + ExtendedBolus activeExtended = activePlugin.getActiveTreatments().getExtendedBolusFromHistory(now); if (doTempOff) { // If extended in progress @@ -328,15 +331,15 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { @NonNull @Override public PumpEnactResult cancelTempBasal(boolean force) { - if (treatmentsPlugin.isInHistoryRealTempBasalInProgress()) + if (activePlugin.getActiveTreatments().isInHistoryRealTempBasalInProgress()) return cancelRealTempBasal(); - if (treatmentsPlugin.isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) { + if (activePlugin.getActiveTreatments().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) { return cancelExtendedBolus(); } PumpEnactResult result = new PumpEnactResult(getInjector()); result.success = true; result.enacted = false; - result.comment = resourceHelper.gs(R.string.virtualpump_resultok); + result.comment = resourceHelper.gs(R.string.ok); result.isTempCancel = true; return result; } @@ -348,7 +351,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { private PumpEnactResult cancelRealTempBasal() { PumpEnactResult result = new PumpEnactResult(getInjector()); - TemporaryBasal runningTB = treatmentsPlugin.getTempBasalFromHistory(System.currentTimeMillis()); + TemporaryBasal runningTB = activePlugin.getActiveTreatments().getTempBasalFromHistory(System.currentTimeMillis()); if (runningTB != null) { sExecutionService.tempBasalStop(); result.enacted = true; @@ -357,7 +360,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { if (!danaRPump.isTempBasalInProgress()) { result.success = true; result.isTempCancel = true; - result.comment = resourceHelper.gs(R.string.virtualpump_resultok); + result.comment = resourceHelper.gs(R.string.ok); aapsLogger.debug(LTag.PUMP, "cancelRealTempBasal: OK"); return result; } else { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKorean.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MessageHashTableRKorean.kt similarity index 77% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKorean.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MessageHashTableRKorean.kt index 04a2c45ccd..2fff171f46 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MessageHashTableRKorean.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MessageHashTableRKorean.kt @@ -1,17 +1,18 @@ -package info.nightscout.androidaps.plugins.pump.danaRKorean.comm +package info.nightscout.androidaps.danaRKorean.comm import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danar.comm.* import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider +import info.nightscout.androidaps.interfaces.ConfigBuilderInterface +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.general.nsclient.NSUpload -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.* -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.resources.ResourceHelper import java.util.* @@ -24,18 +25,19 @@ class MessageHashTableRKorean @Inject constructor( rxBus: RxBusWrapper, resourceHelper: ResourceHelper, constraintChecker: ConstraintChecker, - danaRPump: info.nightscout.androidaps.dana.DanaRPump, + danaRPump: DanaRPump, danaRPlugin: DanaRPlugin, danaRKoreanPlugin: DanaRKoreanPlugin, - configBuilderPlugin: ConfigBuilderPlugin, + configBuilderPlugin: ConfigBuilderInterface, commandQueue: CommandQueueProvider, activePlugin: ActivePluginProvider, dateUtil: DateUtil, nsUpload: NSUpload, + databaseHelper: DatabaseHelperInterface, injector: HasAndroidInjector ) : MessageHashTableBase { - var messages: HashMap = HashMap() + private var messages: HashMap = HashMap() init { put(MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0101 CMD_MEALINS_STOP @@ -57,11 +59,11 @@ class MessageHashTableRKorean @Inject constructor( put(MsgError(aapsLogger, rxBus, resourceHelper, danaRPump, nsUpload)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT - put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil)) // 0x3101 CMD_HISTORY_MEAL_INS - put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil)) // 0x3102 CMD_HISTORY_DAY_INS - put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil)) // 0x3104 CMD_HISTORY_GLUCOSE - put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil)) // 0x3105 CMD_HISTORY_ALARM - put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil)) // 0x3107 CMD_HISTORY_CARBOHY + put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3101 CMD_HISTORY_MEAL_INS + put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3102 CMD_HISTORY_DAY_INS + put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3104 CMD_HISTORY_GLUCOSE + put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3105 CMD_HISTORY_ALARM + put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3107 CMD_HISTORY_CARBOHY put(MsgSettingBasal_k(aapsLogger, danaRPump, danaRKoreanPlugin)) // 0x3202 CMD_SETTING_V_BASAL_INS_I put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaRPump, danaRKoreanPlugin)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I put(MsgSettingProfileRatios(aapsLogger, danaRPump)) // 0x3204 CMD_SETTING_V_CCC_I @@ -71,9 +73,9 @@ class MessageHashTableRKorean @Inject constructor( put(MsgSettingGlucose(aapsLogger, danaRPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY put(MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I put(MsgSetSingleBasalProfile(aapsLogger, rxBus, resourceHelper, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S - put(MsgHistoryAll(aapsLogger, rxBus, dateUtil)) // 0x41F2 CMD_HISTORY_ALL + put(MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x41F2 CMD_HISTORY_ALL put(MsgHistoryNewDone(aapsLogger, danaRPump)) // 0x42F1 CMD_HISTORY_NEW_DONE - put(MsgHistoryNew(aapsLogger, rxBus, dateUtil)) // 0x42F2 CMD_HISTORY_NEW + put(MsgHistoryNew(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x42F2 CMD_HISTORY_NEW put(MsgCheckValue_k(aapsLogger, danaRPump, danaRKoreanPlugin)) // 0xF0F1 CMD_PUMP_CHECK_VALUE } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgCheckValue_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgCheckValue_k.kt similarity index 81% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgCheckValue_k.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgCheckValue_k.kt index 90c5324be9..8cc5d40ae5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgCheckValue_k.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgCheckValue_k.kt @@ -1,14 +1,14 @@ -package info.nightscout.androidaps.plugins.pump.danaRKorean.comm +package info.nightscout.androidaps.danaRKorean.comm +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin class MsgCheckValue_k( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val danaRKoreanPlugin: DanaRKoreanPlugin ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgInitConnStatusBasic_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBasic_k.kt similarity index 90% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgInitConnStatusBasic_k.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBasic_k.kt index e2496e9d55..1a2b09eb95 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgInitConnStatusBasic_k.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBasic_k.kt @@ -1,21 +1,21 @@ -package info.nightscout.androidaps.plugins.pump.danaRKorean.comm +package info.nightscout.androidaps.danaRKorean.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.R +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.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.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase import info.nightscout.androidaps.utils.resources.ResourceHelper class MsgInitConnStatusBasic_k( private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgInitConnStatusBolus_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBolus_k.kt similarity index 90% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgInitConnStatusBolus_k.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBolus_k.kt index f99fbb1cd2..243c5714d3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgInitConnStatusBolus_k.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBolus_k.kt @@ -1,6 +1,8 @@ -package info.nightscout.androidaps.plugins.pump.danaRKorean.comm +package info.nightscout.androidaps.danaRKorean.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.R +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -8,15 +10,13 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase import info.nightscout.androidaps.utils.resources.ResourceHelper class MsgInitConnStatusBolus_k( private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val activePlugin: ActivePluginProvider ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgInitConnStatusTime_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusTime_k.kt similarity index 84% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgInitConnStatusTime_k.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusTime_k.kt index 8f1c9a56d9..feb7a292cd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgInitConnStatusTime_k.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusTime_k.kt @@ -1,19 +1,19 @@ -package info.nightscout.androidaps.plugins.pump.danaRKorean.comm +package info.nightscout.androidaps.danaRKorean.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danar.R +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.events.EventRebuildTabs import info.nightscout.androidaps.interfaces.CommandQueueProvider +import info.nightscout.androidaps.interfaces.ConfigBuilderInterface import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.resources.ResourceHelper @@ -21,10 +21,10 @@ class MsgInitConnStatusTime_k( private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val danaRPlugin: DanaRPlugin, private val danaRKoreanPlugin: DanaRKoreanPlugin, - private val configBuilderPlugin: ConfigBuilderPlugin, + private val configBuilderPlugin: ConfigBuilderInterface, private val commandQueue: CommandQueueProvider, private val dateUtil: DateUtil ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgSettingBasalProfileAll_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasalProfileAll_k.kt similarity index 92% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgSettingBasalProfileAll_k.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasalProfileAll_k.kt index 0c1b3475b9..463c7ffe04 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgSettingBasalProfileAll_k.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasalProfileAll_k.kt @@ -1,9 +1,9 @@ -package info.nightscout.androidaps.plugins.pump.danaRKorean.comm +package info.nightscout.androidaps.danaRKorean.comm +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase import java.util.* /** @@ -16,7 +16,7 @@ import java.util.* */ class MsgSettingBasalProfileAll_k( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgSettingBasal_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasal_k.kt similarity index 73% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgSettingBasal_k.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasal_k.kt index cbb46fa0be..c460a7f313 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgSettingBasal_k.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasal_k.kt @@ -1,15 +1,15 @@ -package info.nightscout.androidaps.plugins.pump.danaRKorean.comm +package info.nightscout.androidaps.danaRKorean.comm +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import java.util.* class MsgSettingBasal_k( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val danaRKoreanPlugin: DanaRKoreanPlugin ) : MessageBase() { @@ -19,7 +19,7 @@ class MsgSettingBasal_k( } override fun handleMessage(bytes: ByteArray) { - danaRPump.pumpProfiles = Array(4) {Array(48) {0.0} } + danaRPump.pumpProfiles = Array(4) { Array(48) { 0.0 } } for (index in 0..23) { var basal = intFromBuff(bytes, 2 * index, 2) if (basal < danaRKoreanPlugin.pumpDescription.basalMinimumRate) basal = 0 diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgStatusBasic_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatusBasic_k.kt similarity index 86% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgStatusBasic_k.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatusBasic_k.kt index 6d3b8660f1..b01011af8b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgStatusBasic_k.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatusBasic_k.kt @@ -1,13 +1,13 @@ -package info.nightscout.androidaps.plugins.pump.danaRKorean.comm +package info.nightscout.androidaps.danaRKorean.comm +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase class MsgStatusBasic_k( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgStatus_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatus_k.kt similarity index 88% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgStatus_k.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatus_k.kt index b4c2c68870..10d5a96473 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/comm/MsgStatus_k.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatus_k.kt @@ -1,13 +1,13 @@ -package info.nightscout.androidaps.plugins.pump.danaRKorean.comm +package info.nightscout.androidaps.danaRKorean.comm +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase class MsgStatus_k( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/services/DanaRKoreanExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java similarity index 86% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/services/DanaRKoreanExecutionService.java rename to danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java index 1e06b7a1de..78e9e6256b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/services/DanaRKoreanExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaRKorean.services; +package info.nightscout.androidaps.danaRKorean.services; import android.os.Binder; import android.os.SystemClock; @@ -9,9 +9,30 @@ import java.util.Date; import javax.inject.Inject; import info.nightscout.androidaps.Constants; -import info.nightscout.androidaps.R; import info.nightscout.androidaps.dana.DanaRPump; import info.nightscout.androidaps.dana.events.EventDanaRNewStatus; +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin; +import info.nightscout.androidaps.danar.DanaRPlugin; +import info.nightscout.androidaps.danar.R; +import info.nightscout.androidaps.danar.SerialIOThread; +import info.nightscout.androidaps.danar.comm.MsgBolusStart; +import info.nightscout.androidaps.danar.comm.MsgSetCarbsEntry; +import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStart; +import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStop; +import info.nightscout.androidaps.danar.comm.MsgSetSingleBasalProfile; +import info.nightscout.androidaps.danar.comm.MsgSetTempBasalStart; +import info.nightscout.androidaps.danar.comm.MsgSetTempBasalStop; +import info.nightscout.androidaps.danar.comm.MsgSetTime; +import info.nightscout.androidaps.danar.comm.MsgSettingBasal; +import info.nightscout.androidaps.danar.comm.MsgSettingGlucose; +import info.nightscout.androidaps.danar.comm.MsgSettingMaxValues; +import info.nightscout.androidaps.danar.comm.MsgSettingMeal; +import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatios; +import info.nightscout.androidaps.danar.comm.MsgSettingPumpTime; +import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo; +import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended; +import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal; +import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.Treatment; @@ -29,31 +50,10 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker; 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.danaR.DanaRPlugin; -import info.nightscout.androidaps.plugins.pump.danaR.SerialIOThread; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgBolusStart; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetCarbsEntry; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetExtendedBolusStart; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetExtendedBolusStop; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetSingleBasalProfile; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetTempBasalStart; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetTempBasalStop; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetTime; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingBasal; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingGlucose; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingMaxValues; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingMeal; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingProfileRatios; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingPumpTime; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingShippingInfo; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgStatusBolusExtended; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgStatusTempBasal; -import info.nightscout.androidaps.plugins.pump.danaR.services.AbstractDanaRExecutionService; -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin; -import info.nightscout.androidaps.plugins.pump.danaRKorean.comm.MessageHashTableRKorean; -import info.nightscout.androidaps.plugins.pump.danaRKorean.comm.MsgCheckValue_k; -import info.nightscout.androidaps.plugins.pump.danaRKorean.comm.MsgSettingBasal_k; -import info.nightscout.androidaps.plugins.pump.danaRKorean.comm.MsgStatusBasic_k; +import info.nightscout.androidaps.danaRKorean.comm.MessageHashTableRKorean; +import info.nightscout.androidaps.danaRKorean.comm.MsgCheckValue_k; +import info.nightscout.androidaps.danaRKorean.comm.MsgSettingBasal_k; +import info.nightscout.androidaps.danaRKorean.comm.MsgStatusBasic_k; import info.nightscout.androidaps.queue.commands.Command; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.T; @@ -115,7 +115,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService { if (mSerialIOThread != null) { mSerialIOThread.disconnect("Recreate SerialIOThread"); } - mSerialIOThread = new SerialIOThread(mRfcommSocket, messageHashTableRKorean, danaRPump); + mSerialIOThread = new SerialIOThread(aapsLogger, mRfcommSocket, messageHashTableRKorean, danaRPump); mHandshakeInProgress = true; rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.HANDSHAKING, 0)); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2Plugin.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java similarity index 92% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2Plugin.java rename to danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java index b7e03ec67e..2802bb5b0e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/DanaRv2Plugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaRv2; +package info.nightscout.androidaps.danaRv2; import android.content.ComponentName; import android.content.Context; @@ -12,13 +12,17 @@ import javax.inject.Inject; import javax.inject.Singleton; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.R; import info.nightscout.androidaps.dana.DanaRPump; +import info.nightscout.androidaps.danaRv2.services.DanaRv2ExecutionService; +import info.nightscout.androidaps.danar.AbstractDanaRPlugin; +import info.nightscout.androidaps.danar.R; import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.TemporaryBasal; +import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.events.EventAppExit; +import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.logging.AAPSLogger; @@ -27,10 +31,6 @@ 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.common.defs.PumpType; -import info.nightscout.androidaps.plugins.pump.danaR.AbstractDanaRPlugin; -import info.nightscout.androidaps.plugins.pump.danaRv2.services.DanaRv2ExecutionService; -import info.nightscout.androidaps.db.Treatment; -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.Round; @@ -49,7 +49,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { private final ResourceHelper resourceHelper; private final ConstraintChecker constraintChecker; private final DetailedBolusInfoStorage detailedBolusInfoStorage; - + private final FabricPrivacy fabricPrivacy; public long lastEventTimeLoaded = 0; public boolean eventsLoadingDone = false; @@ -63,18 +63,20 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { DanaRPump danaRPump, ResourceHelper resourceHelper, ConstraintChecker constraintChecker, - TreatmentsPlugin treatmentsPlugin, + ActivePluginProvider activePlugin, SP sp, CommandQueueProvider commandQueue, DetailedBolusInfoStorage detailedBolusInfoStorage, - DateUtil dateUtil + DateUtil dateUtil, + FabricPrivacy fabricPrivacy ) { - super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, treatmentsPlugin, sp, dateUtil); + super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, activePlugin, sp, dateUtil); this.aapsLogger = aapsLogger; this.context = context; this.resourceHelper = resourceHelper; this.constraintChecker = constraintChecker; this.detailedBolusInfoStorage = detailedBolusInfoStorage; + this.fabricPrivacy = fabricPrivacy; getPluginDescription().description(R.string.description_pump_dana_r_v2); useExtendedBoluses = false; @@ -89,7 +91,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { disposable.add(rxBus .toObservable(EventAppExit.class) .observeOn(Schedulers.io()) - .subscribe(event -> context.unbindService(mConnection), exception -> FabricPrivacy.getInstance().logException(exception)) + .subscribe(event -> context.unbindService(mConnection), fabricPrivacy::logException) ); super.onStart(); } @@ -191,7 +193,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { if (!result.success) result.comment = String.format(resourceHelper.gs(R.string.boluserrorcode), detailedBolusInfo.insulin, t.insulin, danaRPump.getBolusStartErrorCode()); else - result.comment = resourceHelper.gs(R.string.virtualpump_resultok); + result.comment = resourceHelper.gs(R.string.ok); aapsLogger.debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered); // remove carbs because it's get from history separately return result; @@ -234,7 +236,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { if (doTempOff) { // If temp in progress - if (treatmentsPlugin.isTempBasalInProgress()) { + if (activePlugin.getActiveTreatments().isTempBasalInProgress()) { aapsLogger.debug(LTag.PUMP, "setTempBasalAbsolute: Stopping temp basal (doTempOff)"); return cancelTempBasal(false); } @@ -254,7 +256,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { if (percentRate > 500) // Special high temp 500/15min percentRate = 500; // Check if some temp is already in progress - TemporaryBasal activeTemp = treatmentsPlugin.getTempBasalFromHistory(System.currentTimeMillis()); + TemporaryBasal activeTemp = activePlugin.getActiveTreatments().getTempBasalFromHistory(System.currentTimeMillis()); if (activeTemp != null) { // Correct basal already set ? if (activeTemp.percentRate == percentRate && activeTemp.getPlannedRemainingMinutes() > 4) { @@ -308,12 +310,12 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { if (percent > getPumpDescription().maxTempPercent) percent = getPumpDescription().maxTempPercent; long now = System.currentTimeMillis(); - TemporaryBasal activeTemp = treatmentsPlugin.getRealTempBasalFromHistory(now); + TemporaryBasal activeTemp = activePlugin.getActiveTreatments().getRealTempBasalFromHistory(now); if (activeTemp != null && activeTemp.percentRate == percent && activeTemp.getPlannedRemainingMinutes() > 4 && !enforceNew) { result.enacted = false; result.success = true; result.isTempCancel = false; - result.comment = resourceHelper.gs(R.string.virtualpump_resultok); + result.comment = resourceHelper.gs(R.string.ok); result.duration = pump.getTempBasalRemainingMin(); result.percent = pump.getTempBasalPercent(); result.isPercent = true; @@ -330,7 +332,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { if (connectionOK && pump.isTempBasalInProgress() && pump.getTempBasalPercent() == percent) { result.enacted = true; result.success = true; - result.comment = resourceHelper.gs(R.string.virtualpump_resultok); + result.comment = resourceHelper.gs(R.string.ok); result.isTempCancel = false; result.duration = pump.getTempBasalRemainingMin(); result.percent = pump.getTempBasalPercent(); @@ -352,7 +354,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { if (connectionOK && pump.isTempBasalInProgress() && pump.getTempBasalPercent() == percent) { result.enacted = true; result.success = true; - result.comment = resourceHelper.gs(R.string.virtualpump_resultok); + result.comment = resourceHelper.gs(R.string.ok); result.isTempCancel = false; result.duration = pump.getTempBasalRemainingMin(); result.percent = pump.getTempBasalPercent(); @@ -370,7 +372,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { @NonNull @Override public PumpEnactResult cancelTempBasal(boolean force) { PumpEnactResult result = new PumpEnactResult(getInjector()); - TemporaryBasal runningTB = treatmentsPlugin.getTempBasalFromHistory(System.currentTimeMillis()); + TemporaryBasal runningTB = activePlugin.getActiveTreatments().getTempBasalFromHistory(System.currentTimeMillis()); if (runningTB != null) { sExecutionService.tempBasalStop(); result.enacted = true; @@ -379,7 +381,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { if (!danaRPump.isTempBasalInProgress()) { result.success = true; result.isTempCancel = true; - result.comment = resourceHelper.gs(R.string.virtualpump_resultok); + result.comment = resourceHelper.gs(R.string.ok); aapsLogger.debug(LTag.PUMP, "cancelRealTempBasal: OK"); return result; } else { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MessageHashTableRv2.kt similarity index 75% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MessageHashTableRv2.kt index a5896b5a4c..004a1078af 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MessageHashTableRv2.kt @@ -1,20 +1,20 @@ -package info.nightscout.androidaps.plugins.pump.danaRv2.comm +package info.nightscout.androidaps.danaRv2.comm import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danaRv2.DanaRv2Plugin +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danar.comm.* import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider +import info.nightscout.androidaps.interfaces.ConfigBuilderInterface +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.general.nsclient.NSUpload import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.* -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin -import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.resources.ResourceHelper import java.util.* @@ -27,21 +27,21 @@ class MessageHashTableRv2 @Inject constructor( rxBus: RxBusWrapper, resourceHelper: ResourceHelper, constraintChecker: ConstraintChecker, - danaRPump: info.nightscout.androidaps.dana.DanaRPump, + danaRPump: DanaRPump, danaRPlugin: DanaRPlugin, danaRKoreanPlugin: DanaRKoreanPlugin, danaRv2Plugin: DanaRv2Plugin, - configBuilderPlugin: ConfigBuilderPlugin, + configBuilderPlugin: ConfigBuilderInterface, commandQueue: CommandQueueProvider, activePlugin: ActivePluginProvider, detailedBolusInfoStorage: DetailedBolusInfoStorage, - treatmentsPlugin: TreatmentsPlugin, nsUpload: NSUpload, injector: HasAndroidInjector, - dateUtil: DateUtil + dateUtil: DateUtil, + databaseHelper: DatabaseHelperInterface ) : MessageHashTableBase { - var messages: HashMap = HashMap() + private var messages: HashMap = HashMap() init { put(MsgBolusStop(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0101 CMD_MEALINS_STOP @@ -65,15 +65,15 @@ class MessageHashTableRv2 @Inject constructor( put(MsgError(aapsLogger, rxBus, resourceHelper, danaRPump, nsUpload)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT - put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil)) // 0x3101 CMD_HISTORY_MEAL_INS - put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil)) // 0x3102 CMD_HISTORY_DAY_INS - put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil)) // 0x3104 CMD_HISTORY_GLUCOSE - put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil)) // 0x3105 CMD_HISTORY_ALARM - put(MsgHistoryError(aapsLogger, rxBus, dateUtil)) // 0x3106 CMD_HISTORY_ERROR - put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil)) // 0x3107 CMD_HISTORY_CARBOHY - put(MsgHistoryRefill(aapsLogger, rxBus, dateUtil)) // 0x3108 CMD_HISTORY_REFILL - put(MsgHistorySuspend(aapsLogger, rxBus, dateUtil)) // 0x3109 CMD_HISTORY_SUSPEND - put(MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil)) // 0x310A CMD_HISTORY_BASAL_HOUR + put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3101 CMD_HISTORY_MEAL_INS + put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3102 CMD_HISTORY_DAY_INS + put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3104 CMD_HISTORY_GLUCOSE + put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3105 CMD_HISTORY_ALARM + put(MsgHistoryError(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3106 CMD_HISTORY_ERROR + put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3107 CMD_HISTORY_CARBOHY + put(MsgHistoryRefill(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3108 CMD_HISTORY_REFILL + put(MsgHistorySuspend(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3109 CMD_HISTORY_SUSPEND + put(MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x310A CMD_HISTORY_BASAL_HOUR put(MsgHistoryDone(aapsLogger, danaRPump)) // 0x31F1 CMD_HISTORY_DONT_USED put(MsgSettingBasal(aapsLogger, danaRPump, danaRPlugin)) // 0x3202 CMD_SETTING_V_BASAL_INS_I put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaRPump, danaRKoreanPlugin)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I @@ -91,13 +91,13 @@ class MessageHashTableRv2 @Inject constructor( put(MsgSetUserOptions(aapsLogger, danaRPump)) // 0x330B CMD_SETTING_USER_OPTIONS_S put(MsgSetActivateBasalProfile(aapsLogger, 0.toByte())) // 0x330C CMD_SETTING_PROFILE_NUMBER_S put(MsgHistoryAllDone(aapsLogger, danaRPump)) // 0x41F1 CMD_HISTORY_ALL_DONE - put(MsgHistoryAll(aapsLogger, rxBus, dateUtil)) // 0x41F2 CMD_HISTORY_ALL + put(MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x41F2 CMD_HISTORY_ALL put(MsgHistoryNewDone(aapsLogger, danaRPump)) // 0x42F1 CMD_HISTORY_NEW_DONE - put(MsgHistoryNew(aapsLogger, rxBus, dateUtil)) // 0x42F2 CMD_HISTORY_NEW + put(MsgHistoryNew(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x42F2 CMD_HISTORY_NEW put(MsgCheckValue_v2(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue)) // 0xF0F1 CMD_PUMP_CHECK_VALUE put(MsgStatusAPS_v2(aapsLogger, danaRPump)) // 0xE001 CMD_PUMPSTATUS_APS put(MsgSetAPSTempBasalStart_v2(aapsLogger, 0, false, false)) // 0xE002 CMD_PUMPSET_APSTEMP - put(MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, rxBus, treatmentsPlugin, injector, dateUtil)) // 0xE003 CMD_GET_HISTORY + put(MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, rxBus, activePlugin, injector, dateUtil)) // 0xE003 CMD_GET_HISTORY put(MsgSetHistoryEntry_v2(aapsLogger, 0, 0, 0, 0)) // 0xE004 CMD_SET_HISTORY_ENTRY } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValue_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgCheckValue_v2.kt similarity index 86% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValue_v2.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgCheckValue_v2.kt index 8f0ab31d36..3144eec663 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgCheckValue_v2.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgCheckValue_v2.kt @@ -1,31 +1,31 @@ -package info.nightscout.androidaps.plugins.pump.danaRv2.comm +package info.nightscout.androidaps.danaRv2.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danaRv2.DanaRv2Plugin +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danar.R +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.events.EventRebuildTabs import info.nightscout.androidaps.interfaces.CommandQueueProvider +import info.nightscout.androidaps.interfaces.ConfigBuilderInterface import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin -import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin import info.nightscout.androidaps.utils.resources.ResourceHelper class MsgCheckValue_v2( private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val danaRPlugin: DanaRPlugin, private val danaRKoreanPlugin: DanaRKoreanPlugin, private val danaRv2Plugin: DanaRv2Plugin, - private val configBuilderPlugin: ConfigBuilderPlugin, + private val configBuilderPlugin: ConfigBuilderInterface, private val commandQueue: CommandQueueProvider ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEvents_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgHistoryEvents_v2.kt similarity index 88% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEvents_v2.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgHistoryEvents_v2.kt index 8b1bbf6e15..29292f6256 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgHistoryEvents_v2.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgHistoryEvents_v2.kt @@ -1,20 +1,19 @@ -package info.nightscout.androidaps.plugins.pump.danaRv2.comm +package info.nightscout.androidaps.danaRv2.comm import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.R +import info.nightscout.androidaps.danaRv2.DanaRv2Plugin +import info.nightscout.androidaps.danar.R +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.data.DetailedBolusInfo import info.nightscout.androidaps.db.ExtendedBolus import info.nightscout.androidaps.db.Source import info.nightscout.androidaps.db.TemporaryBasal 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 -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase -import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.resources.ResourceHelper import java.util.* @@ -25,7 +24,7 @@ class MsgHistoryEvents_v2 constructor( private val detailedBolusInfoStorage: DetailedBolusInfoStorage, val danaRv2Plugin: DanaRv2Plugin, val rxBus: RxBusWrapper, - val treatmentsPlugin: TreatmentsPlugin, + val activePlugin: ActivePluginProvider, private val injector: HasAndroidInjector, private val dateUtil: DateUtil, var from: Long = 0 @@ -78,13 +77,13 @@ class MsgHistoryEvents_v2 constructor( aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT TEMPSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Ratio: " + param1 + "% Duration: " + param2 + "min") temporaryBasal.percentRate = param1 temporaryBasal.durationInMinutes = param2 - treatmentsPlugin.addToHistoryTempBasal(temporaryBasal) + activePlugin.activeTreatments.addToHistoryTempBasal(temporaryBasal) status = "TEMPSTART " + dateUtil.timeString(datetime) } info.nightscout.androidaps.dana.DanaRPump.TEMPSTOP -> { aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT TEMPSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime)) - treatmentsPlugin.addToHistoryTempBasal(temporaryBasal) + activePlugin.activeTreatments.addToHistoryTempBasal(temporaryBasal) status = "TEMPSTOP " + dateUtil.timeString(datetime) } @@ -92,13 +91,13 @@ class MsgHistoryEvents_v2 constructor( aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT EXTENDEDSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min") extendedBolus.insulin = param1 / 100.0 extendedBolus.durationInMinutes = param2 - treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus) + activePlugin.activeTreatments.addToHistoryExtendedBolus(extendedBolus) status = "EXTENDEDSTART " + dateUtil.timeString(datetime) } info.nightscout.androidaps.dana.DanaRPump.EXTENDEDSTOP -> { aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT EXTENDEDSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min") - treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus) + activePlugin.activeTreatments.addToHistoryExtendedBolus(extendedBolus) status = "EXTENDEDSTOP " + dateUtil.timeString(datetime) } @@ -109,7 +108,7 @@ class MsgHistoryEvents_v2 constructor( detailedBolusInfo.source = Source.PUMP detailedBolusInfo.pumpId = datetime detailedBolusInfo.insulin = param1 / 100.0 - val newRecord = treatmentsPlugin.addToHistoryTreatment(detailedBolusInfo, false) + val newRecord = activePlugin.activeTreatments.addToHistoryTreatment(detailedBolusInfo, false) aapsLogger.debug(LTag.PUMPBTCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min") status = "BOLUS " + dateUtil.timeString(datetime) } @@ -121,7 +120,7 @@ class MsgHistoryEvents_v2 constructor( detailedBolusInfo.source = Source.PUMP detailedBolusInfo.pumpId = datetime detailedBolusInfo.insulin = param1 / 100.0 - val newRecord = treatmentsPlugin.addToHistoryTreatment(detailedBolusInfo, false) + val newRecord = activePlugin.activeTreatments.addToHistoryTreatment(detailedBolusInfo, false) aapsLogger.debug(LTag.PUMPBTCOMM, (if (newRecord) "**NEW** " else "") + "EVENT DUALBOLUS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min") status = "DUALBOLUS " + dateUtil.timeString(datetime) } @@ -130,13 +129,13 @@ class MsgHistoryEvents_v2 constructor( aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT DUALEXTENDEDSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min") extendedBolus.insulin = param1 / 100.0 extendedBolus.durationInMinutes = param2 - treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus) + activePlugin.activeTreatments.addToHistoryExtendedBolus(extendedBolus) status = "DUALEXTENDEDSTART " + dateUtil.timeString(datetime) } info.nightscout.androidaps.dana.DanaRPump.DUALEXTENDEDSTOP -> { aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min") - treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus) + activePlugin.activeTreatments.addToHistoryExtendedBolus(extendedBolus) status = "DUALEXTENDEDSTOP " + dateUtil.timeString(datetime) } @@ -171,12 +170,12 @@ class MsgHistoryEvents_v2 constructor( emptyCarbsInfo.date = datetime emptyCarbsInfo.source = Source.PUMP emptyCarbsInfo.pumpId = datetime - val newRecord = treatmentsPlugin.addToHistoryTreatment(emptyCarbsInfo, false) + val newRecord = activePlugin.activeTreatments.addToHistoryTreatment(emptyCarbsInfo, false) aapsLogger.debug(LTag.PUMPBTCOMM, (if (newRecord) "**NEW** " else "") + "EVENT CARBS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Carbs: " + param1 + "g") status = "CARBS " + dateUtil.timeString(datetime) } - else -> { + else -> { aapsLogger.debug(LTag.PUMPBTCOMM, "Event: " + recordCode + " " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Param1: " + param1 + " Param2: " + param2) status = "UNKNOWN " + dateUtil.timeString(datetime) } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStart_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetAPSTempBasalStart_v2.kt similarity index 91% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStart_v2.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetAPSTempBasalStart_v2.kt index 2ff8c669ef..8e09ee1273 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetAPSTempBasalStart_v2.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetAPSTempBasalStart_v2.kt @@ -1,8 +1,8 @@ -package info.nightscout.androidaps.plugins.pump.danaRv2.comm +package info.nightscout.androidaps.danaRv2.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MessageBase @Suppress("UNUSED_PARAMETER") class MsgSetAPSTempBasalStart_v2( diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntry_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetHistoryEntry_v2.kt similarity index 88% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntry_v2.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetHistoryEntry_v2.kt index b0d8777efa..7a73fc4c00 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgSetHistoryEntry_v2.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetHistoryEntry_v2.kt @@ -1,8 +1,8 @@ -package info.nightscout.androidaps.plugins.pump.danaRv2.comm +package info.nightscout.androidaps.danaRv2.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MessageBase import java.util.* class MsgSetHistoryEntry_v2( diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPS_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusAPS_v2.kt similarity index 77% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPS_v2.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusAPS_v2.kt index f3ff2d1afd..88ee0eeec7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusAPS_v2.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusAPS_v2.kt @@ -1,13 +1,13 @@ -package info.nightscout.androidaps.plugins.pump.danaRv2.comm +package info.nightscout.androidaps.danaRv2.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MessageBase class MsgStatusAPS_v2( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusBolusExtended_v2.kt similarity index 92% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusBolusExtended_v2.kt index bef75168a6..e7d26326ff 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusBolusExtended_v2.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusBolusExtended_v2.kt @@ -1,14 +1,14 @@ -package info.nightscout.androidaps.plugins.pump.danaRv2.comm +package info.nightscout.androidaps.danaRv2.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MessageBase import kotlin.math.ceil class MsgStatusBolusExtended_v2( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusTempBasal_v2.kt similarity index 91% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2.kt rename to danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusTempBasal_v2.kt index ce13522cc8..38533d3ad5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MsgStatusTempBasal_v2.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusTempBasal_v2.kt @@ -1,15 +1,15 @@ -package info.nightscout.androidaps.plugins.pump.danaRv2.comm +package info.nightscout.androidaps.danaRv2.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase +import info.nightscout.androidaps.danar.comm.MessageBase import info.nightscout.androidaps.utils.DateUtil import kotlin.math.ceil class MsgStatusTempBasal_v2( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val dateUtil: DateUtil ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/services/DanaRv2ExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java similarity index 86% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/services/DanaRv2ExecutionService.java rename to danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java index e3a88158b7..f0138a3fba 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/services/DanaRv2ExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaRv2.services; +package info.nightscout.androidaps.danaRv2.services; import android.content.Context; import android.content.Intent; @@ -12,10 +12,46 @@ import javax.inject.Inject; import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.Constants; -import info.nightscout.androidaps.R; import info.nightscout.androidaps.activities.ErrorHelperActivity; import info.nightscout.androidaps.dana.DanaRPump; import info.nightscout.androidaps.dana.events.EventDanaRNewStatus; +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin; +import info.nightscout.androidaps.danaRv2.DanaRv2Plugin; +import info.nightscout.androidaps.danaRv2.comm.MessageHashTableRv2; +import info.nightscout.androidaps.danaRv2.comm.MsgCheckValue_v2; +import info.nightscout.androidaps.danaRv2.comm.MsgHistoryEvents_v2; +import info.nightscout.androidaps.danaRv2.comm.MsgSetAPSTempBasalStart_v2; +import info.nightscout.androidaps.danaRv2.comm.MsgSetHistoryEntry_v2; +import info.nightscout.androidaps.danaRv2.comm.MsgStatusBolusExtended_v2; +import info.nightscout.androidaps.danaRv2.comm.MsgStatusTempBasal_v2; +import info.nightscout.androidaps.danar.DanaRPlugin; +import info.nightscout.androidaps.danar.R; +import info.nightscout.androidaps.danar.SerialIOThread; +import info.nightscout.androidaps.danar.comm.MessageBase; +import info.nightscout.androidaps.danar.comm.MsgBolusStart; +import info.nightscout.androidaps.danar.comm.MsgBolusStartWithSpeed; +import info.nightscout.androidaps.danar.comm.MsgSetActivateBasalProfile; +import info.nightscout.androidaps.danar.comm.MsgSetBasalProfile; +import info.nightscout.androidaps.danar.comm.MsgSetCarbsEntry; +import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStart; +import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStop; +import info.nightscout.androidaps.danar.comm.MsgSetTempBasalStart; +import info.nightscout.androidaps.danar.comm.MsgSetTempBasalStop; +import info.nightscout.androidaps.danar.comm.MsgSetTime; +import info.nightscout.androidaps.danar.comm.MsgSetUserOptions; +import info.nightscout.androidaps.danar.comm.MsgSettingActiveProfile; +import info.nightscout.androidaps.danar.comm.MsgSettingBasal; +import info.nightscout.androidaps.danar.comm.MsgSettingGlucose; +import info.nightscout.androidaps.danar.comm.MsgSettingMaxValues; +import info.nightscout.androidaps.danar.comm.MsgSettingMeal; +import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatios; +import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatiosAll; +import info.nightscout.androidaps.danar.comm.MsgSettingPumpTime; +import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo; +import info.nightscout.androidaps.danar.comm.MsgSettingUserOptions; +import info.nightscout.androidaps.danar.comm.MsgStatus; +import info.nightscout.androidaps.danar.comm.MsgStatusBasic; +import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.Treatment; @@ -25,55 +61,18 @@ import info.nightscout.androidaps.events.EventProfileNeedsUpdate; import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider; +import info.nightscout.androidaps.interfaces.ConfigBuilderInterface; import info.nightscout.androidaps.interfaces.ProfileFunction; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage; -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin; -import info.nightscout.androidaps.plugins.pump.danaR.SerialIOThread; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgBolusStart; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgBolusStartWithSpeed; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetActivateBasalProfile; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetBasalProfile; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetCarbsEntry; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetExtendedBolusStart; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetExtendedBolusStop; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetTempBasalStart; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetTempBasalStop; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetTime; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetUserOptions; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingActiveProfile; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingBasal; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingGlucose; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingMaxValues; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingMeal; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingProfileRatios; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingProfileRatiosAll; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingPumpTime; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingShippingInfo; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingUserOptions; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgStatus; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgStatusBasic; -import info.nightscout.androidaps.plugins.pump.danaR.services.AbstractDanaRExecutionService; -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin; -import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin; -import info.nightscout.androidaps.plugins.pump.danaRv2.comm.MessageHashTableRv2; -import info.nightscout.androidaps.plugins.pump.danaRv2.comm.MsgCheckValue_v2; -import info.nightscout.androidaps.plugins.pump.danaRv2.comm.MsgHistoryEvents_v2; -import info.nightscout.androidaps.plugins.pump.danaRv2.comm.MsgSetAPSTempBasalStart_v2; -import info.nightscout.androidaps.plugins.pump.danaRv2.comm.MsgSetHistoryEntry_v2; -import info.nightscout.androidaps.plugins.pump.danaRv2.comm.MsgStatusBolusExtended_v2; -import info.nightscout.androidaps.plugins.pump.danaRv2.comm.MsgStatusTempBasal_v2; -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.commands.Command; import info.nightscout.androidaps.utils.DateUtil; @@ -92,12 +91,12 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { @Inject DanaRKoreanPlugin danaRKoreanPlugin; @Inject DanaRv2Plugin danaRv2Plugin; @Inject ActivePluginProvider activePlugin; - @Inject ConfigBuilderPlugin configBuilderPlugin; + @Inject ConfigBuilderInterface configBuilderPlugin; @Inject CommandQueueProvider commandQueue; @Inject Context context; @Inject MessageHashTableRv2 messageHashTableRv2; @Inject DetailedBolusInfoStorage detailedBolusInfoStorage; - @Inject TreatmentsPlugin treatmentsPlugin; + @Inject ActivePluginProvider activePluginProvider; @Inject ProfileFunction profileFunction; @Inject NSUpload nsUpload; @Inject SP sp; @@ -146,7 +145,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { if (mSerialIOThread != null) { mSerialIOThread.disconnect("Recreate SerialIOThread"); } - mSerialIOThread = new SerialIOThread(mRfcommSocket, messageHashTableRv2, danaRPump); + mSerialIOThread = new SerialIOThread(aapsLogger, mRfcommSocket, messageHashTableRv2, danaRPump); mHandshakeInProgress = true; rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.HANDSHAKING, 0)); } @@ -449,7 +448,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { if (!isConnected()) return new PumpEnactResult(injector).success(false); SystemClock.sleep(300); - MsgHistoryEvents_v2 msg = new MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, rxBus, treatmentsPlugin, injector, dateUtil, lastHistoryFetched); + MsgHistoryEvents_v2 msg = new MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, rxBus, activePlugin, injector, dateUtil, lastHistoryFetched); aapsLogger.debug(LTag.PUMP, "Loading event history from: " + dateUtil.dateAndTimeString(lastHistoryFetched)); mSerialIOThread.sendMessage(msg); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java similarity index 93% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java rename to danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java index 1f314d143c..20403812b5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR; +package info.nightscout.androidaps.danar; import androidx.annotation.NonNull; @@ -9,17 +9,18 @@ import java.util.Date; import java.util.List; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.R; import info.nightscout.androidaps.dana.DanaPumpInterface; import info.nightscout.androidaps.dana.DanaRFragment; import info.nightscout.androidaps.dana.DanaRPump; import info.nightscout.androidaps.dana.comm.RecordTypes; +import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.events.EventConfigBuilderChange; import info.nightscout.androidaps.events.EventPreferenceChange; +import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.ConstraintsInterface; @@ -39,8 +40,6 @@ import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType; 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.services.AbstractDanaRExecutionService; -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.Round; @@ -65,7 +64,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump protected DanaRPump danaRPump; protected ConstraintChecker constraintChecker; protected RxBusWrapper rxBus; - protected TreatmentsPlugin treatmentsPlugin; + protected ActivePluginProvider activePlugin; protected SP sp; protected DateUtil dateUtil; @@ -77,7 +76,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump AAPSLogger aapsLogger, CommandQueueProvider commandQueue, RxBusWrapper rxBus, - TreatmentsPlugin treatmentsPlugin, + ActivePluginProvider activePlugin, SP sp, DateUtil dateUtil ) { @@ -86,14 +85,14 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump .fragmentClass(DanaRFragment.class.getName()) .pluginName(R.string.danarspump) .shortName(R.string.danarpump_shortname) - .preferencesId(R.xml.pref_danars) + .preferencesId(R.xml.pref_danar) .description(R.string.description_pump_dana_r), injector, aapsLogger, resourceHelper, commandQueue ); this.danaRPump = danaRPump; this.constraintChecker = constraintChecker; this.rxBus = rxBus; - this.treatmentsPlugin = treatmentsPlugin; + this.activePlugin = activePlugin; this.sp = sp; this.dateUtil = dateUtil; } @@ -233,12 +232,12 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump if (percent > getPumpDescription().maxTempPercent) percent = getPumpDescription().maxTempPercent; long now = System.currentTimeMillis(); - TemporaryBasal activeTemp = treatmentsPlugin.getRealTempBasalFromHistory(now); + TemporaryBasal activeTemp = activePlugin.getActiveTreatments().getRealTempBasalFromHistory(now); if (activeTemp != null && activeTemp.percentRate == percent && activeTemp.getPlannedRemainingMinutes() > 4 && !enforceNew) { result.enacted = false; result.success = true; result.isTempCancel = false; - result.comment = getResourceHelper().gs(R.string.virtualpump_resultok); + result.comment = getResourceHelper().gs(R.string.ok); result.duration = pump.getTempBasalRemainingMin(); result.percent = pump.getTempBasalPercent(); result.isPercent = true; @@ -250,7 +249,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump if (connectionOK && pump.isTempBasalInProgress() && pump.getTempBasalPercent() == percent) { result.enacted = true; result.success = true; - result.comment = getResourceHelper().gs(R.string.virtualpump_resultok); + result.comment = getResourceHelper().gs(R.string.ok); result.isTempCancel = false; result.duration = pump.getTempBasalRemainingMin(); result.percent = pump.getTempBasalPercent(); @@ -274,11 +273,11 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep); PumpEnactResult result = new PumpEnactResult(getInjector()); - ExtendedBolus runningEB = treatmentsPlugin.getExtendedBolusFromHistory(System.currentTimeMillis()); + ExtendedBolus runningEB = activePlugin.getActiveTreatments().getExtendedBolusFromHistory(System.currentTimeMillis()); if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) { result.enacted = false; result.success = true; - result.comment = getResourceHelper().gs(R.string.virtualpump_resultok); + result.comment = getResourceHelper().gs(R.string.ok); result.duration = pump.getExtendedBolusRemainingMinutes(); result.absolute = pump.getExtendedBolusAbsoluteRate(); result.isPercent = false; @@ -290,7 +289,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump if (connectionOK && pump.isExtendedInProgress() && Math.abs(pump.getExtendedBolusAmount() - insulin) < getPumpDescription().extendedBolusStep) { result.enacted = true; result.success = true; - result.comment = getResourceHelper().gs(R.string.virtualpump_resultok); + result.comment = getResourceHelper().gs(R.string.ok); result.isTempCancel = false; result.duration = pump.getExtendedBolusRemainingMinutes(); result.absolute = pump.getExtendedBolusAbsoluteRate(); @@ -310,7 +309,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump @NonNull @Override public PumpEnactResult cancelExtendedBolus() { PumpEnactResult result = new PumpEnactResult(getInjector()); - ExtendedBolus runningEB = treatmentsPlugin.getExtendedBolusFromHistory(System.currentTimeMillis()); + ExtendedBolus runningEB = activePlugin.getActiveTreatments().getExtendedBolusFromHistory(System.currentTimeMillis()); if (runningEB != null) { sExecutionService.extendedBolusStop(); result.enacted = true; @@ -318,7 +317,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump } if (!danaRPump.isExtendedInProgress()) { result.success = true; - result.comment = getResourceHelper().gs(R.string.virtualpump_resultok); + result.comment = getResourceHelper().gs(R.string.ok); getAapsLogger().debug(LTag.PUMP, "cancelExtendedBolus: OK"); return result; } else { @@ -372,7 +371,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump DanaRPump pump = danaRPump; long now = System.currentTimeMillis(); if (pump.getLastConnection() + 5 * 60 * 1000L < System.currentTimeMillis()) { - return null; + return new JSONObject(); } JSONObject pumpjson = new JSONObject(); JSONObject battery = new JSONObject(); @@ -387,13 +386,13 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump extended.put("LastBolus", dateUtil.dateAndTimeString(pump.getLastBolusTime())); extended.put("LastBolusAmount", pump.getLastBolusAmount()); } - TemporaryBasal tb = treatmentsPlugin.getRealTempBasalFromHistory(now); + TemporaryBasal tb = activePlugin.getActiveTreatments().getRealTempBasalFromHistory(now); if (tb != null) { extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(now, profile)); extended.put("TempBasalStart", dateUtil.dateAndTimeString(tb.date)); extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes()); } - ExtendedBolus eb = treatmentsPlugin.getExtendedBolusFromHistory(now); + ExtendedBolus eb = activePlugin.getActiveTreatments().getExtendedBolusFromHistory(now); if (eb != null) { extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate()); extended.put("ExtendedBolusStart", dateUtil.dateAndTimeString(eb.date)); @@ -486,11 +485,11 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump if (pump.getLastBolusTime() != 0) { ret += "LastBolus: " + DecimalFormatter.to2Decimal(pump.getLastBolusAmount()) + "U @" + android.text.format.DateFormat.format("HH:mm", pump.getLastBolusTime()) + "\n"; } - TemporaryBasal activeTemp = treatmentsPlugin.getRealTempBasalFromHistory(System.currentTimeMillis()); + TemporaryBasal activeTemp = activePlugin.getActiveTreatments().getRealTempBasalFromHistory(System.currentTimeMillis()); if (activeTemp != null) { ret += "Temp: " + activeTemp.toStringFull() + "\n"; } - ExtendedBolus activeExtendedBolus = treatmentsPlugin.getExtendedBolusFromHistory(System.currentTimeMillis()); + ExtendedBolus activeExtendedBolus = activePlugin.getActiveTreatments().getExtendedBolusFromHistory(System.currentTimeMillis()); if (activeExtendedBolus != null) { ret += "Extended: " + activeExtendedBolus.toString() + "\n"; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/BluetoothDevicePreference.java b/danar/src/main/java/info/nightscout/androidaps/danar/BluetoothDevicePreference.java similarity index 94% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/BluetoothDevicePreference.java rename to danar/src/main/java/info/nightscout/androidaps/danar/BluetoothDevicePreference.java index b255b1b556..794587c2ce 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/BluetoothDevicePreference.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/BluetoothDevicePreference.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR; +package info.nightscout.androidaps.danar; import android.bluetooth.*; import android.content.Context; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java similarity index 91% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPlugin.java rename to danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java index 1ebd144b40..0f37479d47 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/DanaRPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR; +package info.nightscout.androidaps.danar; import android.content.ComponentName; import android.content.Context; @@ -12,15 +12,17 @@ import javax.inject.Inject; import javax.inject.Singleton; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.R; import info.nightscout.androidaps.dana.DanaRPump; +import info.nightscout.androidaps.danar.services.DanaRExecutionService; import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.TemporaryBasal; +import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventPreferenceChange; +import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.PluginType; @@ -29,9 +31,6 @@ import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; -import info.nightscout.androidaps.plugins.pump.danaR.services.DanaRExecutionService; -import info.nightscout.androidaps.db.Treatment; -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.Round; @@ -48,6 +47,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { private final Context context; private final ResourceHelper resourceHelper; private final ConstraintChecker constraintChecker; + private final FabricPrivacy fabricPrivacy; @Inject public DanaRPlugin( @@ -57,17 +57,19 @@ public class DanaRPlugin extends AbstractDanaRPlugin { Context context, ResourceHelper resourceHelper, ConstraintChecker constraintChecker, - TreatmentsPlugin treatmentsPlugin, + ActivePluginProvider activePlugin, SP sp, CommandQueueProvider commandQueue, DanaRPump danaRPump, - DateUtil dateUtil + DateUtil dateUtil, + FabricPrivacy fabricPrivacy ) { - super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, treatmentsPlugin, sp, dateUtil); + super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, activePlugin, sp, dateUtil); this.aapsLogger = aapsLogger; this.context = context; this.resourceHelper = resourceHelper; this.constraintChecker = constraintChecker; + this.fabricPrivacy = fabricPrivacy; useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false); pumpDescription.setPumpDescription(PumpType.DanaR); @@ -85,16 +87,16 @@ public class DanaRPlugin extends AbstractDanaRPlugin { boolean previousValue = useExtendedBoluses; useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false); - if (useExtendedBoluses != previousValue && treatmentsPlugin.isInHistoryExtendedBoluslInProgress()) { + if (useExtendedBoluses != previousValue && activePlugin.getActiveTreatments().isInHistoryExtendedBoluslInProgress()) { sExecutionService.extendedBolusStop(); } } - }, exception -> FabricPrivacy.getInstance().logException(exception)) + }, fabricPrivacy::logException) ); disposable.add(rxBus .toObservable(EventAppExit.class) .observeOn(Schedulers.io()) - .subscribe(event -> context.unbindService(mConnection), exception -> FabricPrivacy.getInstance().logException(exception)) + .subscribe(event -> context.unbindService(mConnection), fabricPrivacy::logException) ); super.onStart(); } @@ -170,11 +172,11 @@ public class DanaRPlugin extends AbstractDanaRPlugin { if (!result.success) result.comment = String.format(resourceHelper.gs(R.string.boluserrorcode), detailedBolusInfo.insulin, t.insulin, danaRPump.getBolusStartErrorCode()); else - result.comment = resourceHelper.gs(R.string.virtualpump_resultok); + result.comment = resourceHelper.gs(R.string.ok); aapsLogger.debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered); detailedBolusInfo.insulin = t.insulin; detailedBolusInfo.date = System.currentTimeMillis(); - treatmentsPlugin.addToHistoryTreatment(detailedBolusInfo, false); + activePlugin.getActiveTreatments().addToHistoryTreatment(detailedBolusInfo, false); return result; } else { PumpEnactResult result = new PumpEnactResult(getInjector()); @@ -205,8 +207,8 @@ public class DanaRPlugin extends AbstractDanaRPlugin { final boolean doExtendedTemp = absoluteRate > getBaseBasalRate() && useExtendedBoluses; long now = System.currentTimeMillis(); - TemporaryBasal activeTemp = treatmentsPlugin.getRealTempBasalFromHistory(now); - ExtendedBolus activeExtended = treatmentsPlugin.getExtendedBolusFromHistory(now); + TemporaryBasal activeTemp = activePlugin.getActiveTreatments().getRealTempBasalFromHistory(now); + ExtendedBolus activeExtended = activePlugin.getActiveTreatments().getExtendedBolusFromHistory(now); if (doTempOff) { // If extended in progress @@ -327,15 +329,15 @@ public class DanaRPlugin extends AbstractDanaRPlugin { @NonNull @Override public PumpEnactResult cancelTempBasal(boolean force) { - if (treatmentsPlugin.isInHistoryRealTempBasalInProgress()) + if (activePlugin.getActiveTreatments().isInHistoryRealTempBasalInProgress()) return cancelRealTempBasal(); - if (treatmentsPlugin.isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) { + if (activePlugin.getActiveTreatments().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) { return cancelExtendedBolus(); } PumpEnactResult result = new PumpEnactResult(getInjector()); result.success = true; result.enacted = false; - result.comment = resourceHelper.gs(R.string.virtualpump_resultok); + result.comment = resourceHelper.gs(R.string.ok); result.isTempCancel = true; return result; } @@ -347,7 +349,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { private PumpEnactResult cancelRealTempBasal() { PumpEnactResult result = new PumpEnactResult(getInjector()); - TemporaryBasal runningTB = treatmentsPlugin.getTempBasalFromHistory(System.currentTimeMillis()); + TemporaryBasal runningTB = activePlugin.getActiveTreatments().getTempBasalFromHistory(System.currentTimeMillis()); if (runningTB != null) { sExecutionService.tempBasalStop(); result.enacted = true; @@ -356,7 +358,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { if (!danaRPump.isTempBasalInProgress()) { result.success = true; result.isTempCancel = true; - result.comment = resourceHelper.gs(R.string.virtualpump_resultok); + result.comment = resourceHelper.gs(R.string.ok); aapsLogger.debug(LTag.PUMP, "cancelRealTempBasal: OK"); return result; } else { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/SerialIOThread.java b/danar/src/main/java/info/nightscout/androidaps/danar/SerialIOThread.java similarity index 70% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/SerialIOThread.java rename to danar/src/main/java/info/nightscout/androidaps/danar/SerialIOThread.java index 60c38b2f66..055090ca1e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/SerialIOThread.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/SerialIOThread.java @@ -1,28 +1,24 @@ -package info.nightscout.androidaps.plugins.pump.danaR; +package info.nightscout.androidaps.danar; import android.bluetooth.BluetoothSocket; import android.os.SystemClock; -import org.slf4j.Logger; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import info.nightscout.androidaps.dana.DanaRPump; -import info.nightscout.androidaps.logging.L; +import info.nightscout.androidaps.danar.comm.MessageBase; +import info.nightscout.androidaps.danar.comm.MessageHashTableBase; +import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; -import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageHashTableBase; -import info.nightscout.androidaps.plugins.pump.danaR.services.AbstractSerialIOThread; import info.nightscout.androidaps.utils.CRC; /** * Created by mike on 17.07.2016. */ -public class SerialIOThread extends AbstractSerialIOThread { - private static Logger log = StacktraceLoggerWrapper.getLogger(LTag.PUMPBTCOMM); +public class SerialIOThread extends Thread { + private AAPSLogger aapsLogger; private InputStream mInputStream = null; private OutputStream mOutputStream = null; @@ -35,17 +31,18 @@ public class SerialIOThread extends AbstractSerialIOThread { private MessageHashTableBase hashTable; private DanaRPump danaRPump; - public SerialIOThread(BluetoothSocket rfcommSocket, MessageHashTableBase hashTable, DanaRPump danaRPump) { + public SerialIOThread(AAPSLogger aapsLogger, BluetoothSocket rfcommSocket, MessageHashTableBase hashTable, DanaRPump danaRPump) { super(); this.hashTable = hashTable; this.danaRPump = danaRPump; + this.aapsLogger = aapsLogger; mRfCommSocket = rfcommSocket; try { mOutputStream = mRfCommSocket.getOutputStream(); mInputStream = mRfCommSocket.getInputStream(); } catch (IOException e) { - log.error("Unhandled exception", e); + aapsLogger.error("Unhandled exception", e); } this.start(); } @@ -77,8 +74,7 @@ public class SerialIOThread extends AbstractSerialIOThread { message = hashTable.findMessage(command); } - if (L.isEnabled(LTag.PUMPBTCOMM)) - log.debug("<<<<< " + message.getMessageName() + " " + MessageBase.toHexString(extractedBuff)); + aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + message.getMessageName() + " " + MessageBase.toHexString(extractedBuff)); // process the message content message.received = true; @@ -90,7 +86,7 @@ public class SerialIOThread extends AbstractSerialIOThread { } } catch (Exception e) { if (!e.getMessage().contains("bt socket closed")) - log.error("Thread exception: ", e); + aapsLogger.error("Thread exception: ", e); mKeepRunning = false; } disconnect("EndOfLoop"); @@ -112,7 +108,7 @@ public class SerialIOThread extends AbstractSerialIOThread { return null; } if (mReadBuff[length - 2] != (byte) 0x2E || mReadBuff[length - 1] != (byte) 0x2E) { - log.error("wrong packet lenght=" + length + " data " + MessageBase.toHexString(mReadBuff)); + aapsLogger.error("wrong packet lenght=" + length + " data " + MessageBase.toHexString(mReadBuff)); disconnect("wrong packet"); return null; } @@ -125,7 +121,7 @@ public class SerialIOThread extends AbstractSerialIOThread { byte crcByte1received = mReadBuff[length - 3]; if (crcByte0 != crcByte0received || crcByte1 != crcByte1received) { - log.error("CRC Error" + String.format("%02x ", crcByte0) + String.format("%02x ", crcByte1) + String.format("%02x ", crcByte0received) + String.format("%02x ", crcByte1received)); + aapsLogger.error("CRC Error" + String.format("%02x ", crcByte0) + String.format("%02x ", crcByte1) + String.format("%02x ", crcByte0received) + String.format("%02x ", crcByte1received)); disconnect("crc error"); return null; } @@ -138,80 +134,70 @@ public class SerialIOThread extends AbstractSerialIOThread { mReadBuff = unprocessedData; return extractedBuff; } else { - log.error("Wrong beginning of packet len=" + mReadBuff.length + " " + MessageBase.toHexString(mReadBuff)); + aapsLogger.error("Wrong beginning of packet len=" + mReadBuff.length + " " + MessageBase.toHexString(mReadBuff)); disconnect("Wrong beginning of packet"); return null; } } - @Override public synchronized void sendMessage(MessageBase message) { if (!mRfCommSocket.isConnected()) { - log.error("Socket not connected on sendMessage"); + aapsLogger.error("Socket not connected on sendMessage"); return; } processedMessage = message; byte[] messageBytes = message.getRawMessageBytes(); - if (L.isEnabled(LTag.PUMPBTCOMM)) - log.debug(">>>>> " + message.getMessageName() + " " + MessageBase.toHexString(messageBytes)); + aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + message.getMessageName() + " " + MessageBase.toHexString(messageBytes)); try { mOutputStream.write(messageBytes); } catch (Exception e) { - log.error("sendMessage write exception: ", e); + aapsLogger.error("sendMessage write exception: ", e); } synchronized (message) { try { message.wait(5000); } catch (InterruptedException e) { - log.error("sendMessage InterruptedException", e); + aapsLogger.error("sendMessage InterruptedException", e); } } SystemClock.sleep(200); if (!message.isReceived()) { message.handleMessageNotReceived(); - if (L.isEnabled(LTag.PUMPBTCOMM)) - log.error("Reply not received " + message.getMessageName()); + aapsLogger.error(LTag.PUMPBTCOMM, "Reply not received " + message.getMessageName()); if (message.getCommand() == 0xF0F1) { danaRPump.setNewPump(false); - if (L.isEnabled(LTag.PUMPCOMM)) - log.debug("Old firmware detected"); + aapsLogger.debug(LTag.PUMPBTCOMM, "Old firmware detected"); } } } - @Override public void disconnect(String reason) { mKeepRunning = false; try { mInputStream.close(); } catch (Exception e) { - if (L.isEnabled(LTag.PUMPBTCOMM)) - log.debug(e.getMessage()); + aapsLogger.debug(LTag.PUMPBTCOMM, e.getMessage()); } try { mOutputStream.close(); } catch (Exception e) { - if (L.isEnabled(LTag.PUMPBTCOMM)) - log.debug(e.getMessage()); + aapsLogger.debug(LTag.PUMPBTCOMM, e.getMessage()); } try { mRfCommSocket.close(); } catch (Exception e) { - if (L.isEnabled(LTag.PUMPBTCOMM)) - log.debug(e.getMessage()); + aapsLogger.debug(LTag.PUMPBTCOMM, e.getMessage()); } try { System.runFinalization(); } catch (Exception e) { - if (L.isEnabled(LTag.PUMPBTCOMM)) - log.debug(e.getMessage()); + aapsLogger.debug(LTag.PUMPBTCOMM, e.getMessage()); } - if (L.isEnabled(LTag.PUMPBTCOMM)) - log.debug("Disconnected: " + reason); + aapsLogger.debug(LTag.PUMPBTCOMM, "Disconnected: " + reason); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageBase.java b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java similarity index 99% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageBase.java rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java index 9ebf373795..fc9e9ab6ec 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageBase.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm; +package info.nightscout.androidaps.danar.comm; import android.annotation.TargetApi; import android.os.Build; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableBase.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageHashTableBase.kt similarity index 66% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableBase.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageHashTableBase.kt index 9c524e02a6..269ac7f756 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableBase.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageHashTableBase.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm interface MessageHashTableBase { fun put(message: MessageBase) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableR.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageHashTableR.kt similarity index 77% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableR.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageHashTableR.kt index 518285ce65..54188ed836 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageHashTableR.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageHashTableR.kt @@ -1,16 +1,17 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider +import info.nightscout.androidaps.interfaces.ConfigBuilderInterface +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.general.nsclient.NSUpload -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.resources.ResourceHelper import java.util.* @@ -23,14 +24,15 @@ class MessageHashTableR @Inject constructor( rxBus: RxBusWrapper, resourceHelper: ResourceHelper, constraintChecker: ConstraintChecker, - danaRPump: info.nightscout.androidaps.dana.DanaRPump, + danaRPump: DanaRPump, danaRPlugin: DanaRPlugin, danaRKoreanPlugin: DanaRKoreanPlugin, - configBuilderPlugin: ConfigBuilderPlugin, + configBuilderPlugin: ConfigBuilderInterface, commandQueue: CommandQueueProvider, activePlugin: ActivePluginProvider, nsUpload: NSUpload, injector: HasAndroidInjector, + databaseHelper: DatabaseHelperInterface, dateUtil: DateUtil ) : MessageHashTableBase { @@ -59,15 +61,15 @@ class MessageHashTableR @Inject constructor( put(MsgError(aapsLogger, rxBus, resourceHelper, danaRPump, nsUpload)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT - put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil)) // 0x3101 CMD_HISTORY_MEAL_INS - put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil)) // 0x3102 CMD_HISTORY_DAY_INS - put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil)) // 0x3104 CMD_HISTORY_GLUCOSE - put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil)) // 0x3105 CMD_HISTORY_ALARM - put(MsgHistoryError(aapsLogger, rxBus, dateUtil)) // 0x3106 CMD_HISTORY_ERROR - put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil)) // 0x3107 CMD_HISTORY_CARBOHY - put(MsgHistoryRefill(aapsLogger, rxBus, dateUtil)) // 0x3108 CMD_HISTORY_REFILL - put(MsgHistorySuspend(aapsLogger, rxBus, dateUtil)) // 0x3109 CMD_HISTORY_SUSPEND - put(MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil)) // 0x310A CMD_HISTORY_BASAL_HOUR + put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3101 CMD_HISTORY_MEAL_INS + put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3102 CMD_HISTORY_DAY_INS + put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3104 CMD_HISTORY_GLUCOSE + put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3105 CMD_HISTORY_ALARM + put(MsgHistoryError(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3106 CMD_HISTORY_ERROR + put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3107 CMD_HISTORY_CARBOHY + put(MsgHistoryRefill(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3108 CMD_HISTORY_REFILL + put(MsgHistorySuspend(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x3109 CMD_HISTORY_SUSPEND + put(MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x310A CMD_HISTORY_BASAL_HOUR put(MsgHistoryDone(aapsLogger, danaRPump)) // 0x31F1 CMD_HISTORY_DONT_USED // 0x3202 CMD_SETTING_V_BASAL_INS_I put(MsgSettingBasal(aapsLogger, danaRPump, danaRPlugin)) @@ -87,9 +89,9 @@ class MessageHashTableR @Inject constructor( put(MsgSetUserOptions(aapsLogger, danaRPump)) // 0x330B CMD_SETTING_USER_OPTIONS_S put(MsgSetActivateBasalProfile(aapsLogger, 0.toByte())) // 0x330C CMD_SETTING_PROFILE_NUMBER_S put(MsgHistoryAllDone(aapsLogger, danaRPump)) // 0x41F1 CMD_HISTORY_ALL_DONE - put(MsgHistoryAll(aapsLogger, rxBus, dateUtil)) // 0x41F2 CMD_HISTORY_ALL + put(MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x41F2 CMD_HISTORY_ALL put(MsgHistoryNewDone(aapsLogger, danaRPump)) // 0x42F1 CMD_HISTORY_NEW_DONE - put(MsgHistoryNew(aapsLogger, rxBus, dateUtil)) // 0x42F2 CMD_HISTORY_NEW + put(MsgHistoryNew(aapsLogger, rxBus, dateUtil, databaseHelper)) // 0x42F2 CMD_HISTORY_NEW // 0xF0F1 CMD_PUMP_CHECK_VALUE put(MsgCheckValue(aapsLogger, danaRPump, danaRPlugin)) } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNames.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageOriginalNames.kt similarity index 99% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNames.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageOriginalNames.kt index dd3dd75512..4c1e077a11 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MessageOriginalNames.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageOriginalNames.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import java.util.* diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgress.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusProgress.kt similarity index 89% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgress.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusProgress.kt index 0b15befcfd..05b1bfd39b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusProgress.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusProgress.kt @@ -1,11 +1,11 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.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.dana.DanaRPump import info.nightscout.androidaps.utils.resources.ResourceHelper import kotlin.math.min @@ -13,7 +13,7 @@ class MsgBolusProgress( private val aapsLogger: AAPSLogger, private val resourceHelper: ResourceHelper, private val rxBus: RxBusWrapper, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStart.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStart.kt similarity index 89% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStart.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStart.kt index 306ee71097..a4889bb28a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStart.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStart.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.logging.AAPSLogger @@ -9,7 +9,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgBolusStart( private val aapsLogger: AAPSLogger, constraintChecker: ConstraintChecker, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private var amount: Double ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeed.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStartWithSpeed.kt similarity index 90% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeed.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStartWithSpeed.kt index 85cf6341c8..391ecb0794 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStartWithSpeed.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStartWithSpeed.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.logging.AAPSLogger @@ -9,7 +9,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgBolusStartWithSpeed( private val aapsLogger: AAPSLogger, constraintChecker: ConstraintChecker, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private var amount: Double, speed: Int ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStop.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStop.kt similarity index 88% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStop.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStop.kt index 7b3195e4a9..69c302256e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgBolusStop.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStop.kt @@ -1,18 +1,18 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.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.dana.DanaRPump import info.nightscout.androidaps.utils.resources.ResourceHelper class MsgBolusStop( private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValue.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgCheckValue.kt similarity index 79% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValue.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgCheckValue.kt index 6170acf78d..abdca3d96b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgCheckValue.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgCheckValue.kt @@ -1,13 +1,13 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.DanaRPlugin class MsgCheckValue( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val danaRPlugin: DanaRPlugin ) : MessageBase() { @@ -22,7 +22,7 @@ class MsgCheckValue( danaRPump.hwModel = intFromBuff(bytes, 0, 1) danaRPump.protocol = intFromBuff(bytes, 1, 1) danaRPump.productCode = intFromBuff(bytes, 2, 1) - if (danaRPump.hwModel != info.nightscout.androidaps.dana.DanaRPump.EXPORT_MODEL) { + if (danaRPump.hwModel != DanaRPump.EXPORT_MODEL) { danaRPlugin.disconnect("Wrong Model") aapsLogger.debug(LTag.PUMPCOMM, "Wrong model selected") } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgError.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgError.kt similarity index 91% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgError.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgError.kt index f44de7442b..3a2114677e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgError.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgError.kt @@ -1,19 +1,19 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.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.EventOverviewBolusProgress -import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.utils.resources.ResourceHelper class MsgError( private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val nsUpload: NSUpload ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarm.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAlarm.kt similarity index 63% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarm.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAlarm.kt index 97c942fbf1..81750a9eac 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAlarm.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAlarm.kt @@ -1,5 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -8,8 +9,9 @@ import info.nightscout.androidaps.utils.DateUtil class MsgHistoryAlarm( aapsLogger: AAPSLogger, rxBus: RxBusWrapper, - dateUtil: DateUtil -) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) { + dateUtil: DateUtil, + databaseHelper: DatabaseHelperInterface +) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) { init { SetCommand(0x3105) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAll.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAll.kt similarity index 95% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAll.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAll.kt index 5ed2b212b5..5c437ddc77 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAll.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAll.kt @@ -1,17 +1,18 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm -import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.db.DanaRHistoryRecord +import info.nightscout.androidaps.events.EventDanaRSyncStatus +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.events.EventDanaRSyncStatus import info.nightscout.androidaps.utils.DateUtil open class MsgHistoryAll( val aapsLogger: AAPSLogger, val rxBus: RxBusWrapper, - private val dateUtil: DateUtil + private val dateUtil: DateUtil, + private val databaseHelper: DatabaseHelperInterface ) : MessageBase() { init { @@ -138,7 +139,7 @@ open class MsgHistoryAll( 17.toByte() -> failed = true } - MainApp.getDbHelper().createOrUpdate(danaRHistoryRecord) + databaseHelper.createOrUpdate(danaRHistoryRecord) rxBus.send(EventDanaRSyncStatus(dateUtil.dateAndTimeString(danaRHistoryRecord.recordDate) + " " + messageType)) } } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDone.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAllDone.kt similarity index 81% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDone.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAllDone.kt index 5caff7d6e9..ea4a343466 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryAllDone.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAllDone.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgHistoryAllDone( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHour.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBasalHour.kt similarity index 63% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHour.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBasalHour.kt index 87bfbbc870..14b7c009c6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBasalHour.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBasalHour.kt @@ -1,5 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -8,8 +9,9 @@ import info.nightscout.androidaps.utils.DateUtil class MsgHistoryBasalHour( aapsLogger: AAPSLogger, rxBus: RxBusWrapper, - dateUtil: DateUtil -) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) { + dateUtil: DateUtil, + databaseHelper: DatabaseHelperInterface +) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) { init { SetCommand(0x310A) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolus.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBolus.kt similarity index 63% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolus.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBolus.kt index 693d56d462..94ee55b969 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryBolus.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBolus.kt @@ -1,5 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -8,8 +9,9 @@ import info.nightscout.androidaps.utils.DateUtil class MsgHistoryBolus( aapsLogger: AAPSLogger, rxBus: RxBusWrapper, - dateUtil: DateUtil -) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) { + dateUtil: DateUtil, + databaseHelper: DatabaseHelperInterface +) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) { init { SetCommand(0x3101) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarbo.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryCarbo.kt similarity index 63% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarbo.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryCarbo.kt index 23e060d2a7..9f55b2c5e2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryCarbo.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryCarbo.kt @@ -1,5 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -8,8 +9,9 @@ import info.nightscout.androidaps.utils.DateUtil class MsgHistoryCarbo( aapsLogger: AAPSLogger, rxBus: RxBusWrapper, - dateUtil: DateUtil -) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) { + dateUtil: DateUtil, + databaseHelper: DatabaseHelperInterface +) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) { init { SetCommand(0x3107) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulin.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDailyInsulin.kt similarity index 64% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulin.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDailyInsulin.kt index 5a978fc0ec..173eaa29ea 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDailyInsulin.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDailyInsulin.kt @@ -1,5 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -8,8 +9,9 @@ import info.nightscout.androidaps.utils.DateUtil class MsgHistoryDailyInsulin( aapsLogger: AAPSLogger, rxBus: RxBusWrapper, - dateUtil: DateUtil -) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) { + dateUtil: DateUtil, + databaseHelper: DatabaseHelperInterface +) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) { init { SetCommand(0x3102) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDone.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDone.kt similarity index 81% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDone.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDone.kt index f0c3ba1170..99525ee1d5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryDone.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDone.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgHistoryDone( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryError.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryError.kt similarity index 63% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryError.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryError.kt index 8883a704a9..e8ee5fd720 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryError.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryError.kt @@ -1,5 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -8,8 +9,9 @@ import info.nightscout.androidaps.utils.DateUtil class MsgHistoryError( aapsLogger: AAPSLogger, rxBus: RxBusWrapper, - dateUtil: DateUtil -) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) { + dateUtil: DateUtil, + databaseHelper: DatabaseHelperInterface +) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) { init { SetCommand(0x3106) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucose.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryGlucose.kt similarity index 63% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucose.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryGlucose.kt index 4f717dded1..325154157d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryGlucose.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryGlucose.kt @@ -1,5 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -8,8 +9,9 @@ import info.nightscout.androidaps.utils.DateUtil class MsgHistoryGlucose( aapsLogger: AAPSLogger, rxBus: RxBusWrapper, - dateUtil: DateUtil -) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) { + dateUtil: DateUtil, + databaseHelper: DatabaseHelperInterface +) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) { init { SetCommand(0x3104) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNew.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNew.kt similarity index 63% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNew.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNew.kt index b271f4f915..1ba71e3138 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNew.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNew.kt @@ -1,5 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -8,8 +9,9 @@ import info.nightscout.androidaps.utils.DateUtil class MsgHistoryNew( aapsLogger: AAPSLogger, rxBus: RxBusWrapper, - dateUtil: DateUtil -) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) { + dateUtil: DateUtil, + databaseHelper: DatabaseHelperInterface +) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) { init { SetCommand(0x42F2) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDone.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNewDone.kt similarity index 81% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDone.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNewDone.kt index b71179342a..b24e661cad 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryNewDone.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNewDone.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgHistoryNewDone( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefill.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryRefill.kt similarity index 63% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefill.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryRefill.kt index 24bb799db8..66494adfbb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistoryRefill.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryRefill.kt @@ -1,5 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -8,8 +9,9 @@ import info.nightscout.androidaps.utils.DateUtil class MsgHistoryRefill( aapsLogger: AAPSLogger, rxBus: RxBusWrapper, - dateUtil: DateUtil -) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) { + dateUtil: DateUtil, + databaseHelper: DatabaseHelperInterface +) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) { init { SetCommand(0x3108) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspend.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistorySuspend.kt similarity index 63% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspend.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistorySuspend.kt index bd116ed709..a37fad26f9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgHistorySuspend.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistorySuspend.kt @@ -1,5 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -8,8 +9,9 @@ import info.nightscout.androidaps.utils.DateUtil class MsgHistorySuspend( aapsLogger: AAPSLogger, rxBus: RxBusWrapper, - dateUtil: DateUtil -) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) { + dateUtil: DateUtil, + databaseHelper: DatabaseHelperInterface +) : MsgHistoryAll(aapsLogger, rxBus, dateUtil, databaseHelper) { init { SetCommand(0x3109) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasic.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBasic.kt similarity index 96% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasic.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBasic.kt index be6ea26f4b..66e417add6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBasic.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBasic.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgInitConnStatusBasic( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolus.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBolus.kt similarity index 92% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolus.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBolus.kt index 9bd09848d7..e2b7aa0ccf 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusBolus.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBolus.kt @@ -1,20 +1,20 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.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.dana.DanaRPump import info.nightscout.androidaps.utils.resources.ResourceHelper class MsgInitConnStatusBolus( private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOption.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusOption.kt similarity index 93% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOption.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusOption.kt index 9b7ce29bea..755c61489f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusOption.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusOption.kt @@ -1,6 +1,7 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -8,14 +9,13 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification -import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.utils.resources.ResourceHelper class MsgInitConnStatusOption( private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val activePlugin: ActivePluginProvider ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTime.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusTime.kt similarity index 85% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTime.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusTime.kt index dd0a975726..7d345d77e9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgInitConnStatusTime.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusTime.kt @@ -1,18 +1,18 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.DanaRPlugin +import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.events.EventRebuildTabs import info.nightscout.androidaps.interfaces.CommandQueueProvider +import info.nightscout.androidaps.interfaces.ConfigBuilderInterface import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.resources.ResourceHelper @@ -20,10 +20,10 @@ class MsgInitConnStatusTime( private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val danaRPlugin: DanaRPlugin, private val danaRKoreanPlugin: DanaRKoreanPlugin, - private val configBuilderPlugin: ConfigBuilderPlugin, + private val configBuilderPlugin: ConfigBuilderInterface, private val commandQueue: CommandQueueProvider, private val dateUtil: DateUtil ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStart.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStart.kt similarity index 87% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStart.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStart.kt index 35e5f2391a..3765d47905 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStart.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStart.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStop.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStop.kt similarity index 87% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStop.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStop.kt index c6d6ac4ae7..c2c2ee78d8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgPCCommStop.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStop.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfile.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetActivateBasalProfile.kt similarity index 92% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfile.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetActivateBasalProfile.kt index 6343002f99..ba60178a34 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetActivateBasalProfile.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetActivateBasalProfile.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfile.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetBasalProfile.kt similarity index 94% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfile.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetBasalProfile.kt index 1af0c71832..f49a34b394 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetBasalProfile.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetBasalProfile.kt @@ -1,6 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntry.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetCarbsEntry.kt similarity index 96% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntry.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetCarbsEntry.kt index 03fcfbca6b..611da11862 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetCarbsEntry.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetCarbsEntry.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStart.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStart.kt similarity index 95% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStart.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStart.kt index 23da6ede84..cb13f2c2e1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStart.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStart.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.interfaces.Constraint import info.nightscout.androidaps.logging.AAPSLogger diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStop.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStop.kt similarity index 92% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStop.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStop.kt index 887f6c0cdb..b655ba6361 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetExtendedBolusStop.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStop.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfile.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetSingleBasalProfile.kt similarity index 94% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfile.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetSingleBasalProfile.kt index 2997a8478f..c194eebe0e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetSingleBasalProfile.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetSingleBasalProfile.kt @@ -1,6 +1,6 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.bus.RxBusWrapper diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStart.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStart.kt similarity index 95% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStart.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStart.kt index abdf6b9d1b..e9f9a201c2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStart.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStart.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStop.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStop.kt similarity index 92% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStop.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStop.kt index cc1308b5e3..97551b446c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTempBasalStop.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStop.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTime.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTime.kt similarity index 92% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTime.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTime.kt index 0fcdcd5589..aa526f19ad 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetTime.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTime.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptions.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetUserOptions.kt similarity index 93% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptions.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetUserOptions.kt index 8a69890dd4..1a883b93df 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSetUserOptions.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetUserOptions.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgSetUserOptions( private val aapsLogger: AAPSLogger, - danaRPump: info.nightscout.androidaps.dana.DanaRPump + danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfile.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingActiveProfile.kt similarity index 81% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfile.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingActiveProfile.kt index 1319874016..cd1bcdb95d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingActiveProfile.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingActiveProfile.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgSettingActiveProfile( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasal.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasal.kt similarity index 83% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasal.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasal.kt index 1f06d35217..5984651836 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasal.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasal.kt @@ -1,14 +1,14 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danar.DanaRPlugin import java.util.* class MsgSettingBasal( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val danaRPlugin: DanaRPlugin ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAll.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasalProfileAll.kt similarity index 94% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAll.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasalProfileAll.kt index 3e3eb03a5a..c87a05a006 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingBasalProfileAll.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasalProfileAll.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -15,7 +15,7 @@ import java.util.* */ class MsgSettingBasalProfileAll( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { override fun handleMessage(bytes: ByteArray) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucose.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingGlucose.kt similarity index 86% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucose.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingGlucose.kt index 86f3be273e..a46584b16f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingGlucose.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingGlucose.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -9,7 +9,7 @@ import info.nightscout.androidaps.dana.DanaRPump */ class MsgSettingGlucose( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValues.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMaxValues.kt similarity index 86% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValues.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMaxValues.kt index f637e28842..a16de6951e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMaxValues.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMaxValues.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgSettingMaxValues( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMeal.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMeal.kt similarity index 91% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMeal.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMeal.kt index 8f0dfa15c4..74ec24b32e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingMeal.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMeal.kt @@ -1,6 +1,8 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm -import info.nightscout.androidaps.R +import info.nightscout.androidaps.dana.DanaRPump +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin +import info.nightscout.androidaps.danar.R import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -8,15 +10,13 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification -import info.nightscout.androidaps.dana.DanaRPump -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin import info.nightscout.androidaps.utils.resources.ResourceHelper class MsgSettingMeal( private val aapsLogger: AAPSLogger, private val rxBus: RxBusWrapper, private val resourceHelper: ResourceHelper, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val danaRKoreanPlugin: DanaRKoreanPlugin ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatios.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatios.kt similarity index 93% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatios.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatios.kt index 609ce479f9..ee3647e7e8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatios.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatios.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgSettingProfileRatios( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAll.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatiosAll.kt similarity index 95% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAll.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatiosAll.kt index 201625bb66..2ebc3776f6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingProfileRatiosAll.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatiosAll.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgSettingProfileRatiosAll( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTime.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingPumpTime.kt similarity index 89% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTime.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingPumpTime.kt index 0bfec34561..553bce504c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingPumpTime.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingPumpTime.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -9,7 +9,7 @@ import java.util.* class MsgSettingPumpTime( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val dateUtil: DateUtil ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfo.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingShippingInfo.kt similarity index 86% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfo.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingShippingInfo.kt index cde068bfd8..586f91515b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingShippingInfo.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingShippingInfo.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgSettingShippingInfo( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptions.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingUserOptions.kt similarity index 95% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptions.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingUserOptions.kt index eea5a9a7d0..096547aa24 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgSettingUserOptions.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingUserOptions.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -7,7 +7,7 @@ import java.util.* class MsgSettingUserOptions( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatus.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatus.kt similarity index 92% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatus.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatus.kt index e0f611b06c..abe8e7f524 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatus.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatus.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgStatus( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasic.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBasic.kt similarity index 94% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasic.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBasic.kt index 5eabda782a..41d40907f7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBasic.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBasic.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgStatusBasic( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtended.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBolusExtended.kt similarity index 97% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtended.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBolusExtended.kt index d96915d170..9ef8c39c9f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusBolusExtended.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBolusExtended.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import dagger.android.HasAndroidInjector import info.nightscout.androidaps.db.ExtendedBolus @@ -13,7 +13,7 @@ import kotlin.math.ceil class MsgStatusBolusExtended( private val injector: HasAndroidInjector, private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val activePlugin: ActivePluginProvider, private val dateUtil: DateUtil ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfile.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusProfile.kt similarity index 92% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfile.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusProfile.kt index 678ee859ac..63e0eb0fc0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusProfile.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusProfile.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -6,7 +6,7 @@ import info.nightscout.androidaps.dana.DanaRPump class MsgStatusProfile( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump + private val danaRPump: DanaRPump ) : MessageBase() { init { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasal.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusTempBasal.kt similarity index 97% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasal.kt rename to danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusTempBasal.kt index aa30e615f6..67ff7fadfb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/comm/MsgStatusTempBasal.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusTempBasal.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.comm +package info.nightscout.androidaps.danar.comm import dagger.android.HasAndroidInjector import info.nightscout.androidaps.db.Source @@ -11,7 +11,7 @@ import kotlin.math.ceil class MsgStatusTempBasal( private val aapsLogger: AAPSLogger, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val activePlugin: ActivePluginProvider, private val injector: HasAndroidInjector ) : MessageBase() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/AbstractDanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java similarity index 87% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/AbstractDanaRExecutionService.java rename to danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java index 3b77c9723e..0d94d3797f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/AbstractDanaRExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.services; +package info.nightscout.androidaps.danar.services; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; @@ -16,31 +16,33 @@ import javax.inject.Inject; import dagger.android.DaggerService; import dagger.android.HasAndroidInjector; -import info.nightscout.androidaps.R; import info.nightscout.androidaps.dana.DanaRPump; import info.nightscout.androidaps.dana.comm.RecordTypes; +import info.nightscout.androidaps.danar.R; +import info.nightscout.androidaps.danar.SerialIOThread; +import info.nightscout.androidaps.danar.comm.MessageBase; +import info.nightscout.androidaps.danar.comm.MsgBolusStop; +import info.nightscout.androidaps.danar.comm.MsgHistoryAlarm; +import info.nightscout.androidaps.danar.comm.MsgHistoryBasalHour; +import info.nightscout.androidaps.danar.comm.MsgHistoryBolus; +import info.nightscout.androidaps.danar.comm.MsgHistoryCarbo; +import info.nightscout.androidaps.danar.comm.MsgHistoryDailyInsulin; +import info.nightscout.androidaps.danar.comm.MsgHistoryError; +import info.nightscout.androidaps.danar.comm.MsgHistoryGlucose; +import info.nightscout.androidaps.danar.comm.MsgHistoryRefill; +import info.nightscout.androidaps.danar.comm.MsgHistorySuspend; +import info.nightscout.androidaps.danar.comm.MsgPCCommStart; +import info.nightscout.androidaps.danar.comm.MsgPCCommStop; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; +import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventBTChange; import info.nightscout.androidaps.events.EventPumpStatusChanged; +import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; 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.MessageBase; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgBolusStop; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgHistoryAlarm; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgHistoryBasalHour; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgHistoryBolus; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgHistoryCarbo; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgHistoryDailyInsulin; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgHistoryError; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgHistoryGlucose; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgHistoryRefill; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgHistorySuspend; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgPCCommStart; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgPCCommStop; -import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.ToastUtils; @@ -63,6 +65,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { @Inject DanaRPump danaRPump; @Inject FabricPrivacy fabricPrivacy; @Inject DateUtil dateUtil; + @Inject DatabaseHelperInterface databaseHelper; private CompositeDisposable disposable = new CompositeDisposable(); @@ -76,7 +79,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { protected boolean mConnectionInProgress = false; protected boolean mHandshakeInProgress = false; - protected AbstractSerialIOThread mSerialIOThread; + protected SerialIOThread mSerialIOThread; protected IBinder mBinder; @@ -229,31 +232,31 @@ public abstract class AbstractDanaRExecutionService extends DaggerService { MessageBase msg = null; switch (type) { case RecordTypes.RECORD_TYPE_ALARM: - msg = new MsgHistoryAlarm(aapsLogger, rxBus, dateUtil); + msg = new MsgHistoryAlarm(aapsLogger, rxBus, dateUtil, databaseHelper); break; case RecordTypes.RECORD_TYPE_BASALHOUR: - msg = new MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil); + msg = new MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil, databaseHelper); break; case RecordTypes.RECORD_TYPE_BOLUS: - msg = new MsgHistoryBolus(aapsLogger, rxBus, dateUtil); + msg = new MsgHistoryBolus(aapsLogger, rxBus, dateUtil, databaseHelper); break; case RecordTypes.RECORD_TYPE_CARBO: - msg = new MsgHistoryCarbo(aapsLogger, rxBus, dateUtil); + msg = new MsgHistoryCarbo(aapsLogger, rxBus, dateUtil, databaseHelper); break; case RecordTypes.RECORD_TYPE_DAILY: - msg = new MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil); + msg = new MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil, databaseHelper); break; case RecordTypes.RECORD_TYPE_ERROR: - msg = new MsgHistoryError(aapsLogger, rxBus, dateUtil); + msg = new MsgHistoryError(aapsLogger, rxBus, dateUtil, databaseHelper); break; case RecordTypes.RECORD_TYPE_GLUCOSE: - msg = new MsgHistoryGlucose(aapsLogger, rxBus, dateUtil); + msg = new MsgHistoryGlucose(aapsLogger, rxBus, dateUtil, databaseHelper); break; case RecordTypes.RECORD_TYPE_REFILL: - msg = new MsgHistoryRefill(aapsLogger, rxBus, dateUtil); + msg = new MsgHistoryRefill(aapsLogger, rxBus, dateUtil, databaseHelper); break; case RecordTypes.RECORD_TYPE_SUSPEND: - msg = new MsgHistorySuspend(aapsLogger, rxBus, dateUtil); + msg = new MsgHistorySuspend(aapsLogger, rxBus, dateUtil, databaseHelper); break; } danaRPump.setHistoryDoneReceived(false); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/DanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java similarity index 87% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/DanaRExecutionService.java rename to danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java index d32383bef4..f7e52e9ff9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/DanaRExecutionService.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.pump.danaR.services; +package info.nightscout.androidaps.danar.services; import android.os.Binder; import android.os.SystemClock; @@ -10,9 +10,40 @@ import javax.inject.Inject; import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.Constants; -import info.nightscout.androidaps.R; import info.nightscout.androidaps.dana.DanaRPump; import info.nightscout.androidaps.dana.events.EventDanaRNewStatus; +import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin; +import info.nightscout.androidaps.danar.DanaRPlugin; +import info.nightscout.androidaps.danar.R; +import info.nightscout.androidaps.danar.SerialIOThread; +import info.nightscout.androidaps.danar.comm.MessageBase; +import info.nightscout.androidaps.danar.comm.MessageHashTableR; +import info.nightscout.androidaps.danar.comm.MsgBolusStart; +import info.nightscout.androidaps.danar.comm.MsgBolusStartWithSpeed; +import info.nightscout.androidaps.danar.comm.MsgCheckValue; +import info.nightscout.androidaps.danar.comm.MsgSetActivateBasalProfile; +import info.nightscout.androidaps.danar.comm.MsgSetBasalProfile; +import info.nightscout.androidaps.danar.comm.MsgSetCarbsEntry; +import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStart; +import info.nightscout.androidaps.danar.comm.MsgSetExtendedBolusStop; +import info.nightscout.androidaps.danar.comm.MsgSetTempBasalStart; +import info.nightscout.androidaps.danar.comm.MsgSetTempBasalStop; +import info.nightscout.androidaps.danar.comm.MsgSetTime; +import info.nightscout.androidaps.danar.comm.MsgSetUserOptions; +import info.nightscout.androidaps.danar.comm.MsgSettingActiveProfile; +import info.nightscout.androidaps.danar.comm.MsgSettingBasal; +import info.nightscout.androidaps.danar.comm.MsgSettingGlucose; +import info.nightscout.androidaps.danar.comm.MsgSettingMaxValues; +import info.nightscout.androidaps.danar.comm.MsgSettingMeal; +import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatios; +import info.nightscout.androidaps.danar.comm.MsgSettingProfileRatiosAll; +import info.nightscout.androidaps.danar.comm.MsgSettingPumpTime; +import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo; +import info.nightscout.androidaps.danar.comm.MsgSettingUserOptions; +import info.nightscout.androidaps.danar.comm.MsgStatus; +import info.nightscout.androidaps.danar.comm.MsgStatusBasic; +import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended; +import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.Treatment; @@ -31,37 +62,6 @@ import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; -import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin; -import info.nightscout.androidaps.plugins.pump.danaR.SerialIOThread; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageBase; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MessageHashTableR; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgBolusStart; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgBolusStartWithSpeed; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgCheckValue; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetActivateBasalProfile; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetBasalProfile; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetCarbsEntry; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetExtendedBolusStart; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetExtendedBolusStop; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetTempBasalStart; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetTempBasalStop; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetTime; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSetUserOptions; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingActiveProfile; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingBasal; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingGlucose; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingMaxValues; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingMeal; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingProfileRatios; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingProfileRatiosAll; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingPumpTime; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingShippingInfo; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgSettingUserOptions; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgStatus; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgStatusBasic; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgStatusBolusExtended; -import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgStatusTempBasal; -import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.commands.Command; import info.nightscout.androidaps.utils.resources.ResourceHelper; @@ -124,7 +124,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService { if (mSerialIOThread != null) { mSerialIOThread.disconnect("Recreate SerialIOThread"); } - mSerialIOThread = new SerialIOThread(mRfcommSocket, messageHashTableR, danaRPump); + mSerialIOThread = new SerialIOThread(aapsLogger, mRfcommSocket, messageHashTableR, danaRPump); mHandshakeInProgress = true; rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.HANDSHAKING, 0)); } diff --git a/app/src/main/res/xml/pref_danar.xml b/danar/src/main/res/xml/pref_danar.xml similarity index 96% rename from app/src/main/res/xml/pref_danar.xml rename to danar/src/main/res/xml/pref_danar.xml index 16ef4aa57d..64246a6544 100644 --- a/app/src/main/res/xml/pref_danar.xml +++ b/danar/src/main/res/xml/pref_danar.xml @@ -7,7 +7,7 @@ android:title="@string/danar_pump_settings" app:initialExpandedChildrenCount="0"> - diff --git a/app/src/main/res/xml/pref_danarkorean.xml b/danar/src/main/res/xml/pref_danarkorean.xml similarity index 96% rename from app/src/main/res/xml/pref_danarkorean.xml rename to danar/src/main/res/xml/pref_danarkorean.xml index 90b8ead439..c4de35face 100644 --- a/app/src/main/res/xml/pref_danarkorean.xml +++ b/danar/src/main/res/xml/pref_danarkorean.xml @@ -7,7 +7,7 @@ android:title="@string/danar_pump_settings" app:initialExpandedChildrenCount="0"> - diff --git a/app/src/main/res/xml/pref_danarv2.xml b/danar/src/main/res/xml/pref_danarv2.xml similarity index 95% rename from app/src/main/res/xml/pref_danarv2.xml rename to danar/src/main/res/xml/pref_danarv2.xml index 011490beec..d31b25f699 100644 --- a/app/src/main/res/xml/pref_danarv2.xml +++ b/danar/src/main/res/xml/pref_danarv2.xml @@ -7,7 +7,7 @@ android:title="@string/danar_pump_settings" app:initialExpandedChildrenCount="0"> - diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt index 7a118ffdc6..96695dca2f 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/DanaRSPlugin.kt @@ -9,6 +9,7 @@ import android.text.format.DateFormat import androidx.preference.Preference import dagger.android.HasAndroidInjector import info.nightscout.androidaps.dana.DanaPumpInterface +import info.nightscout.androidaps.dana.DanaRPump import info.nightscout.androidaps.danars.events.EventDanaRSDeviceChange import info.nightscout.androidaps.danars.services.DanaRSService import info.nightscout.androidaps.data.DetailedBolusInfo @@ -54,7 +55,7 @@ class DanaRSPlugin @Inject constructor( private val activePluginProvider: ActivePluginProvider, private val sp: SP, commandQueue: CommandQueueProvider, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val detailedBolusInfoStorage: DetailedBolusInfoStorage, private val fabricPrivacy: FabricPrivacy, private val dateUtil: DateUtil, diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_Events.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_Events.kt index 28e3116233..a79143ca42 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_Events.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_APS_History_Events.kt @@ -29,7 +29,7 @@ open class DanaRS_Packet_APS_History_Events( @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var activePlugin: ActivePluginProvider - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump @Inject lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage @Inject lateinit var sp: SP @Inject lateinit var nsUpload: NSUpload diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Basal_Rate.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Basal_Rate.kt index ba9d4c9741..e0fdc9080c 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Basal_Rate.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Basal_Rate.kt @@ -19,7 +19,7 @@ class DanaRS_Packet_Basal_Get_Basal_Rate( @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_BASAL_RATE diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Basal_Rate.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Basal_Rate.kt index 02c0f97982..acfd4ed210 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Basal_Rate.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Basal_Rate.kt @@ -12,7 +12,7 @@ open class DanaRS_Packet_Basal_Get_Profile_Basal_Rate( private val profileNumber: Int = 0 ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_PROFILE_BASAL_RATE diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Number.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Number.kt index 9800c8a685..04deec02eb 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Number.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Profile_Number.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_Basal_Get_Profile_Number( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__GET_PROFILE_NUMBER diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_State.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_State.kt index 19bb45c5dc..127a9c5331 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_State.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Basal_Get_Temporary_Basal_State.kt @@ -11,7 +11,7 @@ class DanaRS_Packet_Basal_Get_Temporary_Basal_State( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BASAL__TEMPORARY_BASAL_STATE diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Bolus_Option.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Bolus_Option.kt index ec51a4d4a9..ed706bb52b 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Bolus_Option.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Bolus_Option.kt @@ -18,7 +18,7 @@ class DanaRS_Packet_Bolus_Get_Bolus_Option( @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_BOLUS_OPTION diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_CIR_CF_Array.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_CIR_CF_Array.kt index 19591e2b7a..53f0eba737 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_CIR_CF_Array.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_CIR_CF_Array.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_Bolus_Get_CIR_CF_Array( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CIR_CF_ARRAY diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Calculation_Information.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Calculation_Information.kt index 2512fcf342..cad921d048 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Calculation_Information.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Calculation_Information.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_Bolus_Get_Calculation_Information( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CALCULATION_INFORMATION diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information.kt index 28a0b9e661..d1d521af1a 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_CARBOHYDRATE_CALCULATION_INFORMATION diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Dual_Bolus.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Dual_Bolus.kt index e598818bdd..e033733b6a 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Dual_Bolus.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Dual_Bolus.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_Bolus_Get_Dual_Bolus( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_DUAL_BOLUS diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus.kt index 0684e97bf0..0d7c5e9b89 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_Bolus_Get_Extended_Bolus( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_State.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_State.kt index aa50fa1c81..701ce3c723 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_State.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Bolus_State.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_Bolus_Get_Extended_Bolus_State( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_BOLUS_STATE diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State.kt index cf75621379..3bae9a92d3 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_EXTENDED_MENU_OPTION_STATE diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_Information.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_Information.kt index 646d2858d4..984983a04f 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_Information.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_Information.kt @@ -11,7 +11,7 @@ class DanaRS_Packet_Bolus_Get_Step_Bolus_Information( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__GET_STEP_BOLUS_INFORMATION diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Start.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Start.kt index 01357331e1..9df37cef85 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Start.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Start.kt @@ -14,7 +14,7 @@ class DanaRS_Packet_Bolus_Set_Step_Bolus_Start( private var speed: Int = 0 ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump @Inject lateinit var constraintChecker: ConstraintChecker init { diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Stop.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Stop.kt index 738caa4ed3..18eada935d 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Stop.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Stop.kt @@ -16,7 +16,7 @@ open class DanaRS_Packet_Bolus_Set_Step_Bolus_Stop( @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_BOLUS__SET_STEP_BOLUS_STOP diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_More_Information.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_More_Information.kt index 10c853ff87..ce7d36e8d4 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_More_Information.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_More_Information.kt @@ -11,7 +11,7 @@ class DanaRS_Packet_General_Get_More_Information( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_MORE_INFORMATION diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Password.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Password.kt index 766fb9cf20..6c5785c358 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Password.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Password.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_General_Get_Password( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PASSWORD diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Pump_Check.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Pump_Check.kt index fa06dc7257..6ff1ef656c 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Pump_Check.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Pump_Check.kt @@ -17,7 +17,7 @@ class DanaRS_Packet_General_Get_Pump_Check( @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PUMP_CHECK diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_Information.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_Information.kt index c85fcd1d85..3e30953062 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_Information.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_Information.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_General_Get_Shipping_Information( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_SHIPPING_INFORMATION diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_Version.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_Version.kt index 336963a5d0..ca023162f8 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_Version.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Shipping_Version.kt @@ -11,7 +11,7 @@ class DanaRS_Packet_General_Get_Shipping_Version( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_GENERAL__GET_SHIPPING_VERSION diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Today_Delivery_Total.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Today_Delivery_Total.kt index 8b31babf73..471d1dbc0a 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Today_Delivery_Total.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Get_Today_Delivery_Total.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_General_Get_Today_Delivery_Total( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_TODAY_DELIVERY_TOTAL diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Initial_Screen_Information.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Initial_Screen_Information.kt index ee0f514d4b..920c597ffd 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Initial_Screen_Information.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_General_Initial_Screen_Information.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_General_Initial_Screen_Information( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__INITIAL_SCREEN_INFORMATION diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Complete.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Complete.kt index 61fd16286d..051a78b351 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Complete.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Complete.kt @@ -17,7 +17,7 @@ class DanaRS_Packet_Notify_Delivery_Complete( @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Rate_Display.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Rate_Display.kt index c95bba668f..66a99aed58 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Rate_Display.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Notify_Delivery_Rate_Display.kt @@ -17,7 +17,7 @@ class DanaRS_Packet_Notify_Delivery_Rate_Display( @Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var resourceHelper: ResourceHelper - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { type = BleEncryption.DANAR_PACKET__TYPE_NOTIFY diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_Pump_Time.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_Pump_Time.kt index 3d921048f7..1a7f475ad3 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_Pump_Time.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_Pump_Time.kt @@ -11,7 +11,7 @@ class DanaRS_Packet_Option_Get_Pump_Time( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__GET_PUMP_TIME diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_Option.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_Option.kt index d4aead111c..46e1560868 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_Option.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Get_User_Option.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_Option_Get_User_Option( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__GET_USER_OPTION diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_Option.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_Option.kt index 45ec9d593b..7ed2b082cf 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_Option.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Option_Set_User_Option.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_Option_Set_User_Option( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__SET_USER_OPTION diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Get_Pump_Dec_Ratio.kt b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Get_Pump_Dec_Ratio.kt index 8fefb4c454..81f15ee543 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Get_Pump_Dec_Ratio.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/comm/DanaRS_Packet_Review_Get_Pump_Dec_Ratio.kt @@ -10,7 +10,7 @@ class DanaRS_Packet_Review_Get_Pump_Dec_Ratio( injector: HasAndroidInjector ) : DanaRS_Packet(injector) { - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump init { opCode = BleEncryption.DANAR_PACKET__OPCODE_REVIEW__GET_PUMP_DEC_RATIO diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt b/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt index b29ab6d8ef..59d2bcad34 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt @@ -43,7 +43,7 @@ class BLEComm @Inject internal constructor( private val rxBus: RxBusWrapper, private val sp: SP, private val danaRSMessageHashTable: DanaRSMessageHashTable, - private val danaRPump: info.nightscout.androidaps.dana.DanaRPump, + private val danaRPump: DanaRPump, private val danaRSPlugin: DanaRSPlugin, private val bleEncryption: BleEncryption, private val nsUpload: NSUpload diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt b/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt index ca027e8f5a..596aee5356 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt @@ -59,7 +59,7 @@ class DanaRSService : DaggerService() { @Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var context: Context @Inject lateinit var danaRSPlugin: DanaRSPlugin - @Inject lateinit var danaRPump: info.nightscout.androidaps.dana.DanaRPump + @Inject lateinit var danaRPump: DanaRPump @Inject lateinit var danaRSMessageHashTable: DanaRSMessageHashTable @Inject lateinit var activePlugin: ActivePluginProvider @Inject lateinit var constraintChecker: ConstraintChecker diff --git a/settings.gradle b/settings.gradle index c1a3ec986c..15de48ff31 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,3 @@ include ':app', ':wear', ':core', ':danars' include ':dana' +include ':danar'