From aa930f3f949d45ce0c21fea23f3b71b0b17d1acc Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 26 Nov 2017 16:23:00 +0200 Subject: [PATCH] Bluetooth: Mesh: Improve documentation for model publication Make it clear that the model publication msg member must not be a stack variable. Signed-off-by: Johan Hedberg --- include/bluetooth/mesh/access.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/bluetooth/mesh/access.h b/include/bluetooth/mesh/access.h index e8a3aa57ca2..29a44193e29 100644 --- a/include/bluetooth/mesh/access.h +++ b/include/bluetooth/mesh/access.h @@ -281,7 +281,14 @@ struct bt_mesh_model_pub { * contain a valid publication message before calling the * bt_mesh_model_publish() API or after the publication's * @ref bt_mesh_model_pub.update callback has been called - * and returned success. + * and returned success. The buffer must be created outside + * of function context, i.e. it must not be on the stack. + * This is most conveniently acheived by creating it inline + * when declaring the publication context: + * + * static struct bt_mesh_model_pub my_pub = { + * .msg = NET_BUF_SIMPLE(size), + * }; */ struct net_buf_simple *msg;