Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
access.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2017 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_ACCESS_H_
11#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_ACCESS_H_
12
13#include <zephyr/sys/util.h>
16
17/* Internal macros used to initialize array members */
18#define BT_MESH_KEY_UNUSED_ELT_(IDX, _) BT_MESH_KEY_UNUSED
19#define BT_MESH_ADDR_UNASSIGNED_ELT_(IDX, _) BT_MESH_ADDR_UNASSIGNED
20#define BT_MESH_UUID_UNASSIGNED_ELT_(IDX, _) NULL
21#define BT_MESH_MODEL_KEYS_UNUSED(_keys) \
22 { LISTIFY(_keys, BT_MESH_KEY_UNUSED_ELT_, (,)) }
23#define BT_MESH_MODEL_GROUPS_UNASSIGNED(_grps) \
24 { LISTIFY(_grps, BT_MESH_ADDR_UNASSIGNED_ELT_, (,)) }
25#if CONFIG_BT_MESH_LABEL_COUNT > 0
26#define BT_MESH_MODEL_UUIDS_UNASSIGNED() \
27 .uuids = (const uint8_t *[]){ LISTIFY(CONFIG_BT_MESH_LABEL_COUNT, \
28 BT_MESH_UUID_UNASSIGNED_ELT_, (,)) },
29#else
30#define BT_MESH_MODEL_UUIDS_UNASSIGNED()
31#endif
32
33#define BT_MESH_MODEL_RUNTIME_INIT(_user_data) \
34 .rt = &(struct bt_mesh_model_rt_ctx){ .user_data = (_user_data) },
35
43#ifdef __cplusplus
44extern "C" {
45#endif
46
51#define BT_MESH_ADDR_UNASSIGNED 0x0000
52#define BT_MESH_ADDR_ALL_NODES 0xffff
53#define BT_MESH_ADDR_RELAYS 0xfffe
54#define BT_MESH_ADDR_FRIENDS 0xfffd
55#define BT_MESH_ADDR_PROXIES 0xfffc
56#define BT_MESH_ADDR_DFW_NODES 0xfffb
57#define BT_MESH_ADDR_IP_NODES 0xfffa
58#define BT_MESH_ADDR_IP_BR_ROUTERS 0xfff9
67#define BT_MESH_KEY_UNUSED 0xffff
68#define BT_MESH_KEY_ANY 0xffff
69#define BT_MESH_KEY_DEV 0xfffe
70#define BT_MESH_KEY_DEV_LOCAL BT_MESH_KEY_DEV
71#define BT_MESH_KEY_DEV_REMOTE 0xfffd
72#define BT_MESH_KEY_DEV_ANY 0xfffc
80#define BT_MESH_ADDR_IS_UNICAST(addr) ((addr) && (addr) < 0x8000)
84#define BT_MESH_ADDR_IS_GROUP(addr) ((addr) >= 0xc000 && (addr) < 0xff00)
88#define BT_MESH_ADDR_IS_FIXED_GROUP(addr) ((addr) >= 0xff00 && (addr) < 0xffff)
92#define BT_MESH_ADDR_IS_VIRTUAL(addr) ((addr) >= 0x8000 && (addr) < 0xc000)
96#define BT_MESH_ADDR_IS_RFU(addr) ((addr) >= 0xff00 && (addr) <= 0xfff8)
97
101#define BT_MESH_IS_DEV_KEY(key) (key == BT_MESH_KEY_DEV_LOCAL || \
102 key == BT_MESH_KEY_DEV_REMOTE)
103
105#define BT_MESH_APP_SEG_SDU_MAX 12
106
108#define BT_MESH_APP_UNSEG_SDU_MAX 15
109
111#if defined(CONFIG_BT_MESH_RX_SEG_MAX)
112#define BT_MESH_RX_SEG_MAX CONFIG_BT_MESH_RX_SEG_MAX
113#else
114#define BT_MESH_RX_SEG_MAX 0
115#endif
116
118#if defined(CONFIG_BT_MESH_TX_SEG_MAX)
119#define BT_MESH_TX_SEG_MAX CONFIG_BT_MESH_TX_SEG_MAX
120#else
121#define BT_MESH_TX_SEG_MAX 0
122#endif
123
125#define BT_MESH_TX_SDU_MAX MAX((BT_MESH_TX_SEG_MAX * \
126 BT_MESH_APP_SEG_SDU_MAX), \
127 BT_MESH_APP_UNSEG_SDU_MAX)
128
130#define BT_MESH_RX_SDU_MAX MAX((BT_MESH_RX_SEG_MAX * \
131 BT_MESH_APP_SEG_SDU_MAX), \
132 BT_MESH_APP_UNSEG_SDU_MAX)
133
143#define BT_MESH_ELEM(_loc, _mods, _vnd_mods) \
144{ \
145 .rt = &(struct bt_mesh_elem_rt_ctx) { 0 }, \
146 .loc = (_loc), \
147 .model_count = ARRAY_SIZE(_mods), \
148 .vnd_model_count = ARRAY_SIZE(_vnd_mods), \
149 .models = (_mods), \
150 .vnd_models = (_vnd_mods), \
151}
152
160
167
169 const struct bt_mesh_model * const models;
171 const struct bt_mesh_model * const vnd_models;
172};
173
179#define BT_MESH_MODEL_ID_CFG_SRV 0x0000
181#define BT_MESH_MODEL_ID_CFG_CLI 0x0001
183#define BT_MESH_MODEL_ID_HEALTH_SRV 0x0002
185#define BT_MESH_MODEL_ID_HEALTH_CLI 0x0003
187#define BT_MESH_MODEL_ID_REMOTE_PROV_SRV 0x0004
189#define BT_MESH_MODEL_ID_REMOTE_PROV_CLI 0x0005
191#define BT_MESH_MODEL_ID_PRIV_BEACON_SRV 0x000a
193#define BT_MESH_MODEL_ID_PRIV_BEACON_CLI 0x000b
195#define BT_MESH_MODEL_ID_SAR_CFG_SRV 0x000e
197#define BT_MESH_MODEL_ID_SAR_CFG_CLI 0x000f
199#define BT_MESH_MODEL_ID_OP_AGG_SRV 0x0010
201#define BT_MESH_MODEL_ID_OP_AGG_CLI 0x0011
203#define BT_MESH_MODEL_ID_LARGE_COMP_DATA_SRV 0x0012
205#define BT_MESH_MODEL_ID_LARGE_COMP_DATA_CLI 0x0013
207#define BT_MESH_MODEL_ID_SOL_PDU_RPL_SRV 0x0014
209#define BT_MESH_MODEL_ID_SOL_PDU_RPL_CLI 0x0015
211#define BT_MESH_MODEL_ID_ON_DEMAND_PROXY_SRV 0x000c
213#define BT_MESH_MODEL_ID_ON_DEMAND_PROXY_CLI 0x000d
223#define BT_MESH_MODEL_ID_GEN_ONOFF_SRV 0x1000
225#define BT_MESH_MODEL_ID_GEN_ONOFF_CLI 0x1001
227#define BT_MESH_MODEL_ID_GEN_LEVEL_SRV 0x1002
229#define BT_MESH_MODEL_ID_GEN_LEVEL_CLI 0x1003
231#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV 0x1004
233#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI 0x1005
235#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV 0x1006
237#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV 0x1007
239#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI 0x1008
241#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV 0x1009
243#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV 0x100a
245#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI 0x100b
247#define BT_MESH_MODEL_ID_GEN_BATTERY_SRV 0x100c
249#define BT_MESH_MODEL_ID_GEN_BATTERY_CLI 0x100d
251#define BT_MESH_MODEL_ID_GEN_LOCATION_SRV 0x100e
253#define BT_MESH_MODEL_ID_GEN_LOCATION_SETUPSRV 0x100f
255#define BT_MESH_MODEL_ID_GEN_LOCATION_CLI 0x1010
257#define BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV 0x1011
259#define BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV 0x1012
261#define BT_MESH_MODEL_ID_GEN_USER_PROP_SRV 0x1013
263#define BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV 0x1014
265#define BT_MESH_MODEL_ID_GEN_PROP_CLI 0x1015
267#define BT_MESH_MODEL_ID_SENSOR_SRV 0x1100
269#define BT_MESH_MODEL_ID_SENSOR_SETUP_SRV 0x1101
271#define BT_MESH_MODEL_ID_SENSOR_CLI 0x1102
273#define BT_MESH_MODEL_ID_TIME_SRV 0x1200
275#define BT_MESH_MODEL_ID_TIME_SETUP_SRV 0x1201
277#define BT_MESH_MODEL_ID_TIME_CLI 0x1202
279#define BT_MESH_MODEL_ID_SCENE_SRV 0x1203
281#define BT_MESH_MODEL_ID_SCENE_SETUP_SRV 0x1204
283#define BT_MESH_MODEL_ID_SCENE_CLI 0x1205
285#define BT_MESH_MODEL_ID_SCHEDULER_SRV 0x1206
287#define BT_MESH_MODEL_ID_SCHEDULER_SETUP_SRV 0x1207
289#define BT_MESH_MODEL_ID_SCHEDULER_CLI 0x1208
291#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV 0x1300
293#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV 0x1301
295#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI 0x1302
297#define BT_MESH_MODEL_ID_LIGHT_CTL_SRV 0x1303
299#define BT_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV 0x1304
301#define BT_MESH_MODEL_ID_LIGHT_CTL_CLI 0x1305
303#define BT_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV 0x1306
305#define BT_MESH_MODEL_ID_LIGHT_HSL_SRV 0x1307
307#define BT_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV 0x1308
309#define BT_MESH_MODEL_ID_LIGHT_HSL_CLI 0x1309
311#define BT_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV 0x130a
313#define BT_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV 0x130b
315#define BT_MESH_MODEL_ID_LIGHT_XYL_SRV 0x130c
317#define BT_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV 0x130d
319#define BT_MESH_MODEL_ID_LIGHT_XYL_CLI 0x130e
321#define BT_MESH_MODEL_ID_LIGHT_LC_SRV 0x130f
323#define BT_MESH_MODEL_ID_LIGHT_LC_SETUPSRV 0x1310
325#define BT_MESH_MODEL_ID_LIGHT_LC_CLI 0x1311
335#define BT_MESH_MODEL_ID_BLOB_SRV 0x1400
337#define BT_MESH_MODEL_ID_BLOB_CLI 0x1401
347#define BT_MESH_MODEL_ID_DFU_SRV 0x1402
349#define BT_MESH_MODEL_ID_DFU_CLI 0x1403
351#define BT_MESH_MODEL_ID_DFD_SRV 0x1404
353#define BT_MESH_MODEL_ID_DFD_CLI 0x1405
362
370
380 int (*const func)(const struct bt_mesh_model *model,
381 struct bt_mesh_msg_ctx *ctx,
382 struct net_buf_simple *buf);
383};
384
385#define BT_MESH_MODEL_OP_1(b0) (b0)
386#define BT_MESH_MODEL_OP_2(b0, b1) (((b0) << 8) | (b1))
387#define BT_MESH_MODEL_OP_3(b0, cid) ((((b0) << 16) | 0xc00000) | (cid))
388
390#define BT_MESH_LEN_EXACT(len) (-len)
392#define BT_MESH_LEN_MIN(len) (len)
393
395#define BT_MESH_MODEL_OP_END { 0, 0, NULL }
396
397#if !defined(__cplusplus) || defined(__DOXYGEN__)
404#define BT_MESH_MODEL_NO_OPS ((struct bt_mesh_model_op []) \
405 { BT_MESH_MODEL_OP_END })
406
413#define BT_MESH_MODEL_NONE ((const struct bt_mesh_model []){})
414
432#define BT_MESH_MODEL_CNT_CB(_id, _op, _pub, _user_data, _keys, _grps, _cb) \
433{ \
434 .id = (_id), \
435 BT_MESH_MODEL_RUNTIME_INIT(_user_data) \
436 .pub = _pub, \
437 .keys = (uint16_t []) BT_MESH_MODEL_KEYS_UNUSED(_keys), \
438 .keys_cnt = _keys, \
439 .groups = (uint16_t []) BT_MESH_MODEL_GROUPS_UNASSIGNED(_grps), \
440 .groups_cnt = _grps, \
441 BT_MESH_MODEL_UUIDS_UNASSIGNED() \
442 .op = _op, \
443 .cb = _cb, \
444}
445
464#define BT_MESH_MODEL_CNT_VND_CB(_company, _id, _op, _pub, _user_data, _keys, _grps, _cb) \
465{ \
466 .vnd.company = (_company), \
467 .vnd.id = (_id), \
468 BT_MESH_MODEL_RUNTIME_INIT(_user_data) \
469 .op = _op, \
470 .pub = _pub, \
471 .keys = (uint16_t []) BT_MESH_MODEL_KEYS_UNUSED(_keys), \
472 .keys_cnt = _keys, \
473 .groups = (uint16_t []) BT_MESH_MODEL_GROUPS_UNASSIGNED(_grps), \
474 .groups_cnt = _grps, \
475 BT_MESH_MODEL_UUIDS_UNASSIGNED() \
476 .cb = _cb, \
477}
478
491#define BT_MESH_MODEL_CB(_id, _op, _pub, _user_data, _cb) \
492 BT_MESH_MODEL_CNT_CB(_id, _op, _pub, _user_data, \
493 CONFIG_BT_MESH_MODEL_KEY_COUNT, \
494 CONFIG_BT_MESH_MODEL_GROUP_COUNT, _cb)
495
496
512#if defined(CONFIG_BT_MESH_LARGE_COMP_DATA_SRV)
513#define BT_MESH_MODEL_METADATA_CB(_id, _op, _pub, _user_data, _cb, _metadata) \
514{ \
515 .id = (_id), \
516 BT_MESH_MODEL_RUNTIME_INIT(_user_data) \
517 .pub = _pub, \
518 .keys = (uint16_t []) BT_MESH_MODEL_KEYS_UNUSED(CONFIG_BT_MESH_MODEL_KEY_COUNT), \
519 .keys_cnt = CONFIG_BT_MESH_MODEL_KEY_COUNT, \
520 .groups = (uint16_t []) BT_MESH_MODEL_GROUPS_UNASSIGNED(CONFIG_BT_MESH_MODEL_GROUP_COUNT), \
521 .groups_cnt = CONFIG_BT_MESH_MODEL_GROUP_COUNT, \
522 BT_MESH_MODEL_UUIDS_UNASSIGNED() \
523 .op = _op, \
524 .cb = _cb, \
525 .metadata = _metadata, \
526}
527#else
528#define BT_MESH_MODEL_METADATA_CB(_id, _op, _pub, _user_data, _cb, _metadata) \
529 BT_MESH_MODEL_CB(_id, _op, _pub, _user_data, _cb)
530#endif
531
546#define BT_MESH_MODEL_VND_CB(_company, _id, _op, _pub, _user_data, _cb) \
547 BT_MESH_MODEL_CNT_VND_CB(_company, _id, _op, _pub, _user_data, \
548 CONFIG_BT_MESH_MODEL_KEY_COUNT, \
549 CONFIG_BT_MESH_MODEL_GROUP_COUNT, _cb)
550
567#if defined(CONFIG_BT_MESH_LARGE_COMP_DATA_SRV)
568#define BT_MESH_MODEL_VND_METADATA_CB(_company, _id, _op, _pub, _user_data, _cb, _metadata) \
569{ \
570 .vnd.company = (_company), \
571 .vnd.id = (_id), \
572 BT_MESH_MODEL_RUNTIME_INIT(_user_data) \
573 .op = _op, \
574 .pub = _pub, \
575 .keys = (uint16_t []) BT_MESH_MODEL_KEYS_UNUSED(CONFIG_BT_MESH_MODEL_KEY_COUNT), \
576 .keys_cnt = CONFIG_BT_MESH_MODEL_KEY_COUNT, \
577 .groups = (uint16_t []) BT_MESH_MODEL_GROUPS_UNASSIGNED(CONFIG_BT_MESH_MODEL_GROUP_COUNT), \
578 .groups_cnt = CONFIG_BT_MESH_MODEL_GROUP_COUNT, \
579 BT_MESH_MODEL_UUIDS_UNASSIGNED() \
580 .cb = _cb, \
581 .metadata = _metadata, \
582}
583#else
584#define BT_MESH_MODEL_VND_METADATA_CB(_company, _id, _op, _pub, _user_data, _cb, _metadata) \
585 BT_MESH_MODEL_VND_CB(_company, _id, _op, _pub, _user_data, _cb)
586#endif
598#define BT_MESH_MODEL(_id, _op, _pub, _user_data) \
599 BT_MESH_MODEL_CB(_id, _op, _pub, _user_data, NULL)
600
613#define BT_MESH_MODEL_VND(_company, _id, _op, _pub, _user_data) \
614 BT_MESH_MODEL_VND_CB(_company, _id, _op, _pub, _user_data, NULL)
615#endif /* !defined(__cplusplus) || defined(__DOXYGEN__) */
616
627#define BT_MESH_TRANSMIT(count, int_ms) ((count) | (((int_ms / 10) - 1) << 3))
628
636#define BT_MESH_TRANSMIT_COUNT(transmit) (((transmit) & (uint8_t)BIT_MASK(3)))
637
645#define BT_MESH_TRANSMIT_INT(transmit) ((((transmit) >> 3) + 1) * 10)
646
657#define BT_MESH_PUB_TRANSMIT(count, int_ms) BT_MESH_TRANSMIT(count, \
658 (int_ms) / 5)
659
667#define BT_MESH_PUB_TRANSMIT_COUNT(transmit) BT_MESH_TRANSMIT_COUNT(transmit)
668
676#define BT_MESH_PUB_TRANSMIT_INT(transmit) ((((transmit) >> 3) + 1) * 50)
677
686#define BT_MESH_PUB_MSG_TOTAL(pub) (BT_MESH_PUB_TRANSMIT_COUNT((pub)->retransmit) + 1)
687
697#define BT_MESH_PUB_MSG_NUM(pub) (BT_MESH_PUB_TRANSMIT_COUNT((pub)->retransmit) + 1 - (pub)->count)
698
758
766#define BT_MESH_MODEL_PUB_DEFINE(_name, _update, _msg_len) \
767 NET_BUF_SIMPLE_DEFINE_STATIC(bt_mesh_pub_msg_##_name, _msg_len); \
768 static struct bt_mesh_model_pub _name = { \
769 .msg = &bt_mesh_pub_msg_##_name, \
770 .update = _update, \
771 }
772
779 /* Length of the metadata */
781
782 /* ID of the metadata */
784
785 /* Pointer to raw data */
786 const void * const data;
787};
788
797#define BT_MESH_MODELS_METADATA_ENTRY(_len, _id, _data) \
798 { \
799 .len = (_len), .id = _id, .data = _data, \
800 }
801
803#define BT_MESH_MODELS_METADATA_NONE NULL
804
806#define BT_MESH_MODELS_METADATA_END { 0, 0, NULL }
807
823 int (*const settings_set)(const struct bt_mesh_model *model,
824 const char *name, size_t len_rd,
825 settings_read_cb read_cb, void *cb_arg);
826
839 int (*const start)(const struct bt_mesh_model *model);
840
853 int (*const init)(const struct bt_mesh_model *model);
854
865 void (*const reset)(const struct bt_mesh_model *model);
866
875 void (*const pending_store)(const struct bt_mesh_model *model);
876};
877
885
888 union {
893 };
894
895 /* Model runtime information */
897 uint8_t elem_idx; /* Belongs to Nth element */
898 uint8_t mod_idx; /* Is the Nth model in the element */
899 uint16_t flags; /* Model flags for internal bookkeeping */
900
901#ifdef CONFIG_BT_MESH_MODEL_EXTENSIONS
902 /* Pointer to the next model in a model extension list. */
903 const struct bt_mesh_model *next;
904#endif
907 } * const rt;
908
910 struct bt_mesh_model_pub * const pub;
911
913 uint16_t * const keys;
915
919
920#if (CONFIG_BT_MESH_LABEL_COUNT > 0) || defined(__DOXYGEN__)
922 const uint8_t ** const uuids;
923#endif
924
926 const struct bt_mesh_model_op * const op;
927
929 const struct bt_mesh_model_cb * const cb;
930
931#if defined(CONFIG_BT_MESH_LARGE_COMP_DATA_SRV) || defined(__DOXYGEN__)
932 /* Pointer to the array of model metadata entries. */
934#endif
935};
936
945 void (*start)(uint16_t duration, int err, void *cb_data);
951 void (*end)(int err, void *cb_data);
952};
953
954
956#define BT_MESH_TTL_DEFAULT 0xff
957
959#define BT_MESH_TTL_MAX 0x7f
960
971int bt_mesh_model_send(const struct bt_mesh_model *model,
972 struct bt_mesh_msg_ctx *ctx,
973 struct net_buf_simple *msg,
974 const struct bt_mesh_send_cb *cb,
975 void *cb_data);
976
990int bt_mesh_model_publish(const struct bt_mesh_model *model);
991
1000static inline bool bt_mesh_model_pub_is_retransmission(const struct bt_mesh_model *model)
1001{
1002 return model->pub->count != BT_MESH_PUB_TRANSMIT_COUNT(model->pub->retransmit);
1003}
1004
1011const struct bt_mesh_elem *bt_mesh_model_elem(const struct bt_mesh_model *mod);
1012
1021const struct bt_mesh_model *bt_mesh_model_find(const struct bt_mesh_elem *elem,
1022 uint16_t id);
1023
1033const struct bt_mesh_model *bt_mesh_model_find_vnd(const struct bt_mesh_elem *elem,
1034 uint16_t company, uint16_t id);
1035
1042static inline bool bt_mesh_model_in_primary(const struct bt_mesh_model *mod)
1043{
1044 return (mod->rt->elem_idx == 0);
1045}
1046
1058int bt_mesh_model_data_store(const struct bt_mesh_model *mod, bool vnd,
1059 const char *name, const void *data,
1060 size_t data_len);
1061
1074
1098int bt_mesh_model_extend(const struct bt_mesh_model *extending_mod,
1099 const struct bt_mesh_model *base_mod);
1100
1121int bt_mesh_model_correspond(const struct bt_mesh_model *corresponding_mod,
1122 const struct bt_mesh_model *base_mod);
1123
1131
1140
1149
1159
1182
1189};
1190
1203int bt_mesh_comp2_register(const struct bt_mesh_comp2 *comp2);
1204
1205#ifdef __cplusplus
1206}
1207#endif
1208
1213#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_ACCESS_H_ */
int bt_mesh_model_correspond(const struct bt_mesh_model *corresponding_mod, const struct bt_mesh_model *base_mod)
Let a model correspond to another.
int bt_mesh_model_publish(const struct bt_mesh_model *model)
Send a model publication message.
bool bt_mesh_model_is_extended(const struct bt_mesh_model *model)
Check if model is extended by another model.
#define BT_MESH_PUB_TRANSMIT_COUNT(transmit)
Decode Publish Retransmit count from a given value.
Definition access.h:667
static bool bt_mesh_model_pub_is_retransmission(const struct bt_mesh_model *model)
Check if a message is being retransmitted.
Definition access.h:1000
int bt_mesh_models_metadata_change_prepare(void)
Indicate that the metadata will change on next bootup.
void bt_mesh_model_data_store_schedule(const struct bt_mesh_model *mod)
Schedule the model's user data store in persistent storage.
int bt_mesh_model_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *msg, const struct bt_mesh_send_cb *cb, void *cb_data)
Send an Access Layer message.
int bt_mesh_comp2_register(const struct bt_mesh_comp2 *comp2)
Register composition data page 2 of the device.
int bt_mesh_comp_change_prepare(void)
Indicate that the composition data will change on next bootup.
const struct bt_mesh_elem * bt_mesh_model_elem(const struct bt_mesh_model *mod)
Get the element that a model belongs to.
static bool bt_mesh_model_in_primary(const struct bt_mesh_model *mod)
Get whether the model is in the primary element of the device.
Definition access.h:1042
const struct bt_mesh_model * bt_mesh_model_find_vnd(const struct bt_mesh_elem *elem, uint16_t company, uint16_t id)
Find a vendor model.
int bt_mesh_model_data_store(const struct bt_mesh_model *mod, bool vnd, const char *name, const void *data, size_t data_len)
Immediately store the model's user data in persistent storage.
const struct bt_mesh_model * bt_mesh_model_find(const struct bt_mesh_elem *elem, uint16_t id)
Find a SIG model.
int bt_mesh_model_extend(const struct bt_mesh_model *extending_mod, const struct bt_mesh_model *base_mod)
Let a model extend another.
ssize_t(* settings_read_cb)(void *cb_arg, void *data, size_t len)
Function used to read the data from the settings storage in h_set handler implementations.
Definition settings.h:61
__SIZE_TYPE__ ssize_t
Definition types.h:28
Message APIs.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Composition data page 2 record.
Definition access.h:1161
uint16_t id
Mesh profile ID.
Definition access.h:1163
uint8_t y
Minor version.
Definition access.h:1169
uint8_t x
Major version.
Definition access.h:1167
const uint8_t * elem_offset
Element offset list.
Definition access.h:1176
struct bt_mesh_comp2_record::@94 version
Mesh Profile Version.
uint16_t data_len
Length of additional data.
Definition access.h:1178
uint8_t z
Z version.
Definition access.h:1171
const void * data
Additional data.
Definition access.h:1180
uint8_t elem_offset_cnt
Element offset count.
Definition access.h:1174
Node Composition data page 2.
Definition access.h:1184
size_t record_cnt
The number of Mesh Profile records on a device.
Definition access.h:1186
const struct bt_mesh_comp2_record * record
List of records.
Definition access.h:1188
Node Composition.
Definition access.h:1151
uint16_t pid
Product ID.
Definition access.h:1153
uint16_t cid
Company ID.
Definition access.h:1152
uint16_t vid
Version ID.
Definition access.h:1154
const struct bt_mesh_elem * elem
List of elements.
Definition access.h:1157
size_t elem_count
The number of elements in this device.
Definition access.h:1156
Mesh Element runtime information.
Definition access.h:156
uint16_t addr
Unicast Address.
Definition access.h:158
Abstraction that describes a Mesh Element.
Definition access.h:154
struct bt_mesh_elem::bt_mesh_elem_rt_ctx rt
const struct bt_mesh_model *const models
The list of SIG models in this element.
Definition access.h:169
const uint16_t loc
Location Descriptor (GATT Bluetooth Namespace Descriptors)
Definition access.h:162
const uint8_t model_count
The number of SIG models in this element.
Definition access.h:164
const struct bt_mesh_model *const vnd_models
The list of vendor models in this element.
Definition access.h:171
const uint8_t vnd_model_count
The number of vendor models in this element.
Definition access.h:166
Vendor model ID.
Definition access.h:879
uint16_t company
Vendor's company ID.
Definition access.h:881
uint16_t id
Model ID.
Definition access.h:883
const struct bt_mesh_model * next
Definition access.h:903
void * user_data
Model-specific user data.
Definition access.h:906
uint8_t mod_idx
Definition access.h:898
uint16_t flags
Definition access.h:899
uint8_t elem_idx
Definition access.h:897
Model callback functions.
Definition access.h:809
int(*const init)(const struct bt_mesh_model *model)
Model init callback.
Definition access.h:853
int(*const settings_set)(const struct bt_mesh_model *model, const char *name, size_t len_rd, settings_read_cb read_cb, void *cb_arg)
Set value handler of user data tied to the model.
Definition access.h:823
void(*const reset)(const struct bt_mesh_model *model)
Model reset callback.
Definition access.h:865
int(*const start)(const struct bt_mesh_model *model)
Callback called when the mesh is started.
Definition access.h:839
void(*const pending_store)(const struct bt_mesh_model *model)
Callback used to store pending model's user data.
Definition access.h:875
Model opcode handler.
Definition access.h:359
const uint32_t opcode
OpCode encoded using the BT_MESH_MODEL_OP_* macros.
Definition access.h:361
const ssize_t len
Message length.
Definition access.h:369
int(*const func)(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf)
Handler function for this opcode.
Definition access.h:380
Model publication context.
Definition access.h:704
int(* update)(const struct bt_mesh_model *mod)
Callback for updating the publication buffer.
Definition access.h:753
uint16_t key
Publish AppKey Index.
Definition access.h:710
uint16_t retr_update
Call update callback on every retransmission.
Definition access.h:714
uint8_t delayable
Use random delay for publishing.
Definition access.h:722
uint16_t cred
Friendship Credentials Flag.
Definition access.h:711
uint8_t retransmit
Retransmit Count & Interval Steps.
Definition access.h:717
uint16_t addr
Publish Address.
Definition access.h:708
uint8_t count
Transmissions left.
Definition access.h:720
uint8_t period_div
Divisor for the Period.
Definition access.h:719
struct net_buf_simple * msg
Publication buffer, containing the publication message.
Definition access.h:733
uint8_t ttl
Publish Time to Live.
Definition access.h:716
const struct bt_mesh_model * mod
The model the context belongs to.
Definition access.h:706
uint32_t period_start
Start of the current period.
Definition access.h:724
uint16_t send_rel
Force reliable sending (segment acks)
Definition access.h:712
uint16_t fast_period
Use FastPeriodDivisor.
Definition access.h:713
const uint8_t * uuid
Label UUID if Publish Address is Virtual Address.
Definition access.h:709
uint8_t period
Publish Period.
Definition access.h:718
struct k_work_delayable timer
Publish Period Timer.
Definition access.h:756
Abstraction that describes a Mesh Model instance.
Definition access.h:887
const uint8_t **const uuids
List of Label UUIDs the model is subscribed to.
Definition access.h:922
const struct bt_mesh_mod_id_vnd vnd
Vendor model ID.
Definition access.h:892
struct bt_mesh_model::bt_mesh_model_rt_ctx rt
uint16_t *const groups
Subscription List (group or virtual addresses)
Definition access.h:917
const struct bt_mesh_model_op *const op
Opcode handler list.
Definition access.h:926
uint16_t *const keys
AppKey List.
Definition access.h:913
const struct bt_mesh_model_cb *const cb
Model callback structure.
Definition access.h:929
const uint16_t keys_cnt
Definition access.h:914
const uint16_t id
SIG model ID.
Definition access.h:890
const uint16_t groups_cnt
Definition access.h:918
struct bt_mesh_model_pub *const pub
Model Publication.
Definition access.h:910
const struct bt_mesh_models_metadata_entry *const metadata
Definition access.h:933
Models Metadata Entry struct.
Definition access.h:778
const uint16_t len
Definition access.h:780
const void *const data
Definition access.h:786
const uint16_t id
Definition access.h:783
Message sending context.
Definition msg.h:76
Callback structure for monitoring model message sending.
Definition access.h:938
void(* start)(uint16_t duration, int err, void *cb_data)
Handler called at the start of the transmission.
Definition access.h:945
void(* end)(int err, void *cb_data)
Handler called at the end of the transmission.
Definition access.h:951
A structure used to submit work after a delay.
Definition kernel.h:3908
Simple network buffer representation.
Definition buf.h:87
static fdata_t data[2]
Definition test_fifo_contexts.c:15
static void msg(uint64_t c64)
Definition main.c:17
Misc utilities.