#89 fixed
This commit is contained in:
parent
1f5b13e89c
commit
8b3b09f536
|
@ -66,6 +66,10 @@ import no.nordicsemi.android.dfu.internal.exception.UploadAbortedException;
|
||||||
mService.terminateConnection(mGatt, DfuBaseService.ERROR_DEVICE_NOT_BONDED);
|
mService.terminateConnection(mGatt, DfuBaseService.ERROR_DEVICE_NOT_BONDED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// In Secure DFU with Bond Sharing the bond information should not be removed
|
||||||
|
intent.putExtra(DfuBaseService.EXTRA_KEEP_BOND, true);
|
||||||
|
intent.putExtra(DfuBaseService.EXTRA_RESTORE_BOND, false);
|
||||||
|
|
||||||
super.performDfu(intent);
|
super.performDfu(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,10 @@ import no.nordicsemi.android.dfu.internal.exception.UploadAbortedException;
|
||||||
@Override
|
@Override
|
||||||
public void performDfu(final Intent intent) throws DfuException, DeviceDisconnectedException, UploadAbortedException {
|
public void performDfu(final Intent intent) throws DfuException, DeviceDisconnectedException, UploadAbortedException {
|
||||||
logi("Buttonless service without bond sharing found -> SDK 13 or newer");
|
logi("Buttonless service without bond sharing found -> SDK 13 or newer");
|
||||||
|
if (isBonded()) {
|
||||||
|
logw("Device is paired! Use Buttonless DFU with Bond Sharing instead (SDK 14 or newer)");
|
||||||
|
}
|
||||||
|
|
||||||
super.performDfu(intent);
|
super.performDfu(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,6 +132,7 @@ public abstract class DfuBaseService extends IntentService implements DfuProgres
|
||||||
* <p>
|
* <p>
|
||||||
* Search for occurrences of EXTRA_RESTORE_BOND in this file to check the implementation and get more details.
|
* Search for occurrences of EXTRA_RESTORE_BOND in this file to check the implementation and get more details.
|
||||||
* </p>
|
* </p>
|
||||||
|
* <p>This flag is ignored when Secure DFU Buttonless Service is used. It will keep or will not restore the bond depending on the Buttonless service type.</p>
|
||||||
*/
|
*/
|
||||||
public static final String EXTRA_RESTORE_BOND = "no.nordicsemi.android.dfu.extra.EXTRA_RESTORE_BOND";
|
public static final String EXTRA_RESTORE_BOND = "no.nordicsemi.android.dfu.extra.EXTRA_RESTORE_BOND";
|
||||||
/**
|
/**
|
||||||
|
@ -146,7 +147,9 @@ public abstract class DfuBaseService extends IntentService implements DfuProgres
|
||||||
* service will remove the bond information from the phone and force to refresh the device cache (see {@link #refreshDeviceCache(android.bluetooth.BluetoothGatt, boolean)}).</p>
|
* service will remove the bond information from the phone and force to refresh the device cache (see {@link #refreshDeviceCache(android.bluetooth.BluetoothGatt, boolean)}).</p>
|
||||||
*
|
*
|
||||||
* <p>In contrast to {@link #EXTRA_RESTORE_BOND} this flag will not remove the old bonding and recreate a new one, but will keep the bond information untouched.</p>
|
* <p>In contrast to {@link #EXTRA_RESTORE_BOND} this flag will not remove the old bonding and recreate a new one, but will keep the bond information untouched.</p>
|
||||||
* <p>The default value of this flag is <code>false</code></p>
|
* <p>The default value of this flag is <code>false</code>.</p>
|
||||||
|
*
|
||||||
|
* <p>This flag is ignored when Secure DFU Buttonless Service is used. It will keep or remove the bond depending on the Buttonless service type.</p>
|
||||||
*/
|
*/
|
||||||
public static final String EXTRA_KEEP_BOND = "no.nordicsemi.android.dfu.extra.EXTRA_KEEP_BOND";
|
public static final String EXTRA_KEEP_BOND = "no.nordicsemi.android.dfu.extra.EXTRA_KEEP_BOND";
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -126,8 +126,13 @@ public class DfuServiceInitiator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the bond information should be preserver after flashing new application. This feature requires DFU Bootloader version 0.6 or newer (SDK 8.0.0+).
|
* Sets whether the bond information should be preserver after flashing new application.
|
||||||
* Please see the {@link DfuBaseService#EXTRA_KEEP_BOND} for more information regarding requirements. Remember that currently updating the Soft Device will remove the bond information.
|
* This feature requires DFU Bootloader version 0.6 or newer (SDK 8.0.0+).
|
||||||
|
* Please see the {@link DfuBaseService#EXTRA_KEEP_BOND} for more information regarding requirements.
|
||||||
|
* Remember that currently updating the Soft Device will remove the bond information.
|
||||||
|
*
|
||||||
|
* <p>This flag is ignored when Secure DFU Buttonless Service is used. It will keep or remove the
|
||||||
|
* bond depending on the Buttonless service type.</p>
|
||||||
* @param keepBond whether the bond information should be preserved in the new application.
|
* @param keepBond whether the bond information should be preserved in the new application.
|
||||||
* @return the builder
|
* @return the builder
|
||||||
*/
|
*/
|
||||||
|
@ -139,6 +144,9 @@ public class DfuServiceInitiator {
|
||||||
/**
|
/**
|
||||||
* Sets whether the bond should be created after the DFU is complete.
|
* 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.
|
* Please see the {@link DfuBaseService#EXTRA_RESTORE_BOND} for more information regarding requirements.
|
||||||
|
*
|
||||||
|
* <p>This flag is ignored when Secure DFU Buttonless Service is used. It will keep or will not
|
||||||
|
* restore the bond depending on the Buttonless service type.</p>
|
||||||
* @param restoreBond whether the bond should be created after the DFU is complete.
|
* @param restoreBond whether the bond should be created after the DFU is complete.
|
||||||
* @return the builder
|
* @return the builder
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue