golioth / golioth-zephyr-sdk

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

rpc, settings: remove automatic observations #337

Closed ncmiller closed 1 year ago

ncmiller commented 1 year ago

Currently, when golioth_rpc_register() is called, an observation is automatically established (if it’s the first RPC method being registered).

Similarly, when golioth_settings_register_callback() is called, an observation is automatically established.

However, this “automatic observe” behavior has three main issues:

  1. It might be unwanted in some user applications (e.g. low-power/low-data) that don’t want the overhead of observations

  2. It’s inconsistent with the way observations work for DFU. For DFU, it’s expected that the user calls golioth_fw_observe_desired() in the on_connect callback (i.e. observations are not automatically established).

  3. It can be unexpected/surprising that an API named “register callback” would also create an observation.

We should separate RPC and Settings registration from observation, and make the observation an explicit API call.

This is a breaking change, since user applications will need to be modified to call the new functions in the on_connect callback.

github-actions[bot] commented 1 year ago

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

https://golioth-zephyr-sdk-doxygen-dev--pr337-nick-no-auto-obs-fpvq7n9i.web.app

(expires Tue, 14 Feb 2023 18:28:20 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: a389eefadf4b4b68a539327b3459dd66c142cf49