diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt index 08b79f9d79..629fff1723 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt @@ -10,7 +10,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.* import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager import info.nightscout.androidaps.utils.rx.AapsSchedulers -import info.nightscout.androidaps.utils.rx.retryWithBackoff import io.reactivex.Observable import io.reactivex.functions.Action import io.reactivex.functions.Consumer @@ -38,9 +37,9 @@ class OmnipodDashManagerImpl @Inject constructor( private val observePodReadyForActivationPart2: Observable get() = Observable.defer { - if (podStateManager.activationProgress.isAtLeast(ActivationProgress.PHASE_1_COMPLETED) && podStateManager.activationProgress.isBefore( - ActivationProgress.COMPLETED - )) { + if (podStateManager.activationProgress.isAtLeast(ActivationProgress.PHASE_1_COMPLETED) && + podStateManager.activationProgress.isBefore(ActivationProgress.COMPLETED) + ) { Observable.empty() } else { Observable.error(IllegalStateException("Pod is in an incorrect state")) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchange.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchange.kt index 682098e295..0328be4a5d 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchange.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchange.kt @@ -10,13 +10,12 @@ import info.nightscout.androidaps.utils.extensions.toHex import org.spongycastle.crypto.engines.AESEngine import org.spongycastle.crypto.macs.CMac import org.spongycastle.crypto.params.KeyParameter -import org.spongycastle.util.encoders.Hex class KeyExchange( private val aapsLogger: AAPSLogger, private val x25519: X25519KeyGenerator, - private val randomByteGenerator: RandomByteGenerator -){ + randomByteGenerator: RandomByteGenerator +) { val pdmNonce: ByteArray = randomByteGenerator.nextBytes(NONCE_SIZE) val pdmPrivate: ByteArray = x25519.generatePrivateKey() @@ -24,7 +23,7 @@ class KeyExchange( var podPublic = ByteArray(PUBLIC_KEY_SIZE) private set - var podNonce : ByteArray = ByteArray(NONCE_SIZE) + var podNonce: ByteArray = ByteArray(NONCE_SIZE) val podConf = ByteArray(CMAC_SIZE) val pdmConf = ByteArray(CMAC_SIZE) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/RandomByteGenerator.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/RandomByteGenerator.kt index 4bfb6c1fd4..ca6beb17dd 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/RandomByteGenerator.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/RandomByteGenerator.kt @@ -8,4 +8,4 @@ class RandomByteGenerator { private val secureRandom = SecureRandom() fun nextBytes(length: Int): ByteArray = ByteArray(length).also(secureRandom::nextBytes) -} \ No newline at end of file +} diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/X25519KeyGenerator.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/X25519KeyGenerator.kt index dac3553ab8..160f620df6 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/X25519KeyGenerator.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/util/X25519KeyGenerator.kt @@ -10,4 +10,4 @@ class X25519KeyGenerator { fun publicFromPrivate(privateKey: ByteArray): ByteArray = X25519.publicFromPrivate(privateKey) fun computeSharedSecret(privateKey: ByteArray, publicKey: ByteArray): ByteArray = X25519.computeSharedSecret(privateKey, publicKey) -} \ No newline at end of file +} diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index 749f0d0de5..3edf8f364a 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -464,16 +464,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() { private fun updateRefreshStatusButton() { buttonBinding.buttonRefreshStatus.isEnabled = - podStateManager.isUniqueIdSet && podStateManager.activationProgress.isAtLeast( - ActivationProgress.PHASE_1_COMPLETED - ) && - isQueueEmpty() + podStateManager.isUniqueIdSet && + podStateManager.activationProgress.isAtLeast(ActivationProgress.PHASE_1_COMPLETED) && + isQueueEmpty() } private fun updateResumeDeliveryButton() { - if (podStateManager.isPodRunning && (podStateManager.isSuspended || commandQueue.isCustomCommandInQueue( - CommandResumeDelivery::class.java - ))) { + if (podStateManager.isPodRunning && + (podStateManager.isSuspended || commandQueue.isCustomCommandInQueue(CommandResumeDelivery::class.java)) + ) { buttonBinding.buttonResumeDelivery.visibility = View.VISIBLE buttonBinding.buttonResumeDelivery.isEnabled = isQueueEmpty() } else { @@ -482,9 +481,12 @@ class OmnipodDashOverviewFragment : DaggerFragment() { } private fun updateSilenceAlertsButton() { - if (isAutomaticallySilenceAlertsEnabled() && podStateManager.isPodRunning && (podStateManager.activeAlerts!!.size > 0 || commandQueue.isCustomCommandInQueue( - CommandAcknowledgeAlerts::class.java - ))) { + if (isAutomaticallySilenceAlertsEnabled() && podStateManager.isPodRunning && + ( + podStateManager.activeAlerts!!.size > 0 || + commandQueue.isCustomCommandInQueue(CommandAcknowledgeAlerts::class.java) + ) + ) { buttonBinding.buttonSilenceAlerts.visibility = View.VISIBLE buttonBinding.buttonSilenceAlerts.isEnabled = isQueueEmpty() } else { @@ -494,9 +496,10 @@ class OmnipodDashOverviewFragment : DaggerFragment() { private fun updateSuspendDeliveryButton() { // If the Pod is currently suspended, we show the Resume delivery button instead. - if (isSuspendDeliveryButtonEnabled() && podStateManager.isPodRunning && (!podStateManager.isSuspended || commandQueue.isCustomCommandInQueue( - CommandSuspendDelivery::class.java - ))) { + if (isSuspendDeliveryButtonEnabled() && + podStateManager.isPodRunning && + (!podStateManager.isSuspended || commandQueue.isCustomCommandInQueue(CommandSuspendDelivery::class.java)) + ) { buttonBinding.buttonSuspendDelivery.visibility = View.VISIBLE buttonBinding.buttonSuspendDelivery.isEnabled = podStateManager.isPodRunning && !podStateManager.isSuspended && isQueueEmpty() diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/wizard/deactivation/viewmodel/action/DashDeactivatePodViewModel.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/wizard/deactivation/viewmodel/action/DashDeactivatePodViewModel.kt index 8a6ec92571..96bfb90e57 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/wizard/deactivation/viewmodel/action/DashDeactivatePodViewModel.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/wizard/deactivation/viewmodel/action/DashDeactivatePodViewModel.kt @@ -17,7 +17,7 @@ class DashDeactivatePodViewModel @Inject constructor( ) : DeactivatePodViewModel(injector, logger) { override fun doExecuteAction(): Single = Single.just( - PumpEnactResult(injector).success(true).comment("TODO") + PumpEnactResult(injector).success(true).comment("TODO") ) // TODO override fun discardPod() { diff --git a/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt b/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt index 0dc0135541..50e04f6e2a 100644 --- a/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt +++ b/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt @@ -27,7 +27,7 @@ class KeyExchangeTest { val pdmNonce = Hex.decode("edfdacb242c7f4e1d2bc4d93ca3c5706") - Mockito.`when`(randomByteGenerator.nextBytes(anyInt())).thenReturn(pdmNonce) + Mockito.`when`(randomByteGenerator.nextBytes(anyInt())).thenReturn(pdmNonce) val ke = KeyExchange( aapsLogger, @@ -42,4 +42,4 @@ class KeyExchangeTest { ke.validatePodConf(Hex.decode("af4f10db5f96e5d9cd6cfc1f54f4a92f")) assertEquals(ke.ltk.toHex(), "341e16d13f1cbf73b19d1c2964fee02b") } -} \ No newline at end of file +}