Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Access layer. More...

Data Structures

struct  bt_mesh_elem
 Abstraction that describes a Mesh Element. More...
 
struct  bt_mesh_model_op
 Model opcode handler. More...
 
struct  bt_mesh_model_pub
 Model publication context. More...
 
struct  bt_mesh_models_metadata_entry
 Models Metadata Entry struct. More...
 
struct  bt_mesh_model_cb
 Model callback functions. More...
 
struct  bt_mesh_mod_id_vnd
 Vendor model ID. More...
 
struct  bt_mesh_model
 Abstraction that describes a Mesh Model instance. More...
 
struct  bt_mesh_send_cb
 Callback structure for monitoring model message sending. More...
 
struct  bt_mesh_comp
 Node Composition. More...
 
struct  bt_mesh_comp2_record
 Composition data page 2 record. More...
 
struct  bt_mesh_comp2
 Node Composition data page 2. More...
 

Macros

#define BT_MESH_ADDR_IS_UNICAST(addr)   ((addr) && (addr) < 0x8000)
 Check if a Bluetooth Mesh address is a unicast address.
 
#define BT_MESH_ADDR_IS_GROUP(addr)   ((addr) >= 0xc000 && (addr) < 0xff00)
 Check if a Bluetooth Mesh address is a group address.
 
#define BT_MESH_ADDR_IS_FIXED_GROUP(addr)   ((addr) >= 0xff00 && (addr) < 0xffff)
 Check if a Bluetooth Mesh address is a fixed group address.
 
#define BT_MESH_ADDR_IS_VIRTUAL(addr)   ((addr) >= 0x8000 && (addr) < 0xc000)
 Check if a Bluetooth Mesh address is a virtual address.
 
#define BT_MESH_ADDR_IS_RFU(addr)   ((addr) >= 0xff00 && (addr) <= 0xfff8)
 Check if a Bluetooth Mesh address is an RFU address.
 
#define BT_MESH_IS_DEV_KEY(key)
 Check if a Bluetooth Mesh key is a device key.
 
#define BT_MESH_APP_SEG_SDU_MAX   12
 Maximum size of an access message segment (in octets).
 
#define BT_MESH_APP_UNSEG_SDU_MAX   15
 Maximum payload size of an unsegmented access message (in octets).
 
#define BT_MESH_RX_SEG_MAX   0
 Maximum number of segments supported for incoming messages.
 
#define BT_MESH_TX_SEG_MAX   0
 Maximum number of segments supported for outgoing messages.
 
#define BT_MESH_TX_SDU_MAX
 Maximum possible payload size of an outgoing access message (in octets).
 
#define BT_MESH_RX_SDU_MAX
 Maximum possible payload size of an incoming access message (in octets).
 
#define BT_MESH_ELEM(_loc, _mods, _vnd_mods)
 Helper to define a mesh element within an array.
 
#define BT_MESH_MODEL_OP_1(b0)   (b0)
 
#define BT_MESH_MODEL_OP_2(b0, b1)   (((b0) << 8) | (b1))
 
#define BT_MESH_MODEL_OP_3(b0, cid)   ((((b0) << 16) | 0xc00000) | (cid))
 
#define BT_MESH_LEN_EXACT(len)   (-len)
 Macro for encoding exact message length for fixed-length messages.
 
#define BT_MESH_LEN_MIN(len)   (len)
 Macro for encoding minimum message length for variable-length messages.
 
#define BT_MESH_MODEL_OP_END   { 0, 0, NULL }
 End of the opcode list.
 
#define BT_MESH_MODEL_NO_OPS
 Helper to define an empty opcode list.
 
#define BT_MESH_MODEL_NONE   ((const struct bt_mesh_model []){})
 Helper to define an empty model array.
 
#define BT_MESH_MODEL_CNT_CB(_id, _op, _pub, _user_data, _keys, _grps, _cb)
 Composition data SIG model entry with callback functions with specific number of keys & groups.
 
#define BT_MESH_MODEL_CNT_VND_CB(_company, _id, _op, _pub, _user_data, _keys, _grps, _cb)
 Composition data vendor model entry with callback functions with specific number of keys & groups.
 
#define BT_MESH_MODEL_CB(_id, _op, _pub, _user_data, _cb)
 Composition data SIG model entry with callback functions.
 
#define BT_MESH_MODEL_METADATA_CB(_id, _op, _pub, _user_data, _cb, _metadata)    BT_MESH_MODEL_CB(_id, _op, _pub, _user_data, _cb)
 Composition data SIG model entry with callback functions and metadata.
 
#define BT_MESH_MODEL_VND_CB(_company, _id, _op, _pub, _user_data, _cb)
 Composition data vendor model entry with callback functions.
 
#define BT_MESH_MODEL_VND_METADATA_CB(_company, _id, _op, _pub, _user_data, _cb, _metadata)    BT_MESH_MODEL_VND_CB(_company, _id, _op, _pub, _user_data, _cb)
 Composition data vendor model entry with callback functions and metadata.
 
#define BT_MESH_MODEL(_id, _op, _pub, _user_data)    BT_MESH_MODEL_CB(_id, _op, _pub, _user_data, NULL)
 Composition data SIG model entry.
 
#define BT_MESH_MODEL_VND(_company, _id, _op, _pub, _user_data)    BT_MESH_MODEL_VND_CB(_company, _id, _op, _pub, _user_data, NULL)
 Composition data vendor model entry.
 
#define BT_MESH_TRANSMIT(count, int_ms)   ((count) | (((int_ms / 10) - 1) << 3))
 Encode transmission count & interval steps.
 
#define BT_MESH_TRANSMIT_COUNT(transmit)   (((transmit) & (uint8_t)BIT_MASK(3)))
 Decode transmit count from a transmit value.
 
#define BT_MESH_TRANSMIT_INT(transmit)   ((((transmit) >> 3) + 1) * 10)
 Decode transmit interval from a transmit value.
 
#define BT_MESH_PUB_TRANSMIT(count, int_ms)
 Encode Publish Retransmit count & interval steps.
 
#define BT_MESH_PUB_TRANSMIT_COUNT(transmit)   BT_MESH_TRANSMIT_COUNT(transmit)
 Decode Publish Retransmit count from a given value.
 
#define BT_MESH_PUB_TRANSMIT_INT(transmit)   ((((transmit) >> 3) + 1) * 50)
 Decode Publish Retransmit interval from a given value.
 
#define BT_MESH_PUB_MSG_TOTAL(pub)   (BT_MESH_PUB_TRANSMIT_COUNT((pub)->retransmit) + 1)
 Get total number of messages within one publication interval including initial publication.
 
#define BT_MESH_PUB_MSG_NUM(pub)   (BT_MESH_PUB_TRANSMIT_COUNT((pub)->retransmit) + 1 - (pub)->count)
 Get message number within one publication interval.
 
#define BT_MESH_MODEL_PUB_DEFINE(_name, _update, _msg_len)
 Define a model publication context.
 
#define BT_MESH_MODELS_METADATA_ENTRY(_len, _id, _data)
 Initialize a Models Metadata entry structure in a list.
 
#define BT_MESH_MODELS_METADATA_NONE   NULL
 Helper to define an empty Models metadata array.
 
#define BT_MESH_MODELS_METADATA_END   { 0, 0, NULL }
 End of the Models Metadata list.
 
#define BT_MESH_TTL_DEFAULT   0xff
 Special TTL value to request using configured default TTL.
 
#define BT_MESH_TTL_MAX   0x7f
 Maximum allowed TTL value.
 

Functions

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_model_publish (const struct bt_mesh_model *model)
 Send a model publication message.
 
static bool bt_mesh_model_pub_is_retransmission (const struct bt_mesh_model *model)
 Check if a message is being retransmitted.
 
const struct bt_mesh_elembt_mesh_model_elem (const struct bt_mesh_model *mod)
 Get the element that a model belongs to.
 
const struct bt_mesh_modelbt_mesh_model_find (const struct bt_mesh_elem *elem, uint16_t id)
 Find a SIG model.
 
const struct bt_mesh_modelbt_mesh_model_find_vnd (const struct bt_mesh_elem *elem, uint16_t company, uint16_t id)
 Find a vendor model.
 
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.
 
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.
 
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_extend (const struct bt_mesh_model *extending_mod, const struct bt_mesh_model *base_mod)
 Let a model extend another.
 
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.
 
bool bt_mesh_model_is_extended (const struct bt_mesh_model *model)
 Check if model is extended by another model.
 
int bt_mesh_comp_change_prepare (void)
 Indicate that the composition data will change on next bootup.
 
int bt_mesh_models_metadata_change_prepare (void)
 Indicate that the metadata will change on next bootup.
 
int bt_mesh_comp2_register (const struct bt_mesh_comp2 *comp2)
 Register composition data page 2 of the device.
 

Group addresses

#define BT_MESH_ADDR_UNASSIGNED   0x0000
 unassigned
 
#define BT_MESH_ADDR_ALL_NODES   0xffff
 all-nodes
 
#define BT_MESH_ADDR_RELAYS   0xfffe
 all-relays
 
#define BT_MESH_ADDR_FRIENDS   0xfffd
 all-friends
 
#define BT_MESH_ADDR_PROXIES   0xfffc
 all-proxies
 
#define BT_MESH_ADDR_DFW_NODES   0xfffb
 all-directed-forwarding-nodes
 
#define BT_MESH_ADDR_IP_NODES   0xfffa
 all-ipt-nodes
 
#define BT_MESH_ADDR_IP_BR_ROUTERS   0xfff9
 all-ipt-border-routers
 

Predefined key indexes

#define BT_MESH_KEY_UNUSED   0xffff
 Key unused.
 
#define BT_MESH_KEY_ANY   0xffff
 Any key index.
 
#define BT_MESH_KEY_DEV   0xfffe
 Device key.
 
#define BT_MESH_KEY_DEV_LOCAL   BT_MESH_KEY_DEV
 Local device key.
 
#define BT_MESH_KEY_DEV_REMOTE   0xfffd
 Remote device key.
 
#define BT_MESH_KEY_DEV_ANY   0xfffc
 Any device key.
 

Foundation Models

#define BT_MESH_MODEL_ID_CFG_SRV   0x0000
 Configuration Server.
 
#define BT_MESH_MODEL_ID_CFG_CLI   0x0001
 Configuration Client.
 
#define BT_MESH_MODEL_ID_HEALTH_SRV   0x0002
 Health Server.
 
#define BT_MESH_MODEL_ID_HEALTH_CLI   0x0003
 Health Client.
 
#define BT_MESH_MODEL_ID_REMOTE_PROV_SRV   0x0004
 Remote Provisioning Server.
 
#define BT_MESH_MODEL_ID_REMOTE_PROV_CLI   0x0005
 Remote Provisioning Client.
 
#define BT_MESH_MODEL_ID_PRIV_BEACON_SRV   0x000a
 Private Beacon Server.
 
#define BT_MESH_MODEL_ID_PRIV_BEACON_CLI   0x000b
 Private Beacon Client.
 
#define BT_MESH_MODEL_ID_SAR_CFG_SRV   0x000e
 SAR Configuration Server.
 
#define BT_MESH_MODEL_ID_SAR_CFG_CLI   0x000f
 SAR Configuration Client.
 
#define BT_MESH_MODEL_ID_OP_AGG_SRV   0x0010
 Opcodes Aggregator Server.
 
#define BT_MESH_MODEL_ID_OP_AGG_CLI   0x0011
 Opcodes Aggregator Client.
 
#define BT_MESH_MODEL_ID_LARGE_COMP_DATA_SRV   0x0012
 Large Composition Data Server.
 
#define BT_MESH_MODEL_ID_LARGE_COMP_DATA_CLI   0x0013
 Large Composition Data Client.
 
#define BT_MESH_MODEL_ID_SOL_PDU_RPL_SRV   0x0014
 Solicitation PDU RPL Configuration Client.
 
#define BT_MESH_MODEL_ID_SOL_PDU_RPL_CLI   0x0015
 Solicitation PDU RPL Configuration Server.
 
#define BT_MESH_MODEL_ID_ON_DEMAND_PROXY_SRV   0x000c
 Private Proxy Server.
 
#define BT_MESH_MODEL_ID_ON_DEMAND_PROXY_CLI   0x000d
 Private Proxy Client.
 

Models from the Mesh Model Specification

#define BT_MESH_MODEL_ID_GEN_ONOFF_SRV   0x1000
 Generic OnOff Server.
 
#define BT_MESH_MODEL_ID_GEN_ONOFF_CLI   0x1001
 Generic OnOff Client.
 
#define BT_MESH_MODEL_ID_GEN_LEVEL_SRV   0x1002
 Generic Level Server.
 
#define BT_MESH_MODEL_ID_GEN_LEVEL_CLI   0x1003
 Generic Level Client.
 
#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV   0x1004
 Generic Default Transition Time Server.
 
#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI   0x1005
 Generic Default Transition Time Client.
 
#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV   0x1006
 Generic Power OnOff Server.
 
#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV   0x1007
 Generic Power OnOff Setup Server.
 
#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI   0x1008
 Generic Power OnOff Client.
 
#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV   0x1009
 Generic Power Level Server.
 
#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV   0x100a
 Generic Power Level Setup Server.
 
#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI   0x100b
 Generic Power Level Client.
 
#define BT_MESH_MODEL_ID_GEN_BATTERY_SRV   0x100c
 Generic Battery Server.
 
#define BT_MESH_MODEL_ID_GEN_BATTERY_CLI   0x100d
 Generic Battery Client.
 
#define BT_MESH_MODEL_ID_GEN_LOCATION_SRV   0x100e
 Generic Location Server.
 
#define BT_MESH_MODEL_ID_GEN_LOCATION_SETUPSRV   0x100f
 Generic Location Setup Server.
 
#define BT_MESH_MODEL_ID_GEN_LOCATION_CLI   0x1010
 Generic Location Client.
 
#define BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV   0x1011
 Generic Admin Property Server.
 
#define BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV   0x1012
 Generic Manufacturer Property Server.
 
#define BT_MESH_MODEL_ID_GEN_USER_PROP_SRV   0x1013
 Generic User Property Server.
 
#define BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV   0x1014
 Generic Client Property Server.
 
#define BT_MESH_MODEL_ID_GEN_PROP_CLI   0x1015
 Generic Property Client.
 
#define BT_MESH_MODEL_ID_SENSOR_SRV   0x1100
 Sensor Server.
 
#define BT_MESH_MODEL_ID_SENSOR_SETUP_SRV   0x1101
 Sensor Setup Server.
 
#define BT_MESH_MODEL_ID_SENSOR_CLI   0x1102
 Sensor Client.
 
#define BT_MESH_MODEL_ID_TIME_SRV   0x1200
 Time Server.
 
#define BT_MESH_MODEL_ID_TIME_SETUP_SRV   0x1201
 Time Setup Server.
 
#define BT_MESH_MODEL_ID_TIME_CLI   0x1202
 Time Client.
 
#define BT_MESH_MODEL_ID_SCENE_SRV   0x1203
 Scene Server.
 
#define BT_MESH_MODEL_ID_SCENE_SETUP_SRV   0x1204
 Scene Setup Server.
 
#define BT_MESH_MODEL_ID_SCENE_CLI   0x1205
 Scene Client.
 
#define BT_MESH_MODEL_ID_SCHEDULER_SRV   0x1206
 Scheduler Server.
 
#define BT_MESH_MODEL_ID_SCHEDULER_SETUP_SRV   0x1207
 Scheduler Setup Server.
 
#define BT_MESH_MODEL_ID_SCHEDULER_CLI   0x1208
 Scheduler Client.
 
#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV   0x1300
 Light Lightness Server.
 
#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV   0x1301
 Light Lightness Setup Server.
 
#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI   0x1302
 Light Lightness Client.
 
#define BT_MESH_MODEL_ID_LIGHT_CTL_SRV   0x1303
 Light CTL Server.
 
#define BT_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV   0x1304
 Light CTL Setup Server.
 
#define BT_MESH_MODEL_ID_LIGHT_CTL_CLI   0x1305
 Light CTL Client.
 
#define BT_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV   0x1306
 Light CTL Temperature Server.
 
#define BT_MESH_MODEL_ID_LIGHT_HSL_SRV   0x1307
 Light HSL Server.
 
#define BT_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV   0x1308
 Light HSL Setup Server.
 
#define BT_MESH_MODEL_ID_LIGHT_HSL_CLI   0x1309
 Light HSL Client.
 
#define BT_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV   0x130a
 Light HSL Hue Server.
 
#define BT_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV   0x130b
 Light HSL Saturation Server.
 
#define BT_MESH_MODEL_ID_LIGHT_XYL_SRV   0x130c
 Light xyL Server.
 
#define BT_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV   0x130d
 Light xyL Setup Server.
 
#define BT_MESH_MODEL_ID_LIGHT_XYL_CLI   0x130e
 Light xyL Client.
 
#define BT_MESH_MODEL_ID_LIGHT_LC_SRV   0x130f
 Light LC Server.
 
#define BT_MESH_MODEL_ID_LIGHT_LC_SETUPSRV   0x1310
 Light LC Setup Server.
 
#define BT_MESH_MODEL_ID_LIGHT_LC_CLI   0x1311
 Light LC Client.
 

Models from the Mesh Binary Large Object Transfer Model Specification

#define BT_MESH_MODEL_ID_BLOB_SRV   0x1400
 BLOB Transfer Server.
 
#define BT_MESH_MODEL_ID_BLOB_CLI   0x1401
 BLOB Transfer Client.
 

Models from the Mesh Device Firmware Update Model Specification

#define BT_MESH_MODEL_ID_DFU_SRV   0x1402
 Firmware Update Server.
 
#define BT_MESH_MODEL_ID_DFU_CLI   0x1403
 Firmware Update Client.
 
#define BT_MESH_MODEL_ID_DFD_SRV   0x1404
 Firmware Distribution Server.
 
#define BT_MESH_MODEL_ID_DFD_CLI   0x1405
 Firmware Distribution Client.
 

Detailed Description

Access layer.

Macro Definition Documentation

◆ BT_MESH_ADDR_ALL_NODES

#define BT_MESH_ADDR_ALL_NODES   0xffff

#include <zephyr/bluetooth/mesh/access.h>

all-nodes

◆ BT_MESH_ADDR_DFW_NODES

#define BT_MESH_ADDR_DFW_NODES   0xfffb

#include <zephyr/bluetooth/mesh/access.h>

all-directed-forwarding-nodes

◆ BT_MESH_ADDR_FRIENDS

#define BT_MESH_ADDR_FRIENDS   0xfffd

#include <zephyr/bluetooth/mesh/access.h>

all-friends

◆ BT_MESH_ADDR_IP_BR_ROUTERS

#define BT_MESH_ADDR_IP_BR_ROUTERS   0xfff9

#include <zephyr/bluetooth/mesh/access.h>

all-ipt-border-routers

◆ BT_MESH_ADDR_IP_NODES

#define BT_MESH_ADDR_IP_NODES   0xfffa

#include <zephyr/bluetooth/mesh/access.h>

all-ipt-nodes

◆ BT_MESH_ADDR_IS_FIXED_GROUP

#define BT_MESH_ADDR_IS_FIXED_GROUP (   addr)    ((addr) >= 0xff00 && (addr) < 0xffff)

#include <zephyr/bluetooth/mesh/access.h>

Check if a Bluetooth Mesh address is a fixed group address.

◆ BT_MESH_ADDR_IS_GROUP

#define BT_MESH_ADDR_IS_GROUP (   addr)    ((addr) >= 0xc000 && (addr) < 0xff00)

#include <zephyr/bluetooth/mesh/access.h>

Check if a Bluetooth Mesh address is a group address.

◆ BT_MESH_ADDR_IS_RFU

#define BT_MESH_ADDR_IS_RFU (   addr)    ((addr) >= 0xff00 && (addr) <= 0xfff8)

#include <zephyr/bluetooth/mesh/access.h>

Check if a Bluetooth Mesh address is an RFU address.

◆ BT_MESH_ADDR_IS_UNICAST

#define BT_MESH_ADDR_IS_UNICAST (   addr)    ((addr) && (addr) < 0x8000)

#include <zephyr/bluetooth/mesh/access.h>

Check if a Bluetooth Mesh address is a unicast address.

◆ BT_MESH_ADDR_IS_VIRTUAL

#define BT_MESH_ADDR_IS_VIRTUAL (   addr)    ((addr) >= 0x8000 && (addr) < 0xc000)

#include <zephyr/bluetooth/mesh/access.h>

Check if a Bluetooth Mesh address is a virtual address.

◆ BT_MESH_ADDR_PROXIES

#define BT_MESH_ADDR_PROXIES   0xfffc

#include <zephyr/bluetooth/mesh/access.h>

all-proxies

◆ BT_MESH_ADDR_RELAYS

#define BT_MESH_ADDR_RELAYS   0xfffe

#include <zephyr/bluetooth/mesh/access.h>

all-relays

◆ BT_MESH_ADDR_UNASSIGNED

#define BT_MESH_ADDR_UNASSIGNED   0x0000

#include <zephyr/bluetooth/mesh/access.h>

unassigned

◆ BT_MESH_APP_SEG_SDU_MAX

#define BT_MESH_APP_SEG_SDU_MAX   12

#include <zephyr/bluetooth/mesh/access.h>

Maximum size of an access message segment (in octets).

◆ BT_MESH_APP_UNSEG_SDU_MAX

#define BT_MESH_APP_UNSEG_SDU_MAX   15

#include <zephyr/bluetooth/mesh/access.h>

Maximum payload size of an unsegmented access message (in octets).

◆ BT_MESH_ELEM

#define BT_MESH_ELEM (   _loc,
  _mods,
  _vnd_mods 
)

#include <zephyr/bluetooth/mesh/access.h>

Value:
{ \
.rt = &(struct bt_mesh_elem_rt_ctx) { 0 }, \
.loc = (_loc), \
.model_count = ARRAY_SIZE(_mods), \
.vnd_model_count = ARRAY_SIZE(_vnd_mods), \
.models = (_mods), \
.vnd_models = (_vnd_mods), \
}
#define ARRAY_SIZE(array)
Number of elements in the given array.
Definition: util.h:127

Helper to define a mesh element within an array.

In case the element has no SIG or Vendor models the helper macro BT_MESH_MODEL_NONE can be given instead.

Parameters
_locLocation Descriptor.
_modsArray of models.
_vnd_modsArray of vendor models.

◆ BT_MESH_IS_DEV_KEY

#define BT_MESH_IS_DEV_KEY (   key)

#include <zephyr/bluetooth/mesh/access.h>

Value:
(key == BT_MESH_KEY_DEV_LOCAL || \
#define BT_MESH_KEY_DEV_LOCAL
Local device key.
Definition: access.h:70
#define BT_MESH_KEY_DEV_REMOTE
Remote device key.
Definition: access.h:71

Check if a Bluetooth Mesh key is a device key.

◆ BT_MESH_KEY_ANY

#define BT_MESH_KEY_ANY   0xffff

#include <zephyr/bluetooth/mesh/access.h>

Any key index.

◆ BT_MESH_KEY_DEV

#define BT_MESH_KEY_DEV   0xfffe

#include <zephyr/bluetooth/mesh/access.h>

Device key.

◆ BT_MESH_KEY_DEV_ANY

#define BT_MESH_KEY_DEV_ANY   0xfffc

#include <zephyr/bluetooth/mesh/access.h>

Any device key.

◆ BT_MESH_KEY_DEV_LOCAL

#define BT_MESH_KEY_DEV_LOCAL   BT_MESH_KEY_DEV

#include <zephyr/bluetooth/mesh/access.h>

Local device key.

◆ BT_MESH_KEY_DEV_REMOTE

#define BT_MESH_KEY_DEV_REMOTE   0xfffd

#include <zephyr/bluetooth/mesh/access.h>

Remote device key.

◆ BT_MESH_KEY_UNUSED

#define BT_MESH_KEY_UNUSED   0xffff

#include <zephyr/bluetooth/mesh/access.h>

Key unused.

◆ BT_MESH_LEN_EXACT

#define BT_MESH_LEN_EXACT (   len)    (-len)

#include <zephyr/bluetooth/mesh/access.h>

Macro for encoding exact message length for fixed-length messages.


◆ BT_MESH_LEN_MIN

#define BT_MESH_LEN_MIN (   len)    (len)

#include <zephyr/bluetooth/mesh/access.h>

Macro for encoding minimum message length for variable-length messages.


◆ BT_MESH_MODEL

#define BT_MESH_MODEL (   _id,
  _op,
  _pub,
  _user_data 
)     BT_MESH_MODEL_CB(_id, _op, _pub, _user_data, NULL)

#include <zephyr/bluetooth/mesh/access.h>

Composition data SIG model entry.

This macro uses compound literal feature of C99 standard and thus is available only from C, not C++.

Parameters
_idModel ID.
_opArray of model opcode handlers.
_pubModel publish parameters.
_user_dataUser data for the model.

◆ BT_MESH_MODEL_CB

#define BT_MESH_MODEL_CB (   _id,
  _op,
  _pub,
  _user_data,
  _cb 
)

#include <zephyr/bluetooth/mesh/access.h>

Value:
BT_MESH_MODEL_CNT_CB(_id, _op, _pub, _user_data, \
CONFIG_BT_MESH_MODEL_KEY_COUNT, \
CONFIG_BT_MESH_MODEL_GROUP_COUNT, _cb)
#define BT_MESH_MODEL_CNT_CB(_id, _op, _pub, _user_data, _keys, _grps, _cb)
Composition data SIG model entry with callback functions with specific number of keys & groups.
Definition: access.h:432

Composition data SIG model entry with callback functions.

This macro uses compound literal feature of C99 standard and thus is available only from C, not C++.

Parameters
_idModel ID.
_opArray of model opcode handlers.
_pubModel publish parameters.
_user_dataUser data for the model.
_cbCallback structure, or NULL to keep no callbacks.

◆ BT_MESH_MODEL_CNT_CB

#define BT_MESH_MODEL_CNT_CB (   _id,
  _op,
  _pub,
  _user_data,
  _keys,
  _grps,
  _cb 
)

#include <zephyr/bluetooth/mesh/access.h>

Value:
{ \
.id = (_id), \
.pub = _pub, \
.keys = (uint16_t []) BT_MESH_MODEL_KEYS_UNUSED(_keys), \
.keys_cnt = _keys, \
.groups = (uint16_t []) BT_MESH_MODEL_GROUPS_UNASSIGNED(_grps), \
.groups_cnt = _grps, \
BT_MESH_MODEL_UUIDS_UNASSIGNED() \
.op = _op, \
.cb = _cb, \
}
#define BT_MESH_MODEL_KEYS_UNUSED(_keys)
Definition: access.h:21
#define BT_MESH_MODEL_GROUPS_UNASSIGNED(_grps)
Definition: access.h:23
#define BT_MESH_MODEL_RUNTIME_INIT(_user_data)
Definition: access.h:33
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89

Composition data SIG model entry with callback functions with specific number of keys & groups.

This macro uses compound literal feature of C99 standard and thus is available only from C, not C++.

Parameters
_idModel ID.
_opArray of model opcode handlers.
_pubModel publish parameters.
_user_dataUser data for the model.
_keysNumber of keys that can be bound to the model. Shall not exceed CONFIG_BT_MESH_MODEL_KEY_COUNT .
_grpsNumber of addresses that the model can be subscribed to. Shall not exceed CONFIG_BT_MESH_MODEL_GROUP_COUNT .
_cbCallback structure, or NULL to keep no callbacks.

◆ BT_MESH_MODEL_CNT_VND_CB

#define BT_MESH_MODEL_CNT_VND_CB (   _company,
  _id,
  _op,
  _pub,
  _user_data,
  _keys,
  _grps,
  _cb 
)

#include <zephyr/bluetooth/mesh/access.h>

Value:
{ \
.vnd.company = (_company), \
.vnd.id = (_id), \
BT_MESH_MODEL_RUNTIME_INIT(_user_data) \
.op = _op, \
.pub = _pub, \
.keys = (uint16_t []) BT_MESH_MODEL_KEYS_UNUSED(_keys), \
.keys_cnt = _keys, \
.groups = (uint16_t []) BT_MESH_MODEL_GROUPS_UNASSIGNED(_grps), \
.groups_cnt = _grps, \
BT_MESH_MODEL_UUIDS_UNASSIGNED() \
.cb = _cb, \
}

Composition data vendor model entry with callback functions with specific number of keys & groups.

This macro uses compound literal feature of C99 standard and thus is available only from C, not C++.

Parameters
_companyCompany ID.
_idModel ID.
_opArray of model opcode handlers.
_pubModel publish parameters.
_user_dataUser data for the model.
_keysNumber of keys that can be bound to the model. Shall not exceed CONFIG_BT_MESH_MODEL_KEY_COUNT .
_grpsNumber of addresses that the model can be subscribed to. Shall not exceed CONFIG_BT_MESH_MODEL_GROUP_COUNT .
_cbCallback structure, or NULL to keep no callbacks.

◆ BT_MESH_MODEL_ID_BLOB_CLI

#define BT_MESH_MODEL_ID_BLOB_CLI   0x1401

#include <zephyr/bluetooth/mesh/access.h>

BLOB Transfer Client.

◆ BT_MESH_MODEL_ID_BLOB_SRV

#define BT_MESH_MODEL_ID_BLOB_SRV   0x1400

#include <zephyr/bluetooth/mesh/access.h>

BLOB Transfer Server.

◆ BT_MESH_MODEL_ID_CFG_CLI

#define BT_MESH_MODEL_ID_CFG_CLI   0x0001

#include <zephyr/bluetooth/mesh/access.h>

Configuration Client.

◆ BT_MESH_MODEL_ID_CFG_SRV

#define BT_MESH_MODEL_ID_CFG_SRV   0x0000

#include <zephyr/bluetooth/mesh/access.h>

Configuration Server.

◆ BT_MESH_MODEL_ID_DFD_CLI

#define BT_MESH_MODEL_ID_DFD_CLI   0x1405

#include <zephyr/bluetooth/mesh/access.h>

Firmware Distribution Client.

◆ BT_MESH_MODEL_ID_DFD_SRV

#define BT_MESH_MODEL_ID_DFD_SRV   0x1404

#include <zephyr/bluetooth/mesh/access.h>

Firmware Distribution Server.

◆ BT_MESH_MODEL_ID_DFU_CLI

#define BT_MESH_MODEL_ID_DFU_CLI   0x1403

#include <zephyr/bluetooth/mesh/access.h>

Firmware Update Client.

◆ BT_MESH_MODEL_ID_DFU_SRV

#define BT_MESH_MODEL_ID_DFU_SRV   0x1402

#include <zephyr/bluetooth/mesh/access.h>

Firmware Update Server.

◆ BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV

#define BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV   0x1011

#include <zephyr/bluetooth/mesh/access.h>

Generic Admin Property Server.

◆ BT_MESH_MODEL_ID_GEN_BATTERY_CLI

#define BT_MESH_MODEL_ID_GEN_BATTERY_CLI   0x100d

#include <zephyr/bluetooth/mesh/access.h>

Generic Battery Client.

◆ BT_MESH_MODEL_ID_GEN_BATTERY_SRV

#define BT_MESH_MODEL_ID_GEN_BATTERY_SRV   0x100c

#include <zephyr/bluetooth/mesh/access.h>

Generic Battery Server.

◆ BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV

#define BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV   0x1014

#include <zephyr/bluetooth/mesh/access.h>

Generic Client Property Server.

◆ BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI

#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI   0x1005

#include <zephyr/bluetooth/mesh/access.h>

Generic Default Transition Time Client.

◆ BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV

#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV   0x1004

#include <zephyr/bluetooth/mesh/access.h>

Generic Default Transition Time Server.

◆ BT_MESH_MODEL_ID_GEN_LEVEL_CLI

#define BT_MESH_MODEL_ID_GEN_LEVEL_CLI   0x1003

#include <zephyr/bluetooth/mesh/access.h>

Generic Level Client.

◆ BT_MESH_MODEL_ID_GEN_LEVEL_SRV

#define BT_MESH_MODEL_ID_GEN_LEVEL_SRV   0x1002

#include <zephyr/bluetooth/mesh/access.h>

Generic Level Server.

◆ BT_MESH_MODEL_ID_GEN_LOCATION_CLI

#define BT_MESH_MODEL_ID_GEN_LOCATION_CLI   0x1010

#include <zephyr/bluetooth/mesh/access.h>

Generic Location Client.

◆ BT_MESH_MODEL_ID_GEN_LOCATION_SETUPSRV

#define BT_MESH_MODEL_ID_GEN_LOCATION_SETUPSRV   0x100f

#include <zephyr/bluetooth/mesh/access.h>

Generic Location Setup Server.

◆ BT_MESH_MODEL_ID_GEN_LOCATION_SRV

#define BT_MESH_MODEL_ID_GEN_LOCATION_SRV   0x100e

#include <zephyr/bluetooth/mesh/access.h>

Generic Location Server.

◆ BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV

#define BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV   0x1012

#include <zephyr/bluetooth/mesh/access.h>

Generic Manufacturer Property Server.

◆ BT_MESH_MODEL_ID_GEN_ONOFF_CLI

#define BT_MESH_MODEL_ID_GEN_ONOFF_CLI   0x1001

#include <zephyr/bluetooth/mesh/access.h>

Generic OnOff Client.

◆ BT_MESH_MODEL_ID_GEN_ONOFF_SRV

#define BT_MESH_MODEL_ID_GEN_ONOFF_SRV   0x1000

#include <zephyr/bluetooth/mesh/access.h>

Generic OnOff Server.

◆ BT_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI

#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI   0x100b

#include <zephyr/bluetooth/mesh/access.h>

Generic Power Level Client.

◆ BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV

#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV   0x100a

#include <zephyr/bluetooth/mesh/access.h>

Generic Power Level Setup Server.

◆ BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV

#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV   0x1009

#include <zephyr/bluetooth/mesh/access.h>

Generic Power Level Server.

◆ BT_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI

#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI   0x1008

#include <zephyr/bluetooth/mesh/access.h>

Generic Power OnOff Client.

◆ BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV

#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV   0x1007

#include <zephyr/bluetooth/mesh/access.h>

Generic Power OnOff Setup Server.

◆ BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV

#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV   0x1006

#include <zephyr/bluetooth/mesh/access.h>

Generic Power OnOff Server.

◆ BT_MESH_MODEL_ID_GEN_PROP_CLI

#define BT_MESH_MODEL_ID_GEN_PROP_CLI   0x1015

#include <zephyr/bluetooth/mesh/access.h>

Generic Property Client.

◆ BT_MESH_MODEL_ID_GEN_USER_PROP_SRV

#define BT_MESH_MODEL_ID_GEN_USER_PROP_SRV   0x1013

#include <zephyr/bluetooth/mesh/access.h>

Generic User Property Server.

◆ BT_MESH_MODEL_ID_HEALTH_CLI

#define BT_MESH_MODEL_ID_HEALTH_CLI   0x0003

#include <zephyr/bluetooth/mesh/access.h>

Health Client.

◆ BT_MESH_MODEL_ID_HEALTH_SRV

#define BT_MESH_MODEL_ID_HEALTH_SRV   0x0002

#include <zephyr/bluetooth/mesh/access.h>

Health Server.

◆ BT_MESH_MODEL_ID_LARGE_COMP_DATA_CLI

#define BT_MESH_MODEL_ID_LARGE_COMP_DATA_CLI   0x0013

#include <zephyr/bluetooth/mesh/access.h>

Large Composition Data Client.

◆ BT_MESH_MODEL_ID_LARGE_COMP_DATA_SRV

#define BT_MESH_MODEL_ID_LARGE_COMP_DATA_SRV   0x0012

#include <zephyr/bluetooth/mesh/access.h>

Large Composition Data Server.

◆ BT_MESH_MODEL_ID_LIGHT_CTL_CLI

#define BT_MESH_MODEL_ID_LIGHT_CTL_CLI   0x1305

#include <zephyr/bluetooth/mesh/access.h>

Light CTL Client.

◆ BT_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV

#define BT_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV   0x1304

#include <zephyr/bluetooth/mesh/access.h>

Light CTL Setup Server.

◆ BT_MESH_MODEL_ID_LIGHT_CTL_SRV

#define BT_MESH_MODEL_ID_LIGHT_CTL_SRV   0x1303

#include <zephyr/bluetooth/mesh/access.h>

Light CTL Server.

◆ BT_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV

#define BT_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV   0x1306

#include <zephyr/bluetooth/mesh/access.h>

Light CTL Temperature Server.

◆ BT_MESH_MODEL_ID_LIGHT_HSL_CLI

#define BT_MESH_MODEL_ID_LIGHT_HSL_CLI   0x1309

#include <zephyr/bluetooth/mesh/access.h>

Light HSL Client.

◆ BT_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV

#define BT_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV   0x130a

#include <zephyr/bluetooth/mesh/access.h>

Light HSL Hue Server.

◆ BT_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV

#define BT_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV   0x130b

#include <zephyr/bluetooth/mesh/access.h>

Light HSL Saturation Server.

◆ BT_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV

#define BT_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV   0x1308

#include <zephyr/bluetooth/mesh/access.h>

Light HSL Setup Server.

◆ BT_MESH_MODEL_ID_LIGHT_HSL_SRV

#define BT_MESH_MODEL_ID_LIGHT_HSL_SRV   0x1307

#include <zephyr/bluetooth/mesh/access.h>

Light HSL Server.

◆ BT_MESH_MODEL_ID_LIGHT_LC_CLI

#define BT_MESH_MODEL_ID_LIGHT_LC_CLI   0x1311

#include <zephyr/bluetooth/mesh/access.h>

Light LC Client.

◆ BT_MESH_MODEL_ID_LIGHT_LC_SETUPSRV

#define BT_MESH_MODEL_ID_LIGHT_LC_SETUPSRV   0x1310

#include <zephyr/bluetooth/mesh/access.h>

Light LC Setup Server.

◆ BT_MESH_MODEL_ID_LIGHT_LC_SRV

#define BT_MESH_MODEL_ID_LIGHT_LC_SRV   0x130f

#include <zephyr/bluetooth/mesh/access.h>

Light LC Server.

◆ BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI

#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI   0x1302

#include <zephyr/bluetooth/mesh/access.h>

Light Lightness Client.

◆ BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV

#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV   0x1301

#include <zephyr/bluetooth/mesh/access.h>

Light Lightness Setup Server.

◆ BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV

#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV   0x1300

#include <zephyr/bluetooth/mesh/access.h>

Light Lightness Server.

◆ BT_MESH_MODEL_ID_LIGHT_XYL_CLI

#define BT_MESH_MODEL_ID_LIGHT_XYL_CLI   0x130e

#include <zephyr/bluetooth/mesh/access.h>

Light xyL Client.

◆ BT_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV

#define BT_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV   0x130d

#include <zephyr/bluetooth/mesh/access.h>

Light xyL Setup Server.

◆ BT_MESH_MODEL_ID_LIGHT_XYL_SRV

#define BT_MESH_MODEL_ID_LIGHT_XYL_SRV   0x130c

#include <zephyr/bluetooth/mesh/access.h>

Light xyL Server.

◆ BT_MESH_MODEL_ID_ON_DEMAND_PROXY_CLI

#define BT_MESH_MODEL_ID_ON_DEMAND_PROXY_CLI   0x000d

#include <zephyr/bluetooth/mesh/access.h>

Private Proxy Client.

◆ BT_MESH_MODEL_ID_ON_DEMAND_PROXY_SRV

#define BT_MESH_MODEL_ID_ON_DEMAND_PROXY_SRV   0x000c

#include <zephyr/bluetooth/mesh/access.h>

Private Proxy Server.

◆ BT_MESH_MODEL_ID_OP_AGG_CLI

#define BT_MESH_MODEL_ID_OP_AGG_CLI   0x0011

#include <zephyr/bluetooth/mesh/access.h>

Opcodes Aggregator Client.

◆ BT_MESH_MODEL_ID_OP_AGG_SRV

#define BT_MESH_MODEL_ID_OP_AGG_SRV   0x0010

#include <zephyr/bluetooth/mesh/access.h>

Opcodes Aggregator Server.

◆ BT_MESH_MODEL_ID_PRIV_BEACON_CLI

#define BT_MESH_MODEL_ID_PRIV_BEACON_CLI   0x000b

#include <zephyr/bluetooth/mesh/access.h>

Private Beacon Client.

◆ BT_MESH_MODEL_ID_PRIV_BEACON_SRV

#define BT_MESH_MODEL_ID_PRIV_BEACON_SRV   0x000a

#include <zephyr/bluetooth/mesh/access.h>

Private Beacon Server.

◆ BT_MESH_MODEL_ID_REMOTE_PROV_CLI

#define BT_MESH_MODEL_ID_REMOTE_PROV_CLI   0x0005

#include <zephyr/bluetooth/mesh/access.h>

Remote Provisioning Client.

◆ BT_MESH_MODEL_ID_REMOTE_PROV_SRV

#define BT_MESH_MODEL_ID_REMOTE_PROV_SRV   0x0004

#include <zephyr/bluetooth/mesh/access.h>

Remote Provisioning Server.

◆ BT_MESH_MODEL_ID_SAR_CFG_CLI

#define BT_MESH_MODEL_ID_SAR_CFG_CLI   0x000f

#include <zephyr/bluetooth/mesh/access.h>

SAR Configuration Client.

◆ BT_MESH_MODEL_ID_SAR_CFG_SRV

#define BT_MESH_MODEL_ID_SAR_CFG_SRV   0x000e

#include <zephyr/bluetooth/mesh/access.h>

SAR Configuration Server.

◆ BT_MESH_MODEL_ID_SCENE_CLI

#define BT_MESH_MODEL_ID_SCENE_CLI   0x1205

#include <zephyr/bluetooth/mesh/access.h>

Scene Client.

◆ BT_MESH_MODEL_ID_SCENE_SETUP_SRV

#define BT_MESH_MODEL_ID_SCENE_SETUP_SRV   0x1204

#include <zephyr/bluetooth/mesh/access.h>

Scene Setup Server.

◆ BT_MESH_MODEL_ID_SCENE_SRV

#define BT_MESH_MODEL_ID_SCENE_SRV   0x1203

#include <zephyr/bluetooth/mesh/access.h>

Scene Server.

◆ BT_MESH_MODEL_ID_SCHEDULER_CLI

#define BT_MESH_MODEL_ID_SCHEDULER_CLI   0x1208

#include <zephyr/bluetooth/mesh/access.h>

Scheduler Client.

◆ BT_MESH_MODEL_ID_SCHEDULER_SETUP_SRV

#define BT_MESH_MODEL_ID_SCHEDULER_SETUP_SRV   0x1207

#include <zephyr/bluetooth/mesh/access.h>

Scheduler Setup Server.

◆ BT_MESH_MODEL_ID_SCHEDULER_SRV

#define BT_MESH_MODEL_ID_SCHEDULER_SRV   0x1206

#include <zephyr/bluetooth/mesh/access.h>

Scheduler Server.

◆ BT_MESH_MODEL_ID_SENSOR_CLI

#define BT_MESH_MODEL_ID_SENSOR_CLI   0x1102

#include <zephyr/bluetooth/mesh/access.h>

Sensor Client.

◆ BT_MESH_MODEL_ID_SENSOR_SETUP_SRV

#define BT_MESH_MODEL_ID_SENSOR_SETUP_SRV   0x1101

#include <zephyr/bluetooth/mesh/access.h>

Sensor Setup Server.

◆ BT_MESH_MODEL_ID_SENSOR_SRV

#define BT_MESH_MODEL_ID_SENSOR_SRV   0x1100

#include <zephyr/bluetooth/mesh/access.h>

Sensor Server.

◆ BT_MESH_MODEL_ID_SOL_PDU_RPL_CLI

#define BT_MESH_MODEL_ID_SOL_PDU_RPL_CLI   0x0015

#include <zephyr/bluetooth/mesh/access.h>

Solicitation PDU RPL Configuration Server.

◆ BT_MESH_MODEL_ID_SOL_PDU_RPL_SRV

#define BT_MESH_MODEL_ID_SOL_PDU_RPL_SRV   0x0014

#include <zephyr/bluetooth/mesh/access.h>

Solicitation PDU RPL Configuration Client.

◆ BT_MESH_MODEL_ID_TIME_CLI

#define BT_MESH_MODEL_ID_TIME_CLI   0x1202

#include <zephyr/bluetooth/mesh/access.h>

Time Client.

◆ BT_MESH_MODEL_ID_TIME_SETUP_SRV

#define BT_MESH_MODEL_ID_TIME_SETUP_SRV   0x1201

#include <zephyr/bluetooth/mesh/access.h>

Time Setup Server.

◆ BT_MESH_MODEL_ID_TIME_SRV

#define BT_MESH_MODEL_ID_TIME_SRV   0x1200

#include <zephyr/bluetooth/mesh/access.h>

Time Server.

◆ BT_MESH_MODEL_METADATA_CB

#define BT_MESH_MODEL_METADATA_CB (   _id,
  _op,
  _pub,
  _user_data,
  _cb,
  _metadata 
)     BT_MESH_MODEL_CB(_id, _op, _pub, _user_data, _cb)

#include <zephyr/bluetooth/mesh/access.h>

Composition data SIG model entry with callback functions and metadata.

This macro uses compound literal feature of C99 standard and thus is available only from C, not C++.

Parameters
_idModel ID.
_opArray of model opcode handlers.
_pubModel publish parameters.
_user_dataUser data for the model.
_cbCallback structure, or NULL to keep no callbacks.
_metadataMetadata structure. Used if CONFIG_BT_MESH_LARGE_COMP_DATA_SRV is enabled.

◆ BT_MESH_MODEL_NO_OPS

#define BT_MESH_MODEL_NO_OPS

#include <zephyr/bluetooth/mesh/access.h>

Value:
((struct bt_mesh_model_op []) \
#define BT_MESH_MODEL_OP_END
End of the opcode list.
Definition: access.h:395
Model opcode handler.
Definition: access.h:359

Helper to define an empty opcode list.

This macro uses compound literal feature of C99 standard and thus is available only from C, not C++.

◆ BT_MESH_MODEL_NONE

#define BT_MESH_MODEL_NONE   ((const struct bt_mesh_model []){})

#include <zephyr/bluetooth/mesh/access.h>

Helper to define an empty model array.

This macro uses compound literal feature of C99 standard and thus is available only from C, not C++.

◆ BT_MESH_MODEL_OP_1

#define BT_MESH_MODEL_OP_1 (   b0)    (b0)

◆ BT_MESH_MODEL_OP_2

#define BT_MESH_MODEL_OP_2 (   b0,
  b1 
)    (((b0) << 8) | (b1))

◆ BT_MESH_MODEL_OP_3

#define BT_MESH_MODEL_OP_3 (   b0,
  cid 
)    ((((b0) << 16) | 0xc00000) | (cid))

◆ BT_MESH_MODEL_OP_END

#define BT_MESH_MODEL_OP_END   { 0, 0, NULL }

#include <zephyr/bluetooth/mesh/access.h>

End of the opcode list.

Must always be present.

◆ BT_MESH_MODEL_PUB_DEFINE

#define BT_MESH_MODEL_PUB_DEFINE (   _name,
  _update,
  _msg_len 
)

#include <zephyr/bluetooth/mesh/access.h>

Value:
NET_BUF_SIMPLE_DEFINE_STATIC(bt_mesh_pub_msg_##_name, _msg_len); \
static struct bt_mesh_model_pub _name = { \
.msg = &bt_mesh_pub_msg_##_name, \
.update = _update, \
}
#define NET_BUF_SIMPLE_DEFINE_STATIC(_name, _size)
Define a static net_buf_simple variable.
Definition: buf.h:65
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
struct net_buf_simple * msg
Publication buffer, containing the publication message.
Definition: access.h:733

Define a model publication context.

Parameters
_nameVariable name given to the context.
_updateOptional message update callback (may be NULL).
_msg_lenLength of the publication message.

◆ BT_MESH_MODEL_VND

#define BT_MESH_MODEL_VND (   _company,
  _id,
  _op,
  _pub,
  _user_data 
)     BT_MESH_MODEL_VND_CB(_company, _id, _op, _pub, _user_data, NULL)

#include <zephyr/bluetooth/mesh/access.h>

Composition data vendor model entry.

This macro uses compound literal feature of C99 standard and thus is available only from C, not C++.

Parameters
_companyCompany ID.
_idModel ID.
_opArray of model opcode handlers.
_pubModel publish parameters.
_user_dataUser data for the model.

◆ BT_MESH_MODEL_VND_CB

#define BT_MESH_MODEL_VND_CB (   _company,
  _id,
  _op,
  _pub,
  _user_data,
  _cb 
)

#include <zephyr/bluetooth/mesh/access.h>

Value:
BT_MESH_MODEL_CNT_VND_CB(_company, _id, _op, _pub, _user_data, \
CONFIG_BT_MESH_MODEL_KEY_COUNT, \
CONFIG_BT_MESH_MODEL_GROUP_COUNT, _cb)
#define BT_MESH_MODEL_CNT_VND_CB(_company, _id, _op, _pub, _user_data, _keys, _grps, _cb)
Composition data vendor model entry with callback functions with specific number of keys & groups.
Definition: access.h:464

Composition data vendor model entry with callback functions.

This macro uses compound literal feature of C99 standard and thus is available only from C, not C++.

Parameters
_companyCompany ID.
_idModel ID.
_opArray of model opcode handlers.
_pubModel publish parameters.
_user_dataUser data for the model.
_cbCallback structure, or NULL to keep no callbacks.

◆ BT_MESH_MODEL_VND_METADATA_CB

#define BT_MESH_MODEL_VND_METADATA_CB (   _company,
  _id,
  _op,
  _pub,
  _user_data,
  _cb,
  _metadata 
)     BT_MESH_MODEL_VND_CB(_company, _id, _op, _pub, _user_data, _cb)

#include <zephyr/bluetooth/mesh/access.h>

Composition data vendor model entry with callback functions and metadata.

This macro uses compound literal feature of C99 standard and thus is available only from C, not C++.

Parameters
_companyCompany ID.
_idModel ID.
_opArray of model opcode handlers.
_pubModel publish parameters.
_user_dataUser data for the model.
_cbCallback structure, or NULL to keep no callbacks.
_metadataMetadata structure. Used if CONFIG_BT_MESH_LARGE_COMP_DATA_SRV is enabled.

◆ BT_MESH_MODELS_METADATA_END

#define BT_MESH_MODELS_METADATA_END   { 0, 0, NULL }

#include <zephyr/bluetooth/mesh/access.h>

End of the Models Metadata list.

Must always be present.

◆ BT_MESH_MODELS_METADATA_ENTRY

#define BT_MESH_MODELS_METADATA_ENTRY (   _len,
  _id,
  _data 
)

#include <zephyr/bluetooth/mesh/access.h>

Value:
{ \
.len = (_len), .id = _id, .data = _data, \
}

Initialize a Models Metadata entry structure in a list.

Parameters
_lenLength of the metadata entry.
_idID of the Models Metadata entry.
_dataPointer to a contiguous memory that contains the metadata.

◆ BT_MESH_MODELS_METADATA_NONE

#define BT_MESH_MODELS_METADATA_NONE   NULL

#include <zephyr/bluetooth/mesh/access.h>

Helper to define an empty Models metadata array.

◆ BT_MESH_PUB_MSG_NUM

#define BT_MESH_PUB_MSG_NUM (   pub)    (BT_MESH_PUB_TRANSMIT_COUNT((pub)->retransmit) + 1 - (pub)->count)

#include <zephyr/bluetooth/mesh/access.h>

Get message number within one publication interval.

Meant to be used inside bt_mesh_model_pub::update.

Parameters
pubModel publication context.
Returns
message number starting from 1.

◆ BT_MESH_PUB_MSG_TOTAL

#define BT_MESH_PUB_MSG_TOTAL (   pub)    (BT_MESH_PUB_TRANSMIT_COUNT((pub)->retransmit) + 1)

#include <zephyr/bluetooth/mesh/access.h>

Get total number of messages within one publication interval including initial publication.

Parameters
pubModel publication context.
Returns
total number of messages.

◆ BT_MESH_PUB_TRANSMIT

#define BT_MESH_PUB_TRANSMIT (   count,
  int_ms 
)

#include <zephyr/bluetooth/mesh/access.h>

Value:
(int_ms) / 5)
#define BT_MESH_TRANSMIT(count, int_ms)
Encode transmission count & interval steps.
Definition: access.h:627

Encode Publish Retransmit count & interval steps.

Parameters
countNumber of retransmissions (first transmission is excluded).
int_msInterval steps in milliseconds. Must be greater than 0 and a multiple of 50.
Returns
Mesh transmit value that can be used e.g. for the default values of the configuration model data.

◆ BT_MESH_PUB_TRANSMIT_COUNT

#define BT_MESH_PUB_TRANSMIT_COUNT (   transmit)    BT_MESH_TRANSMIT_COUNT(transmit)

#include <zephyr/bluetooth/mesh/access.h>

Decode Publish Retransmit count from a given value.

Parameters
transmitEncoded Publish Retransmit count & interval value.
Returns
Retransmission count (actual transmissions is N + 1).

◆ BT_MESH_PUB_TRANSMIT_INT

#define BT_MESH_PUB_TRANSMIT_INT (   transmit)    ((((transmit) >> 3) + 1) * 50)

#include <zephyr/bluetooth/mesh/access.h>

Decode Publish Retransmit interval from a given value.

Parameters
transmitEncoded Publish Retransmit count & interval value.
Returns
Transmission interval in milliseconds.

◆ BT_MESH_RX_SDU_MAX

#define BT_MESH_RX_SDU_MAX

#include <zephyr/bluetooth/mesh/access.h>

Value:
#define BT_MESH_RX_SEG_MAX
Maximum number of segments supported for incoming messages.
Definition: access.h:114
#define BT_MESH_APP_UNSEG_SDU_MAX
Maximum payload size of an unsegmented access message (in octets).
Definition: access.h:108
#define BT_MESH_APP_SEG_SDU_MAX
Maximum size of an access message segment (in octets).
Definition: access.h:105
#define MAX(a, b)
Obtain the maximum of two values.
Definition: util.h:376

Maximum possible payload size of an incoming access message (in octets).

◆ BT_MESH_RX_SEG_MAX

#define BT_MESH_RX_SEG_MAX   0

#include <zephyr/bluetooth/mesh/access.h>

Maximum number of segments supported for incoming messages.

◆ BT_MESH_TRANSMIT

#define BT_MESH_TRANSMIT (   count,
  int_ms 
)    ((count) | (((int_ms / 10) - 1) << 3))

#include <zephyr/bluetooth/mesh/access.h>

Encode transmission count & interval steps.

Parameters
countNumber of retransmissions (first transmission is excluded).
int_msInterval steps in milliseconds. Must be greater than 0, less than or equal to 320, and a multiple of 10.
Returns
Mesh transmit value that can be used e.g. for the default values of the configuration model data.

◆ BT_MESH_TRANSMIT_COUNT

#define BT_MESH_TRANSMIT_COUNT (   transmit)    (((transmit) & (uint8_t)BIT_MASK(3)))

#include <zephyr/bluetooth/mesh/access.h>

Decode transmit count from a transmit value.

Parameters
transmitEncoded transmit count & interval value.
Returns
Transmission count (actual transmissions is N + 1).

◆ BT_MESH_TRANSMIT_INT

#define BT_MESH_TRANSMIT_INT (   transmit)    ((((transmit) >> 3) + 1) * 10)

#include <zephyr/bluetooth/mesh/access.h>

Decode transmit interval from a transmit value.

Parameters
transmitEncoded transmit count & interval value.
Returns
Transmission interval in milliseconds.

◆ BT_MESH_TTL_DEFAULT

#define BT_MESH_TTL_DEFAULT   0xff

#include <zephyr/bluetooth/mesh/access.h>

Special TTL value to request using configured default TTL.

◆ BT_MESH_TTL_MAX

#define BT_MESH_TTL_MAX   0x7f

#include <zephyr/bluetooth/mesh/access.h>

Maximum allowed TTL value.

◆ BT_MESH_TX_SDU_MAX

#define BT_MESH_TX_SDU_MAX

#include <zephyr/bluetooth/mesh/access.h>

Value:
#define BT_MESH_TX_SEG_MAX
Maximum number of segments supported for outgoing messages.
Definition: access.h:121

Maximum possible payload size of an outgoing access message (in octets).

◆ BT_MESH_TX_SEG_MAX

#define BT_MESH_TX_SEG_MAX   0

#include <zephyr/bluetooth/mesh/access.h>

Maximum number of segments supported for outgoing messages.

Function Documentation

◆ bt_mesh_comp2_register()

int bt_mesh_comp2_register ( const struct bt_mesh_comp2 comp2)

#include <zephyr/bluetooth/mesh/access.h>

Register composition data page 2 of the device.

Register Mesh Profiles information (Ref section 3.12 in Bluetooth SIG Assigned Numbers) for composition data page 2 of the device.

Note
There must be at least one record present in comp2
Parameters
comp2Pointer to composition data page 2.
Returns
Zero on success or (negative) error code otherwise.

◆ bt_mesh_comp_change_prepare()

int bt_mesh_comp_change_prepare ( void  )

#include <zephyr/bluetooth/mesh/access.h>

Indicate that the composition data will change on next bootup.

Tell the config server that the composition data is expected to change on the next bootup, and the current composition data should be backed up.

Returns
Zero on success or (negative) error code otherwise.

◆ bt_mesh_model_correspond()

int bt_mesh_model_correspond ( const struct bt_mesh_model corresponding_mod,
const struct bt_mesh_model base_mod 
)

#include <zephyr/bluetooth/mesh/access.h>

Let a model correspond to another.

Mesh models may correspond to each other, which means that if one is present, other must be present too. A Mesh model may correspond to any number of models, in any element. All models connected together via correspondence form single Correspondence Group, which has it's unique Correspondence ID. Information about Correspondence is used to construct Composition Data Page 1.

This function must be called on already initialized base_mod. Because this function is designed to be called in corresponding_mod initializer, this means that base_mod shall be initialized before corresponding_mod is.

Parameters
corresponding_modMesh model that is corresponding to the base model.
base_modThe model being corresponded to.
Return values
0Successfully saved correspondence to the base_mod model.
-ENOMEMThere is no more space to save this relation.
-ENOTSUPComposition Data Page 1 is not supported.

◆ bt_mesh_model_data_store()

int bt_mesh_model_data_store ( const struct bt_mesh_model mod,
bool  vnd,
const char *  name,
const void *  data,
size_t  data_len 
)

#include <zephyr/bluetooth/mesh/access.h>

Immediately store the model's user data in persistent storage.

Parameters
modMesh model.
vndThis is a vendor model.
nameName/key of the settings item. Only SETTINGS_MAX_DIR_DEPTH bytes will be used at most.
dataModel data to store, or NULL to delete any model data.
data_lenLength of the model data.
Returns
0 on success, or (negative) error code on failure.

◆ bt_mesh_model_data_store_schedule()

void bt_mesh_model_data_store_schedule ( const struct bt_mesh_model mod)

#include <zephyr/bluetooth/mesh/access.h>

Schedule the model's user data store in persistent storage.

This function triggers the bt_mesh_model_cb::pending_store callback for the corresponding model after delay defined by CONFIG_BT_MESH_STORE_TIMEOUT .

The delay is global for all models. Once scheduled, the callback can not be re-scheduled until previous schedule completes.

Parameters
modMesh model.

◆ bt_mesh_model_elem()

const struct bt_mesh_elem * bt_mesh_model_elem ( const struct bt_mesh_model mod)

#include <zephyr/bluetooth/mesh/access.h>

Get the element that a model belongs to.

Parameters
modMesh model.
Returns
Pointer to the element that the given model belongs to.

◆ bt_mesh_model_extend()

int bt_mesh_model_extend ( const struct bt_mesh_model extending_mod,
const struct bt_mesh_model base_mod 
)

#include <zephyr/bluetooth/mesh/access.h>

Let a model extend another.

Mesh models may be extended to reuse their functionality, forming a more complex model. A Mesh model may extend any number of models, in any element. The extensions may also be nested, ie a model that extends another may itself be extended.

A set of models that extend each other form a model extension list.

All models in an extension list share one subscription list per element. The access layer will utilize the combined subscription list of all models in an extension list and element, giving the models extended subscription list capacity.

If CONFIG_BT_MESH_COMP_PAGE_1 is enabled, it is not allowed to call this function before the bt_mesh_model_cb::init callback is called for both models, except if it is called as part of the final callback.

Parameters
extending_modMesh model that is extending the base model.
base_modThe model being extended.
Return values
0Successfully extended the base_mod model.

◆ bt_mesh_model_find()

const struct bt_mesh_model * bt_mesh_model_find ( const struct bt_mesh_elem elem,
uint16_t  id 
)

#include <zephyr/bluetooth/mesh/access.h>

Find a SIG model.

Parameters
elemElement to search for the model in.
idModel ID of the model.
Returns
A pointer to the Mesh model matching the given parameters, or NULL if no SIG model with the given ID exists in the given element.

◆ bt_mesh_model_find_vnd()

const struct bt_mesh_model * bt_mesh_model_find_vnd ( const struct bt_mesh_elem elem,
uint16_t  company,
uint16_t  id 
)

#include <zephyr/bluetooth/mesh/access.h>

Find a vendor model.

Parameters
elemElement to search for the model in.
companyCompany ID of the model.
idModel ID of the model.
Returns
A pointer to the Mesh model matching the given parameters, or NULL if no vendor model with the given ID exists in the given element.

◆ bt_mesh_model_in_primary()

static bool bt_mesh_model_in_primary ( const struct bt_mesh_model mod)
inlinestatic

#include <zephyr/bluetooth/mesh/access.h>

Get whether the model is in the primary element of the device.

Parameters
modMesh model.
Returns
true if the model is on the primary element, false otherwise.

◆ bt_mesh_model_is_extended()

bool bt_mesh_model_is_extended ( const struct bt_mesh_model model)

#include <zephyr/bluetooth/mesh/access.h>

Check if model is extended by another model.

Parameters
modelThe model to check.
Return values
trueIf model is extended by another model, otherwise false

◆ bt_mesh_model_pub_is_retransmission()

static bool bt_mesh_model_pub_is_retransmission ( const struct bt_mesh_model model)
inlinestatic

#include <zephyr/bluetooth/mesh/access.h>

Check if a message is being retransmitted.

Meant to be used inside the bt_mesh_model_pub::update callback.

Parameters
modelMesh Model that supports publication.
Returns
true if this is a retransmission, false if this is a first publication.

◆ bt_mesh_model_publish()

int bt_mesh_model_publish ( const struct bt_mesh_model model)

#include <zephyr/bluetooth/mesh/access.h>

Send a model publication message.

Before calling this function, the user needs to ensure that the model publication message (bt_mesh_model_pub::msg) contains a valid message to be sent. Note that this API is only to be used for non-period publishing. For periodic publishing the app only needs to make sure that bt_mesh_model_pub::msg contains a valid message whenever the bt_mesh_model_pub::update callback is called.

Parameters
modelMesh (client) Model that's publishing the message.
Returns
0 on success, or (negative) error code on failure.

◆ bt_mesh_model_send()

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 
)

#include <zephyr/bluetooth/mesh/access.h>

Send an Access Layer message.

Parameters
modelMesh (client) Model that the message belongs to.
ctxMessage context, includes keys, TTL, etc.
msgAccess Layer payload (the actual message to be sent).
cbOptional "message sent" callback.
cb_dataUser data to be passed to the callback.
Returns
0 on success, or (negative) error code on failure.

◆ bt_mesh_models_metadata_change_prepare()

int bt_mesh_models_metadata_change_prepare ( void  )

#include <zephyr/bluetooth/mesh/access.h>

Indicate that the metadata will change on next bootup.

Tell the config server that the models metadata is expected to change on the next bootup, and the current models metadata should be backed up.

Returns
Zero on success or (negative) error code otherwise.