Skip to content

Commit 26599e3

Browse files
mike-scottnashif
authored andcommitted
net: lwm2m: introduce input formatter private data
The JSON formatter is currently not enabled for incoming WRITE operations. To update the code in the formatter and not litter the input context with extra data, let's allow formatters to store their own user data. Signed-off-by: Michael Scott <[email protected]>
1 parent a433af6 commit 26599e3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

subsys/net/lib/lwm2m/lwm2m_object.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ struct lwm2m_input_context {
282282

283283
/* length of incoming opaque */
284284
u16_t opaque_len;
285+
286+
/* private output data */
287+
void *user_data;
285288
};
286289

287290
/* Establish a message timeout callback */
@@ -408,6 +411,23 @@ engine_clear_out_user_data(struct lwm2m_output_context *out)
408411
out->user_data = NULL;
409412
}
410413

414+
static inline void engine_set_in_user_data(struct lwm2m_input_context *in,
415+
void *user_data)
416+
{
417+
in->user_data = user_data;
418+
}
419+
420+
static inline void *engine_get_in_user_data(struct lwm2m_input_context *in)
421+
{
422+
return in->user_data;
423+
}
424+
425+
static inline void
426+
engine_clear_in_user_data(struct lwm2m_input_context *in)
427+
{
428+
in->user_data = NULL;
429+
}
430+
411431
/* inline multi-format write / read functions */
412432

413433
static inline size_t engine_put_begin(struct lwm2m_output_context *out,

0 commit comments

Comments
 (0)