From c2e0e5fec918712b876f7a17d0bf207cd39c48ea Mon Sep 17 00:00:00 2001 From: Aleksander Nowakowski Date: Wed, 28 Jun 2017 17:33:37 +0200 Subject: [PATCH] Issue #56 fixed --- .../nordicsemi/android/dfu/DfuServiceInitiator.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java b/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java index 7a13adc..c431df8 100644 --- a/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java +++ b/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java @@ -57,6 +57,7 @@ public class DfuServiceInitiator { private int fileType = -1; private boolean keepBond; + private boolean restoreBond; private boolean forceDfu = false; private boolean enableUnsafeExperimentalButtonlessDfu = false; @@ -111,6 +112,17 @@ public class DfuServiceInitiator { return this; } + /** + * Sets whether the bond should be created after the DFU is complete. + * Please see the {@link DfuBaseService#EXTRA_RESTORE_BOND} for more information regarding requirements. + * @param restoreBond whether the bond should be created after the DFU is complete. + * @return the builder + */ + public DfuServiceInitiator setRestoreBond(final boolean restoreBond) { + this.restoreBond = restoreBond; + return this; + } + /** * Enables or disables the Packet Receipt Notification (PRN) procedure. *

By default the PRNs are disabled on devices with Android Marshmallow or newer and enabled on older ones.

@@ -461,6 +473,7 @@ public class DfuServiceInitiator { intent.putExtra(DfuBaseService.EXTRA_INIT_FILE_PATH, initFilePath); intent.putExtra(DfuBaseService.EXTRA_INIT_FILE_RES_ID, initFileResId); intent.putExtra(DfuBaseService.EXTRA_KEEP_BOND, keepBond); + intent.putExtra(DfuBaseService.EXTRA_RESTORE_BOND, restoreBond); intent.putExtra(DfuBaseService.EXTRA_FORCE_DFU, forceDfu); intent.putExtra(DfuBaseService.EXTRA_UNSAFE_EXPERIMENTAL_BUTTONLESS_DFU, enableUnsafeExperimentalButtonlessDfu); if (packetReceiptNotificationsEnabled != null) {