Zephyr Project API
3.7.0
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
43
#define LWM2M_PATH(...) \
44
LWM2M_PATH_MACRO(__VA_ARGS__, LWM2M_PATH4, LWM2M_PATH3, \
45
LWM2M_PATH2, LWM2M_PATH1)(__VA_ARGS__)
46
47
49
/* Internal helper macros for the LWM2M_PATH macro */
50
#define LWM2M_PATH_VA_NUM_ARGS(...) \
51
LWM2M_PATH_VA_NUM_ARGS_IMPL(__VA_ARGS__, 5, 4, 3, 2, 1)
52
#define LWM2M_PATH_VA_NUM_ARGS_IMPL(_1, _2, _3, _4, N, ...) N
53
54
#define LWM2M_PATH1(_x) #_x
55
#define LWM2M_PATH2(_x, _y) #_x "/" #_y
56
#define LWM2M_PATH3(_x, _y, _z) #_x "/" #_y "/" #_z
57
#define LWM2M_PATH4(_a, _x, _y, _z) #_a "/" #_x "/" #_y "/" #_z
58
59
#define LWM2M_PATH_MACRO(_1, _2, _3, _4, NAME, ...) NAME
81
#define LWM2M_OBJ(...) \
82
GET_OBJ_MACRO(__VA_ARGS__, LWM2M_OBJ4, LWM2M_OBJ3, LWM2M_OBJ2, LWM2M_OBJ1)(__VA_ARGS__)
83
85
/* Internal helper macros for the LWM2M_OBJ macro */
86
#define GET_OBJ_MACRO(_1, _2, _3, _4, NAME, ...) NAME
87
#define LWM2M_OBJ1(oi) (struct lwm2m_obj_path) {.obj_id = oi, .level = 1}
88
#define LWM2M_OBJ2(oi, oii) (struct lwm2m_obj_path) {.obj_id = oi, .obj_inst_id = oii, .level = 2}
89
#define LWM2M_OBJ3(oi, oii, ri) (struct lwm2m_obj_path) \
90
{.obj_id = oi, .obj_inst_id = oii, .res_id = ri, .level = 3}
91
#define LWM2M_OBJ4(oi, oii, ri, rii) (struct lwm2m_obj_path) \
92
{.obj_id = oi, .obj_inst_id = oii, .res_id = ri, .res_inst_id = rii, .level = 4}
97
#endif
/* ZEPHYR_INCLUDE_NET_LWM2M_PATH_H_ */
include
zephyr
net
lwm2m_path.h
Generated on Sun Sep 15 2024 17:01:30 for Zephyr Project API by
1.9.8