Closed ncmiller closed 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
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:
It might be unwanted in some user applications (e.g. low-power/low-data) that don’t want the overhead of observations
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).
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.