golioth / golioth-zephyr-sdk

Golioth SDK For Zephyr
https://www.golioth.io
Apache License 2.0
66 stars 19 forks source link

Kconfig: add GOLIOTH_SETTINGS_MAX_RESPONSE_LEN #330

Closed ncmiller closed 1 year ago

ncmiller commented 1 year ago

Before this change, the max length of the settings response was fixed at 256 (#define'd in the source code of settings.c). This was problematic for devices with many settings, because if there are multiple errors encountered while handling the settings, the response length becomes too large to fit in the response buffer, resulting in a QCBOR error:

QCBOREncode_FinishGetSize error: 1 (QCBOR_ERR_BUFFER_TOO_SMALL)

To accomodate users with lots of settings, make the response length configurable via Kconfig.

The recommendation of 50 * N for the max length is given because each error encountered results in a CBOR entry like:

{ "setting_key": string, "error_code": int }

The "setting_key" and "error_code" strings alone account for 21 bytes, then if you add in the name of the setting (string) and 1-byte error code, it can easily be 40-50 bytes for each error.

Signed-off-by: Nick Miller nick@golioth.io

github-actions[bot] commented 1 year ago

Visit the preview URL for this PR (updated for commit f197ac1):

https://golioth-zephyr-sdk-doxygen-dev--pr330-nick-settings-re-b7jjwbuz.web.app

(expires Mon, 19 Dec 2022 23:04:10 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: a389eefadf4b4b68a539327b3459dd66c142cf49