Skip to content

Commit

Permalink
net: lib: nrf_cloud: Fix nrf_cloud_obj_reset
Browse files Browse the repository at this point in the history
Fix a small bug with error handling in nrf_cloud_obj_reset

Also add a couple of useful debug messages to nrf_cloud_codec.c

Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
  • Loading branch information
glarsennordic authored and nordicjm committed Jul 3, 2023
1 parent e1912e0 commit f2ce6c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion subsys/net/lib/nrf_cloud/src/nrf_cloud_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ int nrf_cloud_obj_reset(struct nrf_cloud_obj *const obj)
case NRF_CLOUD_OBJ_TYPE_JSON:
{
obj->json = NULL;
break;
}
default:
return -ENOTSUP;
Expand All @@ -207,7 +208,7 @@ int nrf_cloud_obj_reset(struct nrf_cloud_obj *const obj)

obj->enc_src = NRF_CLOUD_ENC_SRC_NONE;

return -ENOTSUP;
return 0;
}

int nrf_cloud_obj_bulk_init(struct nrf_cloud_obj *const bulk)
Expand Down
9 changes: 7 additions & 2 deletions subsys/net/lib/nrf_cloud/src/nrf_cloud_codec_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,13 +931,13 @@ int json_send_to_cloud(cJSON *const request)
return -ENOMEM;
}

LOG_DBG("Created request: %s", msg_string);

struct nct_dc_data msg = {
.data.ptr = msg_string,
.data.len = strlen(msg_string)
};

LOG_DBG("Created request: %s (size: %u)", (char *)msg.data.ptr, msg.data.len);

err = nct_dc_send(&msg);
if (err) {
LOG_ERR("Failed to send request, error: %d", err);
Expand Down Expand Up @@ -2321,6 +2321,9 @@ int nrf_cloud_cell_pos_req_json_encode(struct lte_lc_cells_info const *const inf
return -EINVAL;
}

LOG_DBG("Encoding lte_lc_cells_info with ncells_count: %u and gci_cells_count: %u",
inf->ncells_count, inf->gci_cells_count);

int err;
cJSON *lte_array;
cJSON *lte_obj;
Expand Down Expand Up @@ -2385,6 +2388,8 @@ int nrf_cloud_wifi_req_json_encode(struct wifi_scan_info const *const wifi,
return -EINVAL;
}

LOG_DBG("Encoding wifi_scan_info with count: %u", wifi->cnt);

cJSON *wifi_obj = NULL;
cJSON *ap_array = NULL;

Expand Down

0 comments on commit f2ce6c2

Please sign in to comment.