From 9eb827d570f1d6202db61935bb27a0d1dbc80fd6 Mon Sep 17 00:00:00 2001 From: Justin Morton Date: Mon, 16 Oct 2023 15:41:37 -0700 Subject: [PATCH] net: lib: nrf_cloud: fix encoding of "doReply" flag The "doReply" flag should be placed inside the "data" object, not at the root level. IRIS-7363 Signed-off-by: Justin Morton --- .../releases/release-notes-changelog.rst | 1 + subsys/net/lib/nrf_cloud/src/nrf_cloud_codec.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst b/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst index 0f327bdcbf7f..706acfe5fdeb 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst @@ -889,6 +889,7 @@ Libraries for networking * A bug preventing ``AIR_QUAL`` from being enabled in shadow UI service info. * A bug that prevented an MQTT FOTA job from being started. * An invalid value for a shadow delta change to the control section is now rejected by updating the desired section to the previous value. + * Encoding of the "doReply" flag in the :c:func:`nrf_cloud_obj_location_request_create` function. * Removed: diff --git a/subsys/net/lib/nrf_cloud/src/nrf_cloud_codec.c b/subsys/net/lib/nrf_cloud/src/nrf_cloud_codec.c index 9223a5977a2d..5ad1f9632530 100644 --- a/subsys/net/lib/nrf_cloud/src/nrf_cloud_codec.c +++ b/subsys/net/lib/nrf_cloud/src/nrf_cloud_codec.c @@ -923,15 +923,15 @@ int nrf_cloud_obj_location_request_create(struct nrf_cloud_obj *const obj, goto cleanup; } - /* By default, nRF Cloud will send the location to the device */ - if (!request_loc && - nrf_cloud_obj_num_add(obj, NRF_CLOUD_LOCATION_KEY_DOREPLY, 0, true)) { - err = -ENOMEM; + err = nrf_cloud_obj_init(&data_obj); + if (err) { goto cleanup; } - err = nrf_cloud_obj_init(&data_obj); - if (err) { + /* By default, nRF Cloud will send the location to the device */ + if (!request_loc && + nrf_cloud_obj_num_add(&data_obj, NRF_CLOUD_LOCATION_KEY_DOREPLY, 0, false)) { + err = -ENOMEM; goto cleanup; }