@@ -157,7 +157,6 @@ struct net_buf *bt_mesh_adv_create(enum bt_mesh_adv_type type,
157157 tag , xmit , timeout );
158158}
159159
160- #if CONFIG_BT_MESH_RELAY_ADV_SETS || CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE
161160static struct net_buf * process_events (struct k_poll_event * ev , int count )
162161{
163162 for (; count ; ev ++ , count -- ) {
@@ -186,12 +185,15 @@ struct net_buf *bt_mesh_adv_buf_get(k_timeout_t timeout)
186185 K_POLL_MODE_NOTIFY_ONLY ,
187186 & bt_mesh_adv_queue ,
188187 0 ),
189- #if defined(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET )
188+ #if defined(CONFIG_BT_MESH_RELAY ) && \
189+ (defined (CONFIG_BT_MESH_ADV_LEGACY ) || \
190+ defined (CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET ) || \
191+ !(CONFIG_BT_MESH_RELAY_ADV_SETS ))
190192 K_POLL_EVENT_STATIC_INITIALIZER (K_POLL_TYPE_FIFO_DATA_AVAILABLE ,
191193 K_POLL_MODE_NOTIFY_ONLY ,
192194 & bt_mesh_relay_queue ,
193195 0 ),
194- #endif /* CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET */
196+ #endif
195197 };
196198
197199 err = k_poll (events , ARRAY_SIZE (events ), timeout );
@@ -209,37 +211,23 @@ struct net_buf *bt_mesh_adv_buf_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_time
209211 return net_buf_get (& bt_mesh_friend_queue , timeout );
210212 }
211213
212- # if CONFIG_BT_MESH_RELAY_ADV_SETS
213- if ( !(tags & BT_MESH_ADV_TAG_BIT_LOCAL )) {
214+ if ( IS_ENABLED ( CONFIG_BT_MESH_RELAY ) &&
215+ !(tags & BT_MESH_ADV_TAG_BIT_LOCAL )) {
214216 return net_buf_get (& bt_mesh_relay_queue , timeout );
215217 }
216- #endif
217218
218219 return bt_mesh_adv_buf_get (timeout );
219220}
220- #else /* !(CONFIG_BT_MESH_RELAY_ADV_SETS || CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE) */
221- struct net_buf * bt_mesh_adv_buf_get (k_timeout_t timeout )
222- {
223- return net_buf_get (& bt_mesh_adv_queue , timeout );
224- }
225-
226- struct net_buf * bt_mesh_adv_buf_get_by_tag (enum bt_mesh_adv_tag_bit tags , k_timeout_t timeout )
227- {
228- ARG_UNUSED (tags );
229-
230- return bt_mesh_adv_buf_get (timeout );
231- }
232- #endif /* CONFIG_BT_MESH_RELAY_ADV_SETS || CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE */
233221
234222void bt_mesh_adv_buf_get_cancel (void )
235223{
236224 LOG_DBG ("" );
237225
238226 k_fifo_cancel_wait (& bt_mesh_adv_queue );
239227
240- # if CONFIG_BT_MESH_RELAY_ADV_SETS
241- k_fifo_cancel_wait (& bt_mesh_relay_queue );
242- #endif /* CONFIG_BT_MESH_RELAY_ADV_SETS */
228+ if ( IS_ENABLED ( CONFIG_BT_MESH_RELAY )) {
229+ k_fifo_cancel_wait (& bt_mesh_relay_queue );
230+ }
243231
244232 if (IS_ENABLED (CONFIG_BT_MESH_ADV_EXT_FRIEND_SEPARATE )) {
245233 k_fifo_cancel_wait (& bt_mesh_friend_queue );
@@ -267,15 +255,14 @@ void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb,
267255 return ;
268256 }
269257
270- # if CONFIG_BT_MESH_RELAY_ADV_SETS
271- if ( BT_MESH_ADV (buf )-> tag == BT_MESH_ADV_TAG_RELAY ||
258+ if (( IS_ENABLED ( CONFIG_BT_MESH_RELAY ) &&
259+ BT_MESH_ADV (buf )-> tag == BT_MESH_ADV_TAG_RELAY ) ||
272260 (IS_ENABLED (CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS ) &&
273261 BT_MESH_ADV (buf )-> tag == BT_MESH_ADV_TAG_PROV )) {
274262 net_buf_put (& bt_mesh_relay_queue , net_buf_ref (buf ));
275263 bt_mesh_adv_buf_relay_ready ();
276264 return ;
277265 }
278- #endif
279266
280267 net_buf_put (& bt_mesh_adv_queue , net_buf_ref (buf ));
281268 bt_mesh_adv_buf_local_ready ();
0 commit comments