Optional parameters for startDfu.

interface StartDfuOptions {
    alternativeAdvertisingName?: string;
    bootloaderScanTimeout?: number;
    connectionTimeout?: number;
    deviceName?: string;
    dfuProgressListener?: ((ev: Readonly<{
        averageSpeed: number;
        part: number;
        partsTotal: number;
        percent: number;
        speed: number;
        targetId: DfuTargetId;
    }>) => void);
    dfuStateListener?: ((ev: Readonly<{
        state: DfuState;
        targetId: DfuTargetId;
    }>) => void);
    disableButtonlessServiceInSecureDfu?: boolean;
    disableResume?: boolean;
    disallowForegroundService?: boolean;
    forceDfu?: boolean;
    forceScanningForNewAddressInLegacyDfu?: boolean;
    keepBond?: boolean;
    prepareDataObjectDelay?: number;
    rebootTime?: number;
    requestedMtu?: number;
    restoreBond?: boolean;
    retries?: number;
}

Properties

alternativeAdvertisingName?: string

Alternative name to use in Bootloader mode. If not specified then a random name is generated.

The maximum length of the alternative advertising name is 20 bytes. Longer name will be truncated. UTF-8 characters can be cut in the middle.

undefined.

iOS only.

bootloaderScanTimeout?: number

Scan duration (in milliseconds) when scanning for DFU Bootloader.

5000 ms.

Android only.

connectionTimeout?: number

When the DFU target does not connect before the time runs out, a timeout error is reported.

10.

iOS only.

deviceName?: string

The device named is used in user notifications.

Android only.

dfuProgressListener?: ((ev: Readonly<{
    averageSpeed: number;
    part: number;
    partsTotal: number;
    percent: number;
    speed: number;
    targetId: DfuTargetId;
}>) => void)

The callback that is repeatedly invoked during the upload, with information about the transfer progress.

dfuStateListener?: ((ev: Readonly<{
    state: DfuState;
    targetId: DfuTargetId;
}>) => void)

The callback that is invoked for each DFU event.

disableButtonlessServiceInSecureDfu?: boolean

When set to true, disable using the experimental buttonless feature in Secure DFU.

false
disableResume?: boolean

Disable the ability for the Secure DFU process to resume from where it was.

false.

iOS only.

disallowForegroundService?: boolean

Whether the DFU service should be started as a foreground service.

false.

Android only.

forceDfu?: boolean

Setting force DFU to true will prevent from jumping to the DFU Bootloader mode in case there is no DFU Version characteristic (Legacy DFU only!). Use it if the DFU operation can be handled by your device running in the application mode.

false
forceScanningForNewAddressInLegacyDfu?: boolean

When set to true, the Legacy Buttonless Service will scan for the device advertising with an incremented MAC address, instead of trying to reconnect to the same device.

false
keepBond?: boolean

Whether the bond information should be preserver after flashing new application. This feature requires Legacy DFU Bootloader version 0.6 or newer (SDK 8.0.0+).

false.

This flag is ignored when Secure DFU button-less Service is used. Android only.

prepareDataObjectDelay?: number

Delay that the service will wait before sending each data object in Secure DFU. The delay will be done after a data object is created, and before any data byte is sent.

0 (meaning 400 ms for the first packet and 0ms for the others).

Android only.

rebootTime?: number

Time required by the device to reboot. The library will wait for this time before scanning for the device in bootloader mode.

0 ms.

Android only.

requestedMtu?: number

Requested MTU size to use during the DFU process. By default 517 will be used, which is the highest supported by Android.

257.

Android only.

restoreBond?: boolean

Whether a new bond should be created after the DFU is complete. The old bond information will be removed before.

false.

This flag is ignored when Secure DFU button-less Service is used. Android only.

retries?: number

Number of retries that the DFU service will use to complete DFU.

2 retries.

Android only.