net: lwm2m: Send Registration Update on lifetime change

According to LwM2M specfication v1.0.2, par. 5.3.2, the LwM2M client
MUST send an “Update” operation to the LwM2M Server whenever the
lifetime parameter of the Server object changes the server). The same
applies for the object instances created/deleted. The changes in objects
seem to already be handled, but the lifetime was not.

Additionally, the "Update" message shall only contain these parameters
which changed since the last update (including objects). As it's
straightforward to determine if the liftime  changed but it's not easy
to tell if there were updates in the object instances, add an
additional parameter to the engine_trigger_update() function, indicating
that new object information shall be sent in the "Update" message.

Eventually add a proper error checking in `sm_send_registration` as the
function is reworked anyway.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2020-10-28 16:15:27 +01:00 committed by Carles Cufí
commit 4625820354
5 changed files with 120 additions and 61 deletions

View file

@ -2838,7 +2838,7 @@ static int lwm2m_delete_handler(struct lwm2m_message *msg)
ret = lwm2m_delete_obj_inst(msg->path.obj_id, msg->path.obj_inst_id);
#if defined(CONFIG_LWM2M_RD_CLIENT_SUPPORT)
if (!ret && !msg->ctx->bootstrap_mode) {
engine_trigger_update();
engine_trigger_update(true);
}
#endif
@ -3239,7 +3239,7 @@ int lwm2m_get_or_create_engine_obj(struct lwm2m_message *msg,
#if defined(CONFIG_LWM2M_RD_CLIENT_SUPPORT)
if (!msg->ctx->bootstrap_mode) {
engine_trigger_update();
engine_trigger_update(true);
}
#endif
}