Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
LwM2M path helper macros

Macros

#define LWM2M_PATH(...)
 Generate LwM2M string paths using numeric components.
 
#define LWM2M_OBJ(...)    GET_OBJ_MACRO(__VA_ARGS__, LWM2M_OBJ4, LWM2M_OBJ3, LWM2M_OBJ2, LWM2M_OBJ1)(__VA_ARGS__)
 Initialize LwM2M object structure.
 

Detailed Description

Macro Definition Documentation

◆ LWM2M_OBJ

#define LWM2M_OBJ (   ...)     GET_OBJ_MACRO(__VA_ARGS__, LWM2M_OBJ4, LWM2M_OBJ3, LWM2M_OBJ2, LWM2M_OBJ1)(__VA_ARGS__)

#include <zephyr/net/lwm2m_path.h>

Initialize LwM2M object structure.

Accepts at least one and up to four arguments. Fill up lwm2m_obj_path structure and sets the level.

For example:

struct lwm2m_obj_path p = LWM2M_OBJ(MY_OBJ, 0, RESOURCE);
#define LWM2M_OBJ(...)
Initialize LwM2M object structure.
Definition: lwm2m_path.h:81
LwM2M object path structure.
Definition: lwm2m.h:96

Can also be used in place of function argument to return the structure allocated from stack

lwm2m_notify_observer_path(&LWM2M_OBJ(MY_OBJ, inst_id, RESOURCE));

◆ LWM2M_PATH

#define LWM2M_PATH (   ...)

#include <zephyr/net/lwm2m_path.h>

Value:
LWM2M_PATH_MACRO(__VA_ARGS__, LWM2M_PATH4, LWM2M_PATH3, \
LWM2M_PATH2, LWM2M_PATH1)(__VA_ARGS__)

Generate LwM2M string paths using numeric components.

Accepts at least one and up to four arguments. Each argument will be stringified by the pre-processor, so calling this with non-literals will likely not do what you want.

For example:

#define MY_OBJ_ID 3
LWM2M_PATH(MY_OBJ_ID, 0, 1)
#define LWM2M_PATH(...)
Generate LwM2M string paths using numeric components.
Definition: lwm2m_path.h:43

would evaluate to "3/0/1", while

int x = 3;
LWM2M_PATH(x, 0, 1)

evaluates to "x/0/1".