Skip to content

Commit 3e537db

Browse files
rlubosjhedberg
authored andcommitted
net: lwm2m: Fix SenML CBOR resource instance encoding
Consecutive resource instance name should be encoded regardless of whether timestamp is present or not. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
1 parent 2a9f214 commit 3e537db

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,14 @@ static int put_name_nth_ri(struct lwm2m_output_context *out, struct lwm2m_obj_pa
350350
struct record *record = GET_CBOR_FD_REC(fd);
351351

352352
/* With the first ri the resource name (and ri name) are already in place*/
353+
if (path->res_inst_id > 0) {
354+
return put_begin_ri(out, path);
355+
}
356+
353357
if (record == NULL || !record->record_t_present) {
354358
return 0;
355359
}
360+
356361
/* Name need to be add for each time serialized record */
357362
if (path->level == LWM2M_PATH_LEVEL_RESOURCE_INST) {
358363
return put_begin_ri(out, path);

0 commit comments

Comments
 (0)