From ab94cba2003897f6ad4e99d275de4d7402df8fe4 Mon Sep 17 00:00:00 2001 From: Georges Oates_Larsen Date: Mon, 31 Jul 2023 12:02:41 -0700 Subject: [PATCH] net: lib: nrf_cloud: add missing AIR_QUAL handler to shadow encoder Prior to this commit, nrf_cloud_encode_service_info_ui erroneously ignores the air_quality member of nrf_cloud_svc_info_ui. This commit adds the missing handler, so that AIR_QUALITY is correctly enabled when updating shadow. IRIS-6724 Signed-off-by: Georges Oates_Larsen --- .../releases/release-notes-changelog.rst | 6 +++++- include/net/nrf_cloud.h | 4 ++-- subsys/net/lib/nrf_cloud/src/nrf_cloud_codec_internal.c | 5 +++++ 3 files changed, 12 insertions(+), 3 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 04badc3012bb..3da48850ab13 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst @@ -574,9 +574,13 @@ Libraries for networking * Updated: * Moved JSON manipulation from :file:`nrf_cloud_fota.c` to :file:`nrf_cloud_codec_internal.c`. - * Fixed a build issue that occurred when MQTT and P-GPS are enabled and A-GPS is disabled. * :c:func:`nrf_cloud_obj_location_request_create` to use the new function :c:func:`nrf_cloud_obj_location_request_payload_add`. + * Fixed: + + * A build issue that occurred when MQTT and P-GPS are enabled and A-GPS is disabled. + * A bug preventing ``AIR_QUAL`` from being enabled in shadow UI service info. + * Removed: * Unused internal codec function ``nrf_cloud_format_single_cell_pos_req_json()``. diff --git a/include/net/nrf_cloud.h b/include/net/nrf_cloud.h index 115628d9e03f..eecfb779937b 100644 --- a/include/net/nrf_cloud.h +++ b/include/net/nrf_cloud.h @@ -448,10 +448,10 @@ struct nrf_cloud_svc_info_ui { uint8_t log:1; /** Dictionary (binary) Logs */ uint8_t dictionary_log:1; - - /* Items without UI support on nRF Cloud */ /** Air Quality */ uint8_t air_quality:1; + + /* Items without UI support on nRF Cloud */ /** Light sensor */ uint8_t light_sensor:1; /** Button */ diff --git a/subsys/net/lib/nrf_cloud/src/nrf_cloud_codec_internal.c b/subsys/net/lib/nrf_cloud/src/nrf_cloud_codec_internal.c index d7a2470420cf..51932296281a 100644 --- a/subsys/net/lib/nrf_cloud/src/nrf_cloud_codec_internal.c +++ b/subsys/net/lib/nrf_cloud/src/nrf_cloud_codec_internal.c @@ -1122,6 +1122,11 @@ static int nrf_cloud_encode_service_info_ui(const struct nrf_cloud_svc_info_ui * cJSON_CreateString(sensor_type_str[NRF_CLOUD_SENSOR_AIR_PRESS])); ++item_cnt; } + if (ui->air_quality) { + cJSON_AddItemToArray(array, + cJSON_CreateString(sensor_type_str[NRF_CLOUD_SENSOR_AIR_QUAL])); + ++item_cnt; + } if (ui->gnss) { cJSON_AddItemToArray(array, cJSON_CreateString(sensor_type_str[NRF_CLOUD_SENSOR_GNSS]));