Skip to content

Commit fbc37cb

Browse files
mlaschLukasWoodtli
authored andcommitted
cmake: Make max retransmit configurable at build time
Make CoAP max retransmit setting configurable at build time.
1 parent 9ae3189 commit fbc37cb

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

coap/er-coap-13/er-coap-13.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
#define COAP_DEFAULT_MAX_AGE 60
5050
#define COAP_RESPONSE_TIMEOUT 2
51-
#define COAP_MAX_RETRANSMIT 4
51+
#define COAP_MAX_RETRANSMIT LWM2M_COAP_DEFAULT_MAX_RETRANSMIT
5252
#define COAP_ACK_RANDOM_FACTOR 1.5
5353
#define COAP_MAX_LATENCY 100
5454
#define COAP_PROCESSING_DELAY COAP_RESPONSE_TIMEOUT

wakaama.cmake

+17
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,17 @@ function(target_sources_wakaama target)
239239
message(STATUS "${target}: Default CoAP block size not set, using ${LWM2M_COAP_DEFAULT_BLOCK_SIZE}")
240240
endif()
241241

242+
# LWM2M_COAP_DEFAULT_MAX_RETRANSMIT is needed by source files -> always set it
243+
if(NOT CURRENT_TARGET_COMPILE_DEFINITIONS MATCHES "LWM2M_COAP_DEFAULT_MAX_RETRANSMIT=")
244+
target_compile_definitions(
245+
${target} PRIVATE "LWM2M_COAP_DEFAULT_MAX_RETRANSMIT=${LWM2M_COAP_DEFAULT_MAX_RETRANSMIT}"
246+
)
247+
message(
248+
STATUS
249+
"${target}: Default CoAP max retransmission count not set, using ${LWM2M_COAP_DEFAULT_MAX_RETRANSMIT}"
250+
)
251+
endif()
252+
242253
# Detect invalid configuration already during CMake run
243254
if(NOT CURRENT_TARGET_COMPILE_DEFINITIONS MATCHES "LWM2M_SERVER_MODE|LWM2M_BOOTSTRAP_SERVER_MODE|LWM2M_CLIENT_MODE")
244255
message(FATAL_ERROR "${target}: At least one mode (client, server, bootstrap server) must be enabled!")
@@ -339,3 +350,9 @@ set(LWM2M_COAP_DEFAULT_BLOCK_SIZE
339350
1024
340351
CACHE STRING "Default CoAP block size; Used if not set on a per-target basis"
341352
)
353+
354+
# The maximum number of retransmissions used for confirmable messages.
355+
set(LWM2M_COAP_DEFAULT_MAX_RETRANSMIT
356+
4
357+
CACHE STRING "Default CoAP max retransmissions; Used if not set on a per-target basis"
358+
)

0 commit comments

Comments
 (0)