net: lwm2m: obj inst processing per formatter

It depends from a content formatter is there need to put constructs
with a path level deeper than object instance. In other words with
resource- or resource-instance-level.

Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
This commit is contained in:
Veijo Pesonen 2022-03-02 15:58:36 +02:00 committed by Carles Cufí
commit 0032f0bcff
2 changed files with 15 additions and 12 deletions

View file

@ -3366,12 +3366,9 @@ static int lwm2m_perform_read_object_instance(struct lwm2m_message *msg,
/* update the obj_inst_id as we move through the instances */
msg->path.obj_inst_id = obj_inst->obj_inst_id;
if (msg->path.level <= LWM2M_PATH_LEVEL_OBJECT) {
/* start instance formatting */
ret = engine_put_begin_oi(&msg->out, &msg->path);
if (ret < 0) {
return ret;
}
ret = engine_put_begin_oi(&msg->out, &msg->path);
if (ret < 0) {
return ret;
}
for (int index = 0; index < obj_inst->resource_count; index++) {
@ -3429,12 +3426,9 @@ static int lwm2m_perform_read_object_instance(struct lwm2m_message *msg,
}
move_forward:
if (msg->path.level <= LWM2M_PATH_LEVEL_OBJECT) {
/* end instance formatting */
ret = engine_put_end_oi(&msg->out, &msg->path);
if (ret < 0) {
return ret;
}
ret = engine_put_end_oi(&msg->out, &msg->path);
if (ret < 0) {
return ret;
}
if (msg->path.level <= LWM2M_PATH_LEVEL_OBJECT) {