setNumberOfRetries

Sets the number of retries that the DFU service will use to complete DFU. The default value is 0, for backwards compatibility reason.

If the given value is greater than 0, the service will restart itself at most max times in case of an undesired disconnection during DFU operation. This attempt counter is independent from another counter, for reconnection attempts, which is equal to 3. The latter one will be used when connection will fail with an error (possible packet collision or any other reason). After successful connection, the reconnection counter is reset, while the retry counter is cleared after a DFU finishes with success.

The service will not try to retry DFU in case of any other error, for instance an error sent from the target device.

Return

the builder

Parameters

max

Maximum number of retires to complete DFU. Usually around 2.