net: lwm2m: API for multiple resource writing

Used the registry lock in the functions lwm2m_registry_lock() and
lwm2m_registry_unlock() to make the registry lockable through a public
API. If writing to multiple resources that are composite-observed,
locking will halt the main thread until every resource is written to,
ensuring that only one notify message will be sent. Updated
the documentation in lwm2m to include this addition.

Signed-off-by: Ola Tangen Kulseng <ola.kulseng@nordicsemi.no>
This commit is contained in:
Ola Tangen Kulseng 2022-08-16 08:22:26 +02:00 committed by Fabio Baltieri
commit 1df3de4e98
5 changed files with 51 additions and 2 deletions

View file

@ -2254,8 +2254,10 @@ void lwm2m_udp_receive(struct lwm2m_ctx *client_ctx, uint8_t *buf, uint16_t buf_
client_ctx->processed_req = msg;
lwm2m_registry_lock();
/* process the response to this request */
r = udp_request_handler(&response, msg);
lwm2m_registry_unlock();
if (r < 0) {
return;
}