net: lwm2m: LwM2M Pause and resume support

New API for suspend and resume LwM2M engine.
New event LWM2M_RD_CLIENT_EVENT_ENGINE_SUSPENDED for indicate
application that engine is suspended.

Simplify stack suspend and resume state same time for queue mode.

New CONFIG_LWM2M_RD_CLIENT_SUSPEND_SOCKET_AT_IDLE for enable skip socket
close at RX_OFF_IDDLE state that socket is only suspended and close is
called only when connection is resumed.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
This commit is contained in:
Juha Heiskanen 2022-08-03 12:34:36 +03:00 committed by Carles Cufí
commit ed5f3cdf06
7 changed files with 290 additions and 83 deletions

View file

@ -196,8 +196,9 @@ int lwm2m_engine_context_close(struct lwm2m_ctx *client_ctx)
coap_pendings_clear(client_ctx->pendings, ARRAY_SIZE(client_ctx->pendings));
coap_replies_clear(client_ctx->replies, ARRAY_SIZE(client_ctx->replies));
#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED)
client_ctx->connection_suspended = false;
#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED)
client_ctx->buffer_client_messages = true;
#endif
lwm2m_socket_del(client_ctx);
@ -213,9 +214,9 @@ void lwm2m_engine_context_init(struct lwm2m_ctx *client_ctx)
{
sys_slist_init(&client_ctx->pending_sends);
sys_slist_init(&client_ctx->observer);
client_ctx->connection_suspended = false;
#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED)
client_ctx->buffer_client_messages = true;
client_ctx->connection_suspended = false;
sys_slist_init(&client_ctx->queued_messages);
#endif
}