Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: Allow CoAP related setting from CMake #789

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ Several preprocessor definitions are supported:
- LWM2M_SUPPORT_SENML_JSON to enable SenML JSON payload support (implicit for LWM2M 1.1 or greater when defining LWM2M_SERVER_MODE or LWM2M_BOOTSTRAP_SERVER_MODE)
- LWM2M_SUPPORT_SENML_CBOR to enable SenML CBOR payload support (implicit for LWM2M 1.1 or greater when defining LWM2M_SERVER_MODE or LWM2M_BOOTSTRAP_SERVER_MODE)
- LWM2M_OLD_CONTENT_FORMAT_SUPPORT to support the deprecated content format values for TLV and JSON.
- LWM2M_RAW_BLOCK1_REQUESTS For low memory client devices where it is not possible to keep a large post or put request in memory to be parsed (typically a firmware write).
This option enable each unprocessed block 1 payload to be passed to the application, typically to be stored to a flash memory.
- LWM2M_COAP_DEFAULT_BLOCK_SIZE CoAP block size used by CoAP layer when performing block-wise transfers. Possible values: 16, 32, 64, 128, 256, 512 and 1024. Defaults to 1024.

### Mode

Expand All @@ -76,6 +73,13 @@ Wakaama supports additional client related options. These are only available if

Please note: LwM2M version 1.0 is only supported by clients, while servers are backward compatible.

### CoAP Settings

- WAKAAMA_COAP_RAW_BLOCK1_REQUESTS For low memory client devices where it is not possible to keep a large post or put request in memory to be parsed (typically a firmware write).
This option enable each unprocessed block 1 payload to be passed to the application, typically to be stored to a flash memory.
- WAKAAMA_COAP_DEFAULT_BLOCK_SIZE CoAP block size used by CoAP layer when performing block-wise transfers. Possible values: 16, 32, 64, 128, 256, 512 and 1024. Defaults to 1024.


### Logging

The logging infrastructure can be configured with CMake cache variables (e.g. `cmake -DWAKAAMA_LOG_LEVEL=INFO`).
Expand Down
30 changes: 30 additions & 0 deletions wakaama.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ option(WAKAAMA_MODE_CLIENT "Enable LWM2M Client interfaces" OFF)
option(WAKAAMA_CLIENT_INITIATED_BOOTSTRAP "Enable client initiated bootstrap support in a client" OFF)
option(WAKAAMA_CLIENT_LWM2M_V_1_0 "Restrict the client code to use LwM2M version 1.0" OFF)

# CoAP
option(WAKAAMA_COAP_RAW_BLOCK1_REQUESTS "Pass each unprocessed block 1 payload to the application" OFF)

set(WAKAAMA_COAP_DEFAULT_BLOCK_SIZE
1024
CACHE STRING "Default CoAP block size for block-wise transfers"
)
set_property(
CACHE WAKAAMA_COAP_DEFAULT_BLOCK_SIZE
PROPERTY STRINGS
LOG_DISABLED
16
32
64
128
256
512
1024
)

# Logging
set(WAKAAMA_LOG_LEVEL
LOG_DISABLED
Expand Down Expand Up @@ -62,6 +82,15 @@ function(set_client_defines target)
endif()
endfunction()

# Set the defines related to CoAP
function(set_coap_defines)
if(WAKAAMA_COAP_RAW_BLOCK1_REQUESTS)
target_compile_definitions(${target} PUBLIC LWM2M_RAW_BLOCK1_REQUESTS)
endif()

target_compile_definitions(${target} PUBLIC LWM2M_COAP_DEFAULT_BLOCK_SIZE=${WAKAAMA_COAP_DEFAULT_BLOCK_SIZE})
endfunction()

# Set the defines for logging configuration
function(set_logging_defines target)
# Logging
Expand All @@ -78,6 +107,7 @@ endfunction()
function(set_defines target)
set_mode_defines(${target})
set_client_defines(${target})
set_coap_defines(${target})
set_logging_defines(${target})
endfunction()

Expand Down
Loading