Zephyr API Documentation
4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
lwm2m_path.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 Endian Technologies AB
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_NET_LWM2M_PATH_H_
8
#define ZEPHYR_INCLUDE_NET_LWM2M_PATH_H_
9
45
#define LWM2M_PATH(...) \
46
LWM2M_PATH_MACRO(__VA_ARGS__, LWM2M_PATH4, LWM2M_PATH3, \
47
LWM2M_PATH2, LWM2M_PATH1)(__VA_ARGS__)
48
49
51
/* Internal helper macros for the LWM2M_PATH macro */
52
#define LWM2M_PATH_VA_NUM_ARGS(...) \
53
LWM2M_PATH_VA_NUM_ARGS_IMPL(__VA_ARGS__, 5, 4, 3, 2, 1)
54
#define LWM2M_PATH_VA_NUM_ARGS_IMPL(_1, _2, _3, _4, N, ...) N
55
56
#define LWM2M_PATH1(_x) #_x
57
#define LWM2M_PATH2(_x, _y) #_x "/" #_y
58
#define LWM2M_PATH3(_x, _y, _z) #_x "/" #_y "/" #_z
59
#define LWM2M_PATH4(_a, _x, _y, _z) #_a "/" #_x "/" #_y "/" #_z
60
61
#define LWM2M_PATH_MACRO(_1, _2, _3, _4, NAME, ...) NAME
83
#define LWM2M_OBJ(...) \
84
GET_OBJ_MACRO(__VA_ARGS__, LWM2M_OBJ4, LWM2M_OBJ3, LWM2M_OBJ2, LWM2M_OBJ1)(__VA_ARGS__)
85
87
/* Internal helper macros for the LWM2M_OBJ macro */
88
#define GET_OBJ_MACRO(_1, _2, _3, _4, NAME, ...) NAME
89
#define LWM2M_OBJ1(oi) (struct lwm2m_obj_path) {.obj_id = oi, .level = 1}
90
#define LWM2M_OBJ2(oi, oii) (struct lwm2m_obj_path) {.obj_id = oi, .obj_inst_id = oii, .level = 2}
91
#define LWM2M_OBJ3(oi, oii, ri) (struct lwm2m_obj_path) \
92
{.obj_id = oi, .obj_inst_id = oii, .res_id = ri, .level = 3}
93
#define LWM2M_OBJ4(oi, oii, ri, rii) (struct lwm2m_obj_path) \
94
{.obj_id = oi, .obj_inst_id = oii, .res_id = ri, .res_inst_id = rii, .level = 4}
99
#endif
/* ZEPHYR_INCLUDE_NET_LWM2M_PATH_H_ */
zephyr
net
lwm2m_path.h
Generated on Sun Nov 17 2024 12:02:30 for Zephyr API Documentation by
1.12.0