Skip to content

Commit d36697a

Browse files
Balaklakajhedberg
authored andcommitted
Bluetooth: Mesh: Fixed OP_AGG_SRV dependency of OP_AGG_CLI
The OP_AGG_SRV is dependent that the OP_AGG_CLI is add for the OP_AGG_SRV to work. Moved the define of OP_AGG_CLI so it will call op_agg_send without the OP_AGG_CLI. Signed-off-by: Ingar Kulbrandstad <[email protected]>
1 parent eafa2bb commit d36697a

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

subsys/bluetooth/mesh/op_agg.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ LOG_MODULE_REGISTER(bt_mesh_op_agg);
1818

1919
NET_BUF_SIMPLE_DEFINE_STATIC(sdu, BT_MESH_TX_SDU_MAX);
2020

21-
#ifdef CONFIG_BT_MESH_OP_AGG_CLI
21+
#if IS_ENABLED(CONFIG_BT_MESH_OP_AGG_CLI)
2222
NET_BUF_SIMPLE_DEFINE_STATIC(srcs, BT_MESH_TX_SDU_MAX);
2323
#endif
2424

2525
static struct op_agg_ctx agg_ctx = {
2626
.sdu = &sdu,
27-
#ifdef CONFIG_BT_MESH_OP_AGG_CLI
27+
#if IS_ENABLED(CONFIG_BT_MESH_OP_AGG_CLI)
2828
.srcs = &srcs,
2929
#endif
3030
};
@@ -42,11 +42,7 @@ static bool ctx_match(struct bt_mesh_msg_ctx *ctx)
4242

4343
int bt_mesh_op_agg_accept(struct bt_mesh_msg_ctx *msg_ctx)
4444
{
45-
#ifdef CONFIG_BT_MESH_OP_AGG_CLI
4645
return agg_ctx.initialized && ctx_match(msg_ctx);
47-
#else
48-
return 0;
49-
#endif
5046
}
5147

5248
void bt_mesh_op_agg_ctx_reinit(void)
@@ -58,22 +54,23 @@ int bt_mesh_op_agg_send(struct bt_mesh_model *model,
5854
struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *msg,
5955
const struct bt_mesh_send_cb *cb)
6056
{
61-
uint16_t src;
6257
int err;
6358

6459
/* Model responded so mark this message as acknowledged */
6560
agg_ctx.ack = true;
6661

67-
/* Store source address so that Opcodes Aggregator Client can match
68-
* response with source model
69-
*/
70-
src = bt_mesh_model_elem(model)->addr;
62+
if (IS_ENABLED(CONFIG_BT_MESH_OP_AGG_CLI)) {
63+
/* Store source address so that Opcodes Aggregator Client can
64+
* match response with source model
65+
*/
66+
uint16_t src = bt_mesh_model_elem(model)->addr;
7167

72-
if (net_buf_simple_tailroom(&srcs) < 2) {
73-
return -ENOMEM;
74-
}
68+
if (net_buf_simple_tailroom(&srcs) < 2) {
69+
return -ENOMEM;
70+
}
7571

76-
net_buf_simple_add_le16(&srcs, src);
72+
net_buf_simple_add_le16(&srcs, src);
73+
}
7774

7875
err = bt_mesh_op_agg_encode_msg(msg);
7976
if (err) {

0 commit comments

Comments
 (0)