diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt index 8b3955ca8b..dda071f1d2 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt @@ -26,7 +26,7 @@ abstract class ActivitiesModule { @ContributesAndroidInjector abstract fun contributesInsightPairingInformationActivity(): InsightPairingInformationActivity @ContributesAndroidInjector abstract fun contributesLogSettingActivity(): LogSettingActivity @ContributesAndroidInjector abstract fun contributeMainActivity(): MainActivity - @ContributesAndroidInjector abstract fun contributesMedtronicHistoryActivity(): info.nightscout.androidaps.plugins.pump.medtronic.dialog.MedtronicHistoryActivity + @ContributesAndroidInjector abstract fun contributesMedtronicHistoryActivity(): MedtronicHistoryActivity @ContributesAndroidInjector abstract fun contributesPreferencesActivity(): PreferencesActivity @ContributesAndroidInjector abstract fun contributesQuickWizardListActivity(): QuickWizardListActivity @ContributesAndroidInjector abstract fun contributesRequestDexcomPermissionActivity(): RequestDexcomPermissionActivity diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt index 46028b4161..cde5137ac9 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt @@ -29,6 +29,8 @@ import info.nightscout.androidaps.plugins.insulin.InsulinFragment import info.nightscout.androidaps.plugins.profile.local.LocalProfileFragment import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment import info.nightscout.androidaps.plugins.pump.combo.ComboFragment +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic @@ -63,7 +65,7 @@ abstract class FragmentsModule { @ContributesAndroidInjector abstract fun contributesLocalInsightFragment(): LocalInsightFragment @ContributesAndroidInjector abstract fun contributesLoopFragment(): LoopFragment @ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment - @ContributesAndroidInjector abstract fun contributesMedtronicFragment(): info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment + @ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment @ContributesAndroidInjector abstract fun contributesOmnipodFragment(): OmnipodFragment @ContributesAndroidInjector abstract fun contributesNSProfileFragment(): NSProfileFragment @ContributesAndroidInjector abstract fun contributesNSClientFragment(): NSClientFragment @@ -106,7 +108,7 @@ abstract class FragmentsModule { @ContributesAndroidInjector abstract fun contributesPasswordCheck(): PasswordCheck - @ContributesAndroidInjector abstract fun contributesRileyLinkStatusGeneral(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment - @ContributesAndroidInjector abstract fun contributesRileyLinkStatusHistoryFragment(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment - @ContributesAndroidInjector abstract fun contributesRileyLinkStatusDeviceMedtronic(): info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic + @ContributesAndroidInjector abstract fun contributesRileyLinkStatusGeneral(): RileyLinkStatusGeneralFragment + @ContributesAndroidInjector abstract fun contributesRileyLinkStatusHistoryFragment(): RileyLinkStatusHistoryFragment + @ContributesAndroidInjector abstract fun contributesRileyLinkStatusDeviceMedtronic(): RileyLinkStatusDeviceMedtronic } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/MedtronicModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/MedtronicModule.kt index 454ef6800c..f813a6d49d 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/MedtronicModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/MedtronicModule.kt @@ -2,25 +2,33 @@ package info.nightscout.androidaps.dependencyInjection import dagger.Module import dagger.android.ContributesAndroidInjector +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SendAndListen +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SetPreamble +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioPacket +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioResponse +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.* import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUITask @Module @Suppress("unused") abstract class MedtronicModule { - @ContributesAndroidInjector abstract fun rileyLinkCommunicationManagerProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager - @ContributesAndroidInjector abstract fun medtronicCommunicationManagerProvider(): info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager - @ContributesAndroidInjector abstract fun medtronicUITaskProvider(): info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUITask - @ContributesAndroidInjector abstract fun serviceTaskProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTask - @ContributesAndroidInjector abstract fun pumpTaskProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.PumpTask - @ContributesAndroidInjector abstract fun discoverGattServicesTaskProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.DiscoverGattServicesTask - @ContributesAndroidInjector abstract fun initializePumpManagerTaskProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.InitializePumpManagerTask - @ContributesAndroidInjector abstract fun resetRileyLinkConfigurationTaskProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask - @ContributesAndroidInjector abstract fun wakeAndTuneTaskProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask - @ContributesAndroidInjector abstract fun radioResponseProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioResponse - @ContributesAndroidInjector abstract fun rileyLinkBLEProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE - @ContributesAndroidInjector abstract fun rfSpyProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy - @ContributesAndroidInjector abstract fun sendAndListenProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SendAndListen - @ContributesAndroidInjector abstract fun setPreambleProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SetPreamble - @ContributesAndroidInjector abstract fun radioPacketProvider(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioPacket + @ContributesAndroidInjector abstract fun rileyLinkCommunicationManagerProvider(): RileyLinkCommunicationManager + @ContributesAndroidInjector abstract fun medtronicCommunicationManagerProvider(): MedtronicCommunicationManager + @ContributesAndroidInjector abstract fun medtronicUITaskProvider(): MedtronicUITask + @ContributesAndroidInjector abstract fun serviceTaskProvider(): ServiceTask + @ContributesAndroidInjector abstract fun pumpTaskProvider(): PumpTask + @ContributesAndroidInjector abstract fun discoverGattServicesTaskProvider(): DiscoverGattServicesTask + @ContributesAndroidInjector abstract fun initializePumpManagerTaskProvider(): InitializePumpManagerTask + @ContributesAndroidInjector abstract fun resetRileyLinkConfigurationTaskProvider(): ResetRileyLinkConfigurationTask + @ContributesAndroidInjector abstract fun wakeAndTuneTaskProvider(): WakeAndTuneTask + @ContributesAndroidInjector abstract fun radioResponseProvider(): RadioResponse + @ContributesAndroidInjector abstract fun rileyLinkBLEProvider(): RileyLinkBLE + @ContributesAndroidInjector abstract fun rfSpyProvider(): RFSpy + @ContributesAndroidInjector abstract fun sendAndListenProvider(): SendAndListen + @ContributesAndroidInjector abstract fun setPreambleProvider(): SetPreamble + @ContributesAndroidInjector abstract fun radioPacketProvider(): RadioPacket } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt index 40e2e91bd7..f179580a55 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt @@ -145,7 +145,7 @@ abstract class PluginsModule { @PumpDriver @IntoMap @IntKey(150) - abstract fun bindMedtronicPumpPlugin(plugin: info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin): PluginBase + abstract fun bindMedtronicPumpPlugin(plugin: MedtronicPumpPlugin): PluginBase @Binds @NotNSClient diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ReceiversModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ReceiversModule.kt index d92bc9262a..4c6e67608c 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ReceiversModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ReceiversModule.kt @@ -16,9 +16,9 @@ abstract class ReceiversModule { @ContributesAndroidInjector abstract fun contributesChargingStateReceiver(): ChargingStateReceiver @ContributesAndroidInjector abstract fun contributesDataReceiver(): DataReceiver @ContributesAndroidInjector abstract fun contributesKeepAliveReceiver(): KeepAliveReceiver - @ContributesAndroidInjector abstract fun contributesRileyLinkBluetoothStateReceiver(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkBluetoothStateReceiver + @ContributesAndroidInjector abstract fun contributesRileyLinkBluetoothStateReceiver(): RileyLinkBluetoothStateReceiver @ContributesAndroidInjector abstract fun contributesSmsReceiver(): SmsReceiver @ContributesAndroidInjector abstract fun contributesTimeDateOrTZChangeReceiver(): TimeDateOrTZChangeReceiver @ContributesAndroidInjector abstract fun contributesCarbSuggestionReceiver(): CarbSuggestionReceiver - @ContributesAndroidInjector abstract fun contributesRileyLinkBroadcastReceiver(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkBroadcastReceiver + @ContributesAndroidInjector abstract fun contributesRileyLinkBroadcastReceiver(): RileyLinkBroadcastReceiver } diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt index fbf47a9ed2..f961c3a863 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt @@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.services.NSClientServ import info.nightscout.androidaps.plugins.general.overview.notifications.DismissNotificationService import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService import info.nightscout.androidaps.plugins.general.wear.wearintegration.WatchUpdaterService +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService @@ -27,7 +28,7 @@ abstract class ServicesModule { @ContributesAndroidInjector abstract fun contributesWatchUpdaterService(): WatchUpdaterService @ContributesAndroidInjector abstract fun contributesInsightAlertService(): InsightAlertService @ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService - @ContributesAndroidInjector abstract fun contributesRileyLinkService(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService - @ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService + @ContributesAndroidInjector abstract fun contributesRileyLinkService(): RileyLinkService + @ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService @ContributesAndroidInjector abstract fun contributesRileyLinkOmnipodService(): RileyLinkOmnipodService } \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt index 968b84a5ff..df90e03586 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/DatabaseHelperInterface.kt @@ -1,11 +1,7 @@ package info.nightscout.androidaps.interfaces import com.j256.ormlite.dao.CloseableIterator -import info.nightscout.androidaps.db.BgReading -import info.nightscout.androidaps.db.CareportalEvent -import info.nightscout.androidaps.db.DanaRHistoryRecord -import info.nightscout.androidaps.db.DbRequest -import info.nightscout.androidaps.db.TDD +import info.nightscout.androidaps.db.* interface DatabaseHelperInterface { diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtil.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtil.java index 96063673da..32c1d36488 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtil.java +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/utils/DateTimeUtil.java @@ -21,7 +21,6 @@ public class DateTimeUtil { * @param atechDateTime * @return */ - @Deprecated // use joda instead public static LocalDateTime toLocalDateTime(long atechDateTime) { int year = (int) (atechDateTime / 10000000000L); atechDateTime -= year * 10000000000L; @@ -56,7 +55,6 @@ public class DateTimeUtil { * @param atechDateTime * @return */ - @Deprecated // use joda instead public static GregorianCalendar toGregorianCalendar(long atechDateTime) { int year = (int) (atechDateTime / 10000000000L); atechDateTime -= year * 10000000000L; diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt index 079ab51586..37712451bb 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt @@ -123,7 +123,7 @@ class MedtronicFragment : DaggerFragment() { .toObservable(EventRileyLinkDeviceStatusChange::class.java) .observeOn(AndroidSchedulers.mainThread()) .subscribe({ - aapsLogger.debug(LTag.PUMP, "onStatusEvent(EventMedtronicDeviceStatusChange): $it") + aapsLogger.debug(LTag.PUMP, "onStatusEvent(EventRileyLinkDeviceStatusChange): $it") setDeviceStatus() }, { fabricPrivacy.logException(it) }) disposable += rxBus diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java index 9cd138f4d4..484ddba676 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java @@ -771,7 +771,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter if ((clock.localDeviceTime.getYear() <= 2015) || (timeDiff <= 24 * 60 * 60)) { - aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Set time on pump." + timeDiff); + aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Set time on pump." , timeDiff); rileyLinkMedtronicService.getMedtronicUIComm().executeCommand(MedtronicCommandType.SetRealTimeClock); @@ -781,13 +781,13 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter } } else { if ((clock.localDeviceTime.getYear() > 2015)) { - aapsLogger.error("MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference over 24h requested [diff={}]. Doing nothing." + timeDiff); + aapsLogger.error("MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference over 24h requested [diff={} s]. Doing nothing.", timeDiff); medtronicUtil.sendNotification(MedtronicNotificationType.TimeChangeOver24h, getResourceHelper(), rxBus); } } } else { - aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Do nothing." + timeDiff); + aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Do nothing.", timeDiff); } scheduleNextRefresh(MedtronicStatusRefreshType.PumpTime, 0); @@ -1133,11 +1133,14 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter private void readPumpHistoryLogic() { + boolean debugHistory = false; + LocalDateTime targetDate = null; if (lastPumpHistoryEntry == null) { - aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: null"); + if (debugHistory) + aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: null"); Long lastPumpHistoryEntryTime = getLastPumpEntryTime(); @@ -1146,13 +1149,15 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter medtronicHistoryData.setIsInInit(true); if (lastPumpHistoryEntryTime == 0L) { - aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: 0L - targetDate: " - + targetDate); + if (debugHistory) + aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: 0L - targetDate: " + + targetDate); targetDate = timeMinus36h; } else { // LocalDateTime lastHistoryRecordTime = DateTimeUtil.toLocalDateTime(lastPumpHistoryEntryTime); - aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: " + lastPumpHistoryEntryTime + " - targetDate: " + targetDate); + if (debugHistory) + aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntryTime: " + lastPumpHistoryEntryTime + " - targetDate: " + targetDate); medtronicHistoryData.setLastHistoryRecordTime(lastPumpHistoryEntryTime); @@ -1168,30 +1173,35 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter targetDate = (timeMinus36h.isAfter(lastHistoryRecordTime) ? timeMinus36h : lastHistoryRecordTime); - aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): targetDate: " + targetDate); + if (debugHistory) + aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): targetDate: " + targetDate); } } else { - aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: not null - " + medtronicUtil.gsonInstance.toJson(lastPumpHistoryEntry)); + if (debugHistory) + aapsLogger.debug(LTag.PUMP, getLogPrefix() + "readPumpHistoryLogic(): lastPumpHistoryEntry: not null - " + medtronicUtil.gsonInstance.toJson(lastPumpHistoryEntry)); medtronicHistoryData.setIsInInit(false); // medtronicHistoryData.setLastHistoryRecordTime(lastPumpHistoryEntry.atechDateTime); // targetDate = lastPumpHistoryEntry.atechDateTime; } - aapsLogger.debug(LTag.PUMP, "HST: Target Date: " + targetDate); + //aapsLogger.debug(LTag.PUMP, "HST: Target Date: " + targetDate); MedtronicUITask responseTask2 = rileyLinkMedtronicService.getMedtronicUIComm().executeCommand(MedtronicCommandType.GetHistoryData, lastPumpHistoryEntry, targetDate); - aapsLogger.debug(LTag.PUMP, "HST: After task"); + if (debugHistory) + aapsLogger.debug(LTag.PUMP, "HST: After task"); PumpHistoryResult historyResult = (PumpHistoryResult) responseTask2.returnData; - aapsLogger.debug(LTag.PUMP, "HST: History Result: " + historyResult.toString()); + if (debugHistory) + aapsLogger.debug(LTag.PUMP, "HST: History Result: " + historyResult.toString()); PumpHistoryEntry latestEntry = historyResult.getLatestEntry(); - aapsLogger.debug(LTag.PUMP, getLogPrefix() + "Last entry: " + latestEntry); + if (debugHistory) + aapsLogger.debug(LTag.PUMP, getLogPrefix() + "Last entry: " + latestEntry); if (latestEntry == null) // no new history to read return; @@ -1199,7 +1209,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter this.lastPumpHistoryEntry = latestEntry; sp.putLong(MedtronicConst.Statistics.LastPumpHistoryEntry, latestEntry.atechDateTime); - aapsLogger.debug(LTag.PUMP, "HST: History: valid=" + historyResult.validEntries.size() + ", unprocessed=" + historyResult.unprocessedEntries.size()); + if (debugHistory) + aapsLogger.debug(LTag.PUMP, "HST: History: valid=" + historyResult.validEntries.size() + ", unprocessed=" + historyResult.unprocessedEntries.size()); this.medtronicHistoryData.addNewHistory(historyResult); this.medtronicHistoryData.filterNewEntries(); @@ -1221,11 +1232,9 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter // update to last entry // - save // - determine pump status - - // - } + private Long getLastPumpEntryTime() { Long lastPumpEntryTime = sp.getLong(MedtronicConst.Statistics.LastPumpHistoryEntry, 0L); diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoder.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoder.java index 450425b26c..a4335583a2 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoder.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/MedtronicHistoryDecoder.java @@ -118,7 +118,7 @@ public abstract class MedtronicHistoryDecoder i StringUtil.appendToStringBuilder(sb, "" + unknownEntry.getKey(), ", "); } - aapsLogger.error(LTag.PUMPCOMM, "STATISTICS OF PUMP DECODE"); + aapsLogger.info(LTag.PUMPCOMM, "STATISTICS OF PUMP DECODE"); if (unknownOpCodes.size() > 0) { aapsLogger.warn(LTag.PUMPCOMM, "Unknown Op Codes: {}", sb.toString()); @@ -137,9 +137,9 @@ public abstract class MedtronicHistoryDecoder i String spaces = StringUtils.repeat(" ", 14 - entry.getKey().name().length()); - aapsLogger.error(LTag.PUMPCOMM, " {}{} - {}. Elements: {}", entry.getKey().name(), spaces, entry.getValue().size(), sb.toString()); + aapsLogger.info(LTag.PUMPCOMM, " {}{} - {}. Elements: {}", entry.getKey().name(), spaces, entry.getValue().size(), sb.toString()); } else { - aapsLogger.error(LTag.PUMPCOMM, " {} - {}", entry.getKey().name(), entry.getValue().size()); + aapsLogger.info(LTag.PUMPCOMM, " {} - {}", entry.getKey().name(), entry.getValue().size()); } } } diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIComm.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIComm.java index f0731d2d8a..11fb6f849f 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIComm.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIComm.java @@ -34,7 +34,7 @@ public class MedtronicUIComm { public synchronized MedtronicUITask executeCommand(MedtronicCommandType commandType, Object... parameters) { - aapsLogger.warn(LTag.PUMP, "Execute Command: " + commandType.name()); + aapsLogger.info(LTag.PUMP, "Execute Command: " + commandType.name()); MedtronicUITask task = new MedtronicUITask(injector, commandType, parameters); diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIPostprocessor.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIPostprocessor.java index 364337d019..6d71633bea 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIPostprocessor.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/ui/MedtronicUIPostprocessor.java @@ -161,7 +161,8 @@ public class MedtronicUIPostprocessor { // no postprocessing default: - aapsLogger.error(LTag.PUMP, "Post-processing not implemented for {}.", uiTask.commandType.name()); + break; + //aapsLogger.error(LTag.PUMP, "Post-processing not implemented for {}.", uiTask.commandType.name()); } diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java index 902686ff19..11bd57d017 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java @@ -205,36 +205,35 @@ public class DailyTotalsDTO { //LOG.debug("523: {}", toString()); } - @Override public String toString() { - return "DailyTotalsDTO [" + - "bgAvg=" + bgAvg + - ", bgLow=" + bgLow + - ", bgHigh=" + bgHigh + - ", bgCount=" + bgCount + - ", sensorAvg=" + sensorAvg + - ", sensorMin=" + sensorMin + - ", sensorMax=" + sensorMax + - ", sensorCalcCount=" + sensorCalcCount + - ", sensorDataCount=" + sensorDataCount + - ", insulinTotal=" + insulinTotal + - ", insulinBasal=" + insulinBasal + - ", insulinBolus=" + insulinBolus + - ", insulinCarbs=" + insulinCarbs + - ", bolusTotal=" + bolusTotal + - ", bolusFood=" + bolusFood + - ", bolusFoodAndCorr=" + bolusFoodAndCorr + - ", bolusCorrection=" + bolusCorrection + - ", bolusManual=" + bolusManual + - ", bolusCount=" + bolusCount + - ", bolusCountFoodOrCorr=" + bolusCountFoodOrCorr + - ", bolusCountFoodAndCorr=" + bolusCountFoodAndCorr + - ", bolusCountManual=" + bolusCountManual + - ", bolusCountFood=" + bolusCountFood + - ", bolusCountCorr=" + bolusCountCorr + - ", entry=" + entry + - ']'; + return new ToStringBuilder(this) + .append("bgAvg", bgAvg) + .append("bgLow", bgLow) + .append("bgHigh", bgHigh) + .append("bgCount", bgCount) + .append("sensorAvg", sensorAvg) + .append("sensorMin", sensorMin) + .append("sensorMax", sensorMax) + .append("sensorCalcCount", sensorCalcCount) + .append("sensorDataCount", sensorDataCount) + .append("insulinTotal", insulinTotal) + .append("insulinBasal", insulinBasal) + .append("insulinBolus", insulinBolus) + .append("insulinCarbs", insulinCarbs) + .append("bolusTotal", bolusTotal) + .append("bolusFood", bolusFood) + .append("bolusFoodAndCorr", bolusFoodAndCorr) + .append("bolusCorrection", bolusCorrection) + .append("bolusManual", bolusManual) + .append("bolusCount", bolusCount) + .append("bolusCountFoodOrCorr", bolusCountFoodOrCorr) + .append("bolusCountFoodAndCorr", bolusCountFoodAndCorr) + .append("bolusCountManual", bolusCountManual) + .append("bolusCountFood", bolusCountFood) + .append("bolusCountCorr", bolusCountCorr) + .append("entry", entry) + .toString(); } public void setTDD(TDD tdd) {