golioth / golioth-zephyr-sdk

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

golioth: add golioth_req_rsp_default_handler() default response handler #308

Closed mniestroj closed 1 year ago

mniestroj commented 1 year ago

Replace static default_req_cb() with a golioth_req_rsp_default_handler() that produces error/debug messages on received response. Especially error messages are useful in case of CoAP ACK timeout or non-2 (non-success) CoAP response code class.

Add additional "hidden" (not documented to SDK consumers) functionality about logging additional module/component information string, so that it is easier to locate source component from specific log comes from. As an example for settings.c this is what will appear in Zephyr console:

  <dbg> golioth: Settings response ACK
                 73 65 74 74 69 6e 67 73  20 73 79 6e 63 65 64  |settings  synced

as a result of successful acknowledgment, when debug logs are enabled.

Make this function private to SDK internal implementation, so that above experimental "component infrmation" logging won't be used by SDK consumers.

github-actions[bot] commented 1 year ago

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

https://golioth-zephyr-sdk-doxygen-dev--pr308-coap-req-null-cb-p4qnlqpu.web.app

(expires Tue, 25 Oct 2022 19:02:03 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: a389eefadf4b4b68a539327b3459dd66c142cf49