/** * <p>Reset all context state, excepting Features, to ensure a fresh context</p> */ private void resetAllButFeatures() { Optional<Features> originalFeatures = this.features; resetAll(); this.features = originalFeatures; }
/** * <p>Reset the context back to an attached state (clear device information and transition to connected)</p> */ public void resetToAttached() { log.debug("Reset to 'attached'"); // Clear relevant information resetAll(); // Perform the state change currentState = HardwareWalletStates.newAttachedState(); // No high level event for this state }
/** * <p>Reset the context back to a connected state (clear device information and transition to initialised)</p> */ public void resetToConnected() { log.debug("Reset to 'connected'"); // Clear relevant information resetAll(); // Perform the state change currentState = HardwareWalletStates.newConnectedState(); // No high level event for this state }
/** * <p>Reset the context back to a disconnected state (device is attached but communication has not been established)</p> */ public void resetToDisconnected() { log.debug("Reset to 'disconnected'"); // Clear relevant information resetAll(); // Perform the state change currentState = HardwareWalletStates.newDisconnectedState(); // No high level event for this state }
/** * <p>Reset the context back to a detached state (no device information)</p> */ public void resetToDetached() { log.debug("Reset to 'detached'"); // Clear relevant information resetAll(); // Perform the state change currentState = HardwareWalletStates.newDetachedState(); // Fire the high level event HardwareWalletEvents.fireHardwareWalletEvent(HardwareWalletEventType.SHOW_DEVICE_DETACHED, client.name()); }