Skip to content

Commit

Permalink
Merge pull request #87 from NordicSemiconductor/improvement/timeouts
Browse files Browse the repository at this point in the history
BLE operation timeouts increased
  • Loading branch information
philips77 authored Dec 1, 2022
2 parents cdcb71d + e866930 commit cfbebcc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions mcumgr-core/src/main/java/io/runtime/mcumgr/McuManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public abstract class McuManager {
/** Maximum length of a single SMP packet. */
private final static int DEFAULT_MTU = 0xFFFF + 8; // Header size + max packet size.

protected final static long DEFAULT_TIMEOUT = 30_000; // ms
protected final static long SHORT_TIMEOUT = 1_000; // ms
protected final static long MEDIUM_TIMEOUT = 2_500; // ms
protected final static long DEFAULT_TIMEOUT = 40_000; // ms
protected final static long SHORT_TIMEOUT = 2_500; // ms
protected final static long MEDIUM_TIMEOUT = 5_000; // ms

// Date format
private final static String MCUMGR_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSZZZZZ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ abstract class Uploader(
if (currentOffset > chunk.offset) {
log.warn("A notification for chunk with offset=${chunk.offset} was lost, but the chunk was ack-ed by later chunk (confirmed offset=$currentOffset)")
return@onErrorOrFailure
} else {
log.warn("A notification for chunk with offset=${chunk.offset} was lost, current offset: $currentOffset")
}
}

Expand Down Expand Up @@ -274,7 +276,7 @@ abstract class Uploader(
): Chunk {
val resultChannel: Channel<UploadResult> = Channel(1)
// Timeout for the initial chunk is long, as the device may need to erase the flash.
val timeout = if (chunk.offset == 0) 30_000L else 1_000L
val timeout = if (chunk.offset == 0) 40_000L else 2_500L
write(prepareWrite(chunk.data, chunk.offset), timeout) { result ->
resultChannel.trySend(result)
}
Expand Down

0 comments on commit cfbebcc

Please sign in to comment.