Skip to content

Commit 102d402

Browse files
vikrant8052jhedberg
authored andcommitted
samples: mesh: nrf52: added some more macros support
Added some more macros support. Signed-off-by: Vikrant More <[email protected]>
1 parent c4edc2d commit 102d402

File tree

2 files changed

+93
-35
lines changed

2 files changed

+93
-35
lines changed

samples/boards/nrf/mesh/onoff_level_lighting_vnd_app/src/mesh/ble_mesh.h

Lines changed: 85 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,97 @@
1616
#include <bluetooth/mesh.h>
1717

1818
/* Model Operation Codes */
19-
#define BT_MESH_MODEL_OP_GEN_ONOFF_GET BT_MESH_MODEL_OP_2(0x82, 0x01)
20-
#define BT_MESH_MODEL_OP_GEN_ONOFF_SET BT_MESH_MODEL_OP_2(0x82, 0x02)
21-
#define BT_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x03)
22-
#define BT_MESH_MODEL_OP_GEN_ONOFF_STATUS BT_MESH_MODEL_OP_2(0x82, 0x04)
23-
24-
#define BT_MESH_MODEL_OP_GEN_LEVEL_GET BT_MESH_MODEL_OP_2(0x82, 0x05)
25-
#define BT_MESH_MODEL_OP_GEN_LEVEL_SET BT_MESH_MODEL_OP_2(0x82, 0x06)
26-
#define BT_MESH_MODEL_OP_GEN_LEVEL_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x07)
27-
#define BT_MESH_MODEL_OP_GEN_LEVEL_STATUS BT_MESH_MODEL_OP_2(0x82, 0x08)
28-
#define BT_MESH_MODEL_OP_GEN_DELTA_SET BT_MESH_MODEL_OP_2(0x82, 0x09)
29-
#define BT_MESH_MODEL_OP_GEN_DELTA_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x0A)
30-
#define BT_MESH_MODEL_OP_GEN_MOVE_SET BT_MESH_MODEL_OP_2(0x82, 0x0B)
31-
#define BT_MESH_MODEL_OP_GEN_MOVE_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x0C)
32-
33-
#define BT_MESH_MODEL_GEN_DEF_TRANS_TIME_STATUS BT_MESH_MODEL_OP_2(0x82, 0x10)
34-
35-
#define BT_MESH_MODEL_GEN_ONPOWERUP_STATUS BT_MESH_MODEL_OP_2(0x82, 0x12)
36-
37-
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_STATUS BT_MESH_MODEL_OP_2(0x82, 0x4E)
38-
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_LINEAR_STATUS \
19+
#define BT_MESH_MODEL_OP_GEN_ONOFF_GET BT_MESH_MODEL_OP_2(0x82, 0x01)
20+
#define BT_MESH_MODEL_OP_GEN_ONOFF_SET BT_MESH_MODEL_OP_2(0x82, 0x02)
21+
#define BT_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x03)
22+
#define BT_MESH_MODEL_OP_GEN_ONOFF_STATUS BT_MESH_MODEL_OP_2(0x82, 0x04)
23+
24+
#define BT_MESH_MODEL_OP_GEN_LEVEL_GET BT_MESH_MODEL_OP_2(0x82, 0x05)
25+
#define BT_MESH_MODEL_OP_GEN_LEVEL_SET BT_MESH_MODEL_OP_2(0x82, 0x06)
26+
#define BT_MESH_MODEL_OP_GEN_LEVEL_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x07)
27+
#define BT_MESH_MODEL_OP_GEN_LEVEL_STATUS BT_MESH_MODEL_OP_2(0x82, 0x08)
28+
#define BT_MESH_MODEL_OP_GEN_DELTA_SET BT_MESH_MODEL_OP_2(0x82, 0x09)
29+
#define BT_MESH_MODEL_OP_GEN_DELTA_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x0A)
30+
#define BT_MESH_MODEL_OP_GEN_MOVE_SET BT_MESH_MODEL_OP_2(0x82, 0x0B)
31+
#define BT_MESH_MODEL_OP_GEN_MOVE_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x0C)
32+
33+
#define BT_MESH_MODEL_GEN_DEF_TRANS_TIME_GET BT_MESH_MODEL_OP_2(0x82, 0x0D)
34+
#define BT_MESH_MODEL_GEN_DEF_TRANS_TIME_SET BT_MESH_MODEL_OP_2(0x82, 0x0E)
35+
#define BT_MESH_MODEL_GEN_DEF_TRANS_TIME_SET_UNACK \
36+
BT_MESH_MODEL_OP_2(0x82, 0x0F)
37+
#define BT_MESH_MODEL_GEN_DEF_TRANS_TIME_STATUS BT_MESH_MODEL_OP_2(0x82, 0x10)
38+
39+
#define BT_MESH_MODEL_GEN_ONPOWERUP_GET BT_MESH_MODEL_OP_2(0x82, 0x11)
40+
#define BT_MESH_MODEL_GEN_ONPOWERUP_STATUS BT_MESH_MODEL_OP_2(0x82, 0x12)
41+
#define BT_MESH_MODEL_GEN_ONPOWERUP_SET BT_MESH_MODEL_OP_2(0x82, 0x13)
42+
#define BT_MESH_MODEL_GEN_ONPOWERUP_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x14)
43+
44+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_GET BT_MESH_MODEL_OP_2(0x82, 0x4B)
45+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_SET BT_MESH_MODEL_OP_2(0x82, 0x4C)
46+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x4D)
47+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_STATUS BT_MESH_MODEL_OP_2(0x82, 0x4E)
48+
49+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_LINEAR_GET \
50+
BT_MESH_MODEL_OP_2(0x82, 0x4F)
51+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_LINEAR_SET \
52+
BT_MESH_MODEL_OP_2(0x82, 0x50)
53+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_LINEAR_SET_UNACK \
54+
BT_MESH_MODEL_OP_2(0x82, 0x51)
55+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_LINEAR_STATUS \
3956
BT_MESH_MODEL_OP_2(0x82, 0x52)
40-
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_LAST_STATUS \
57+
58+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_LAST_GET \
59+
BT_MESH_MODEL_OP_2(0x82, 0x53)
60+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_LAST_STATUS \
4161
BT_MESH_MODEL_OP_2(0x82, 0x54)
42-
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_DEFAULT_STATUS \
62+
63+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_DEFAULT_GET \
64+
BT_MESH_MODEL_OP_2(0x82, 0x55)
65+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_DEFAULT_STATUS \
4366
BT_MESH_MODEL_OP_2(0x82, 0x56)
44-
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_RANGE_STATUS \
67+
68+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_RANGE_GET \
69+
BT_MESH_MODEL_OP_2(0x82, 0x57)
70+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_RANGE_STATUS \
4571
BT_MESH_MODEL_OP_2(0x82, 0x58)
4672

47-
#define BT_MESH_MODEL_LIGHT_CTL_STATUS BT_MESH_MODEL_OP_2(0x82, 0x60)
48-
#define BT_MESH_MODEL_LIGHT_CTL_TEMP_RANGE_STATUS \
73+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_DEFAULT_SET \
74+
BT_MESH_MODEL_OP_2(0x82, 0x59)
75+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_DEFAULT_SET_UNACK \
76+
BT_MESH_MODEL_OP_2(0x82, 0x5A)
77+
78+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_RANGE_SET \
79+
BT_MESH_MODEL_OP_2(0x82, 0x5B)
80+
#define BT_MESH_MODEL_LIGHT_LIGHTNESS_RANGE_SET_UNACK \
81+
BT_MESH_MODEL_OP_2(0x82, 0x5C)
82+
83+
#define BT_MESH_MODEL_LIGHT_CTL_GET BT_MESH_MODEL_OP_2(0x82, 0x5D)
84+
#define BT_MESH_MODEL_LIGHT_CTL_SET BT_MESH_MODEL_OP_2(0x82, 0x5E)
85+
#define BT_MESH_MODEL_LIGHT_CTL_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x5F)
86+
#define BT_MESH_MODEL_LIGHT_CTL_STATUS BT_MESH_MODEL_OP_2(0x82, 0x60)
87+
88+
#define BT_MESH_MODEL_LIGHT_CTL_TEMP_GET BT_MESH_MODEL_OP_2(0x82, 0x61)
89+
90+
#define BT_MESH_MODEL_LIGHT_CTL_TEMP_RANGE_GET \
91+
BT_MESH_MODEL_OP_2(0x82, 0x62)
92+
#define BT_MESH_MODEL_LIGHT_CTL_TEMP_RANGE_STATUS \
4993
BT_MESH_MODEL_OP_2(0x82, 0x63)
50-
#define BT_MESH_MODEL_LIGHT_CTL_TEMP_STATUS BT_MESH_MODEL_OP_2(0x82, 0x66)
51-
#define BT_MESH_MODEL_LIGHT_CTL_DEFAULT_STATUS BT_MESH_MODEL_OP_2(0x82, 0x68)
94+
95+
#define BT_MESH_MODEL_LIGHT_CTL_TEMP_SET BT_MESH_MODEL_OP_2(0x82, 0x64)
96+
#define BT_MESH_MODEL_LIGHT_CTL_TEMP_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x65)
97+
#define BT_MESH_MODEL_LIGHT_CTL_TEMP_STATUS BT_MESH_MODEL_OP_2(0x82, 0x66)
98+
99+
#define BT_MESH_MODEL_LIGHT_CTL_DEFAULT_GET BT_MESH_MODEL_OP_2(0x82, 0x67)
100+
#define BT_MESH_MODEL_LIGHT_CTL_DEFAULT_STATUS BT_MESH_MODEL_OP_2(0x82, 0x68)
101+
102+
#define BT_MESH_MODEL_LIGHT_CTL_DEFAULT_SET BT_MESH_MODEL_OP_2(0x82, 0x69)
103+
#define BT_MESH_MODEL_LIGHT_CTL_DEFAULT_SET_UNACK \
104+
BT_MESH_MODEL_OP_2(0x82, 0x6A)
105+
106+
#define BT_MESH_MODEL_LIGHT_CTL_TEMP_RANGE_SET \
107+
BT_MESH_MODEL_OP_2(0x82, 0x6B)
108+
#define BT_MESH_MODEL_LIGHT_CTL_TEMP_RANGE_SET_UNACK \
109+
BT_MESH_MODEL_OP_2(0x82, 0x6C)
52110

53111
void bt_ready(void);
54112

samples/boards/nrf/mesh/onoff_level_lighting_vnd_app/src/mesh/publisher.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ void publish(struct k_work *work)
102102
err = bt_mesh_model_publish(&root_models[5]);
103103
#elif defined(LIGHT_LIGHTNESS_TT)
104104
bt_mesh_model_msg_init(root_models[13].pub->msg,
105-
BT_MESH_MODEL_OP_2(0x82, 0x4D));
105+
BT_MESH_MODEL_LIGHT_LIGHTNESS_SET_UNACK);
106106
net_buf_simple_add_le16(root_models[13].pub->msg, LEVEL_U25);
107107
net_buf_simple_add_u8(root_models[13].pub->msg, tid++);
108108
net_buf_simple_add_u8(root_models[13].pub->msg, 0x45);
109109
net_buf_simple_add_u8(root_models[13].pub->msg, 0x28);
110110
err = bt_mesh_model_publish(&root_models[13]);
111111
#elif defined(LIGHT_CTL)
112112
bt_mesh_model_msg_init(root_models[16].pub->msg,
113-
BT_MESH_MODEL_OP_2(0x82, 0x5F));
113+
BT_MESH_MODEL_LIGHT_CTL_SET_UNACK);
114114
/* Lightness */
115115
net_buf_simple_add_le16(root_models[16].pub->msg, LEVEL_U25);
116116
/* Temperature (value should be from 0x0320 to 0x4E20 */
@@ -122,7 +122,7 @@ void publish(struct k_work *work)
122122
err = bt_mesh_model_publish(&root_models[16]);
123123
#elif defined(LIGHT_CTL_TT)
124124
bt_mesh_model_msg_init(root_models[16].pub->msg,
125-
BT_MESH_MODEL_OP_2(0x82, 0x5F));
125+
BT_MESH_MODEL_LIGHT_CTL_SET_UNACK);
126126
/* Lightness */
127127
net_buf_simple_add_le16(root_models[16].pub->msg, LEVEL_U25);
128128
/* Temperature (value should be from 0x0320 to 0x4E20 */
@@ -136,7 +136,7 @@ void publish(struct k_work *work)
136136
err = bt_mesh_model_publish(&root_models[16]);
137137
#elif defined(LIGHT_CTL_TEMP)
138138
bt_mesh_model_msg_init(root_models[16].pub->msg,
139-
BT_MESH_MODEL_OP_2(0x82, 0x65));
139+
BT_MESH_MODEL_LIGHT_CTL_TEMP_SET_UNACK);
140140
/* Temperature (value should be from 0x0320 to 0x4E20 */
141141
/* This is as per 6.1.3.1 in Mesh Model Specification */
142142
net_buf_simple_add_le16(root_models[16].pub->msg, 0x0320);
@@ -169,15 +169,15 @@ void publish(struct k_work *work)
169169
err = bt_mesh_model_publish(&root_models[5]);
170170
#elif defined(LIGHT_LIGHTNESS_TT)
171171
bt_mesh_model_msg_init(root_models[13].pub->msg,
172-
BT_MESH_MODEL_OP_2(0x82, 0x4D));
172+
BT_MESH_MODEL_LIGHT_LIGHTNESS_SET_UNACK);
173173
net_buf_simple_add_le16(root_models[13].pub->msg, LEVEL_U100);
174174
net_buf_simple_add_u8(root_models[13].pub->msg, tid++);
175175
net_buf_simple_add_u8(root_models[13].pub->msg, 0x45);
176176
net_buf_simple_add_u8(root_models[13].pub->msg, 0x28);
177177
err = bt_mesh_model_publish(&root_models[13]);
178178
#elif defined(LIGHT_CTL)
179179
bt_mesh_model_msg_init(root_models[16].pub->msg,
180-
BT_MESH_MODEL_OP_2(0x82, 0x5F));
180+
BT_MESH_MODEL_LIGHT_CTL_SET_UNACK);
181181
/* Lightness */
182182
net_buf_simple_add_le16(root_models[16].pub->msg, LEVEL_U100);
183183
/* Temperature (value should be from 0x0320 to 0x4E20 */
@@ -189,7 +189,7 @@ void publish(struct k_work *work)
189189
err = bt_mesh_model_publish(&root_models[16]);
190190
#elif defined(LIGHT_CTL_TT)
191191
bt_mesh_model_msg_init(root_models[16].pub->msg,
192-
BT_MESH_MODEL_OP_2(0x82, 0x5F));
192+
BT_MESH_MODEL_LIGHT_CTL_SET_UNACK);
193193
/* Lightness */
194194
net_buf_simple_add_le16(root_models[16].pub->msg, LEVEL_U100);
195195
/* Temperature (value should be from 0x0320 to 0x4E20 */
@@ -203,7 +203,7 @@ void publish(struct k_work *work)
203203
err = bt_mesh_model_publish(&root_models[16]);
204204
#elif defined(LIGHT_CTL_TEMP)
205205
bt_mesh_model_msg_init(root_models[16].pub->msg,
206-
BT_MESH_MODEL_OP_2(0x82, 0x65));
206+
BT_MESH_MODEL_LIGHT_CTL_TEMP_SET_UNACK);
207207
/* Temperature (value should be from 0x0320 to 0x4E20 */
208208
/* This is as per 6.1.3.1 in Mesh Model Specification */
209209
net_buf_simple_add_le16(root_models[16].pub->msg, 0x4E20);

0 commit comments

Comments
 (0)