Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS

Access layer. More...

Data Structures

struct  bt_mesh_elem
 
struct  bt_mesh_model_op
 
struct  bt_mesh_model_pub
 
struct  bt_mesh_model_cb
 
struct  bt_mesh_mod_id_vnd
 
struct  bt_mesh_model
 
struct  bt_mesh_send_cb
 
struct  bt_mesh_comp
 

Macros

#define BT_MESH_ADDR_UNASSIGNED   0x0000
 
#define BT_MESH_ADDR_ALL_NODES   0xffff
 
#define BT_MESH_ADDR_PROXIES   0xfffc
 
#define BT_MESH_ADDR_FRIENDS   0xfffd
 
#define BT_MESH_ADDR_RELAYS   0xfffe
 
#define BT_MESH_KEY_UNUSED   0xffff
 
#define BT_MESH_KEY_ANY   0xffff
 
#define BT_MESH_KEY_DEV   0xfffe
 
#define BT_MESH_KEY_DEV_LOCAL   BT_MESH_KEY_DEV
 
#define BT_MESH_KEY_DEV_REMOTE   0xfffd
 
#define BT_MESH_KEY_DEV_ANY   0xfffc
 
#define BT_MESH_ADDR_IS_UNICAST(addr)   ((addr) && (addr) < 0x8000)
 
#define BT_MESH_ADDR_IS_GROUP(addr)   ((addr) >= 0xc000 && (addr) <= 0xff00)
 
#define BT_MESH_ADDR_IS_VIRTUAL(addr)   ((addr) >= 0x8000 && (addr) < 0xc000)
 
#define BT_MESH_ADDR_IS_RFU(addr)   ((addr) >= 0xff00 && (addr) <= 0xfffb)
 
#define BT_MESH_IS_DEV_KEY(key)
 
#define BT_MESH_APP_SEG_SDU_MAX   12
 
#define BT_MESH_TX_SDU_MAX
 
#define BT_MESH_RX_SDU_MAX
 
#define BT_MESH_ELEM(_loc, _mods, _vnd_mods)
 
#define BT_MESH_MODEL_ID_CFG_SRV   0x0000
 
#define BT_MESH_MODEL_ID_CFG_CLI   0x0001
 
#define BT_MESH_MODEL_ID_HEALTH_SRV   0x0002
 
#define BT_MESH_MODEL_ID_HEALTH_CLI   0x0003
 
#define BT_MESH_MODEL_ID_GEN_ONOFF_SRV   0x1000
 
#define BT_MESH_MODEL_ID_GEN_ONOFF_CLI   0x1001
 
#define BT_MESH_MODEL_ID_GEN_LEVEL_SRV   0x1002
 
#define BT_MESH_MODEL_ID_GEN_LEVEL_CLI   0x1003
 
#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV   0x1004
 
#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI   0x1005
 
#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV   0x1006
 
#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV   0x1007
 
#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI   0x1008
 
#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV   0x1009
 
#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV   0x100a
 
#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI   0x100b
 
#define BT_MESH_MODEL_ID_GEN_BATTERY_SRV   0x100c
 
#define BT_MESH_MODEL_ID_GEN_BATTERY_CLI   0x100d
 
#define BT_MESH_MODEL_ID_GEN_LOCATION_SRV   0x100e
 
#define BT_MESH_MODEL_ID_GEN_LOCATION_SETUPSRV   0x100f
 
#define BT_MESH_MODEL_ID_GEN_LOCATION_CLI   0x1010
 
#define BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV   0x1011
 
#define BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV   0x1012
 
#define BT_MESH_MODEL_ID_GEN_USER_PROP_SRV   0x1013
 
#define BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV   0x1014
 
#define BT_MESH_MODEL_ID_GEN_PROP_CLI   0x1015
 
#define BT_MESH_MODEL_ID_SENSOR_SRV   0x1100
 
#define BT_MESH_MODEL_ID_SENSOR_SETUP_SRV   0x1101
 
#define BT_MESH_MODEL_ID_SENSOR_CLI   0x1102
 
#define BT_MESH_MODEL_ID_TIME_SRV   0x1200
 
#define BT_MESH_MODEL_ID_TIME_SETUP_SRV   0x1201
 
#define BT_MESH_MODEL_ID_TIME_CLI   0x1202
 
#define BT_MESH_MODEL_ID_SCENE_SRV   0x1203
 
#define BT_MESH_MODEL_ID_SCENE_SETUP_SRV   0x1204
 
#define BT_MESH_MODEL_ID_SCENE_CLI   0x1205
 
#define BT_MESH_MODEL_ID_SCHEDULER_SRV   0x1206
 
#define BT_MESH_MODEL_ID_SCHEDULER_SETUP_SRV   0x1207
 
#define BT_MESH_MODEL_ID_SCHEDULER_CLI   0x1208
 
#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV   0x1300
 
#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV   0x1301
 
#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI   0x1302
 
#define BT_MESH_MODEL_ID_LIGHT_CTL_SRV   0x1303
 
#define BT_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV   0x1304
 
#define BT_MESH_MODEL_ID_LIGHT_CTL_CLI   0x1305
 
#define BT_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV   0x1306
 
#define BT_MESH_MODEL_ID_LIGHT_HSL_SRV   0x1307
 
#define BT_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV   0x1308
 
#define BT_MESH_MODEL_ID_LIGHT_HSL_CLI   0x1309
 
#define BT_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV   0x130a
 
#define BT_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV   0x130b
 
#define BT_MESH_MODEL_ID_LIGHT_XYL_SRV   0x130c
 
#define BT_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV   0x130d
 
#define BT_MESH_MODEL_ID_LIGHT_XYL_CLI   0x130e
 
#define BT_MESH_MODEL_ID_LIGHT_LC_SRV   0x130f
 
#define BT_MESH_MODEL_ID_LIGHT_LC_SETUPSRV   0x1310
 
#define BT_MESH_MODEL_ID_LIGHT_LC_CLI   0x1311
 
#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)
 
#define BT_MESH_LEN_MIN(len)   (len)
 
#define BT_MESH_MODEL_OP_END   { 0, 0, NULL }
 
#define BT_MESH_MODEL_NO_OPS
 
#define BT_MESH_MODEL_NONE   ((struct bt_mesh_model []){})
 
#define BT_MESH_MODEL_CB(_id, _op, _pub, _user_data, _cb)
 Composition data SIG model entry with callback functions. More...
 
#define BT_MESH_MODEL_VND_CB(_company, _id, _op, _pub, _user_data, _cb)
 Composition data vendor model entry with callback functions. More...
 
#define BT_MESH_MODEL(_id, _op, _pub, _user_data)    BT_MESH_MODEL_CB(_id, _op, _pub, _user_data, NULL)
 Composition data SIG model entry. More...
 
#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. More...
 
#define BT_MESH_TRANSMIT(count, int_ms)   ((count) | (((int_ms / 10) - 1) << 3))
 Encode transmission count & interval steps. More...
 
#define BT_MESH_TRANSMIT_COUNT(transmit)   (((transmit) & (uint8_t)BIT_MASK(3)))
 Decode transmit count from a transmit value. More...
 
#define BT_MESH_TRANSMIT_INT(transmit)   ((((transmit) >> 3) + 1) * 10)
 Decode transmit interval from a transmit value. More...
 
#define BT_MESH_PUB_TRANSMIT(count, int_ms)
 Encode Publish Retransmit count & interval steps. More...
 
#define BT_MESH_PUB_TRANSMIT_COUNT(transmit)   BT_MESH_TRANSMIT_COUNT(transmit)
 Decode Publish Retransmit count from a given value. More...
 
#define BT_MESH_PUB_TRANSMIT_INT(transmit)   ((((transmit) >> 3) + 1) * 50)
 Decode Publish Retransmit interval from a given value. More...
 
#define BT_MESH_MODEL_PUB_DEFINE(_name, _update, _msg_len)
 
#define BT_MESH_TTL_DEFAULT   0xff
 
#define BT_MESH_TTL_MAX   0x7f
 

Functions

int bt_mesh_model_send (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. More...
 
int bt_mesh_model_publish (struct bt_mesh_model *model)
 Send a model publication message. More...
 
struct bt_mesh_elembt_mesh_model_elem (struct bt_mesh_model *mod)
 Get the element that a model belongs to. More...
 
struct bt_mesh_modelbt_mesh_model_find (const struct bt_mesh_elem *elem, uint16_t id)
 Find a SIG model. More...
 
struct bt_mesh_modelbt_mesh_model_find_vnd (const struct bt_mesh_elem *elem, uint16_t company, uint16_t id)
 Find a vendor model. More...
 
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. More...
 
int bt_mesh_model_data_store (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. More...
 
int bt_mesh_model_extend (struct bt_mesh_model *extending_mod, struct bt_mesh_model *base_mod)
 Let a model extend another. More...
 
bool bt_mesh_model_is_extended (struct bt_mesh_model *model)
 Check if model is extended by another model. More...
 

Detailed Description

Access layer.

Macro Definition Documentation

◆ BT_MESH_ADDR_ALL_NODES

#define BT_MESH_ADDR_ALL_NODES   0xffff

◆ BT_MESH_ADDR_FRIENDS

#define BT_MESH_ADDR_FRIENDS   0xfffd

◆ BT_MESH_ADDR_IS_GROUP

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

◆ BT_MESH_ADDR_IS_RFU

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

◆ BT_MESH_ADDR_IS_UNICAST

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

◆ BT_MESH_ADDR_IS_VIRTUAL

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

◆ BT_MESH_ADDR_PROXIES

#define BT_MESH_ADDR_PROXIES   0xfffc

◆ BT_MESH_ADDR_RELAYS

#define BT_MESH_ADDR_RELAYS   0xfffe

◆ BT_MESH_ADDR_UNASSIGNED

#define BT_MESH_ADDR_UNASSIGNED   0x0000

◆ BT_MESH_APP_SEG_SDU_MAX

#define BT_MESH_APP_SEG_SDU_MAX   12

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

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

◆ BT_MESH_ELEM

#define BT_MESH_ELEM (   _loc,
  _mods,
  _vnd_mods 
)

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

Value:
{ \
.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:92

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 <include/bluetooth/mesh/access.h>

Value:
#define BT_MESH_KEY_DEV_LOCAL
Definition: access.h:47
#define BT_MESH_KEY_DEV_REMOTE
Definition: access.h:48
static k_spinlock_key_t key
Definition: spinlock_error_case.c:14

◆ BT_MESH_KEY_ANY

#define BT_MESH_KEY_ANY   0xffff

◆ BT_MESH_KEY_DEV

#define BT_MESH_KEY_DEV   0xfffe

◆ BT_MESH_KEY_DEV_ANY

#define BT_MESH_KEY_DEV_ANY   0xfffc

◆ BT_MESH_KEY_DEV_LOCAL

#define BT_MESH_KEY_DEV_LOCAL   BT_MESH_KEY_DEV

◆ BT_MESH_KEY_DEV_REMOTE

#define BT_MESH_KEY_DEV_REMOTE   0xfffd

◆ BT_MESH_KEY_UNUSED

#define BT_MESH_KEY_UNUSED   0xffff

◆ BT_MESH_LEN_EXACT

#define BT_MESH_LEN_EXACT (   len)    (-len)

#include <include/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 <include/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 <include/bluetooth/mesh/access.h>

Composition data SIG model entry.

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 <include/bluetooth/mesh/access.h>

Value:
{ \
.id = (_id), \
.pub = _pub, \
.op = _op, \
.cb = _cb, \
.user_data = _user_data, \
}
#define BT_MESH_MODEL_KEYS_UNUSED
Definition: access.h:20
#define BT_MESH_MODEL_GROUPS_UNASSIGNED
Definition: access.h:23
static const intptr_t user_data[5]
Definition: main.c:590

Composition data SIG model entry with callback functions.

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_ID_CFG_CLI

#define BT_MESH_MODEL_ID_CFG_CLI   0x0001

◆ BT_MESH_MODEL_ID_CFG_SRV

#define BT_MESH_MODEL_ID_CFG_SRV   0x0000

◆ BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV

#define BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV   0x1011

◆ BT_MESH_MODEL_ID_GEN_BATTERY_CLI

#define BT_MESH_MODEL_ID_GEN_BATTERY_CLI   0x100d

◆ BT_MESH_MODEL_ID_GEN_BATTERY_SRV

#define BT_MESH_MODEL_ID_GEN_BATTERY_SRV   0x100c

◆ BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV

#define BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV   0x1014

◆ BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI

#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI   0x1005

◆ BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV

#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV   0x1004

◆ BT_MESH_MODEL_ID_GEN_LEVEL_CLI

#define BT_MESH_MODEL_ID_GEN_LEVEL_CLI   0x1003

◆ BT_MESH_MODEL_ID_GEN_LEVEL_SRV

#define BT_MESH_MODEL_ID_GEN_LEVEL_SRV   0x1002

◆ BT_MESH_MODEL_ID_GEN_LOCATION_CLI

#define BT_MESH_MODEL_ID_GEN_LOCATION_CLI   0x1010

◆ BT_MESH_MODEL_ID_GEN_LOCATION_SETUPSRV

#define BT_MESH_MODEL_ID_GEN_LOCATION_SETUPSRV   0x100f

◆ BT_MESH_MODEL_ID_GEN_LOCATION_SRV

#define BT_MESH_MODEL_ID_GEN_LOCATION_SRV   0x100e

◆ BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV

#define BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV   0x1012

◆ BT_MESH_MODEL_ID_GEN_ONOFF_CLI

#define BT_MESH_MODEL_ID_GEN_ONOFF_CLI   0x1001

◆ BT_MESH_MODEL_ID_GEN_ONOFF_SRV

#define BT_MESH_MODEL_ID_GEN_ONOFF_SRV   0x1000

◆ BT_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI

#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI   0x100b

◆ BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV

#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV   0x100a

◆ BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV

#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV   0x1009

◆ BT_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI

#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI   0x1008

◆ BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV

#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV   0x1007

◆ BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV

#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV   0x1006

◆ BT_MESH_MODEL_ID_GEN_PROP_CLI

#define BT_MESH_MODEL_ID_GEN_PROP_CLI   0x1015

◆ BT_MESH_MODEL_ID_GEN_USER_PROP_SRV

#define BT_MESH_MODEL_ID_GEN_USER_PROP_SRV   0x1013

◆ BT_MESH_MODEL_ID_HEALTH_CLI

#define BT_MESH_MODEL_ID_HEALTH_CLI   0x0003

◆ BT_MESH_MODEL_ID_HEALTH_SRV

#define BT_MESH_MODEL_ID_HEALTH_SRV   0x0002

◆ BT_MESH_MODEL_ID_LIGHT_CTL_CLI

#define BT_MESH_MODEL_ID_LIGHT_CTL_CLI   0x1305

◆ BT_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV

#define BT_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV   0x1304

◆ BT_MESH_MODEL_ID_LIGHT_CTL_SRV

#define BT_MESH_MODEL_ID_LIGHT_CTL_SRV   0x1303

◆ BT_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV

#define BT_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV   0x1306

◆ BT_MESH_MODEL_ID_LIGHT_HSL_CLI

#define BT_MESH_MODEL_ID_LIGHT_HSL_CLI   0x1309

◆ BT_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV

#define BT_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV   0x130a

◆ BT_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV

#define BT_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV   0x130b

◆ BT_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV

#define BT_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV   0x1308

◆ BT_MESH_MODEL_ID_LIGHT_HSL_SRV

#define BT_MESH_MODEL_ID_LIGHT_HSL_SRV   0x1307

◆ BT_MESH_MODEL_ID_LIGHT_LC_CLI

#define BT_MESH_MODEL_ID_LIGHT_LC_CLI   0x1311

◆ BT_MESH_MODEL_ID_LIGHT_LC_SETUPSRV

#define BT_MESH_MODEL_ID_LIGHT_LC_SETUPSRV   0x1310

◆ BT_MESH_MODEL_ID_LIGHT_LC_SRV

#define BT_MESH_MODEL_ID_LIGHT_LC_SRV   0x130f

◆ BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI

#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI   0x1302

◆ BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV

#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV   0x1301

◆ BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV

#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV   0x1300

◆ BT_MESH_MODEL_ID_LIGHT_XYL_CLI

#define BT_MESH_MODEL_ID_LIGHT_XYL_CLI   0x130e

◆ BT_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV

#define BT_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV   0x130d

◆ BT_MESH_MODEL_ID_LIGHT_XYL_SRV

#define BT_MESH_MODEL_ID_LIGHT_XYL_SRV   0x130c

◆ BT_MESH_MODEL_ID_SCENE_CLI

#define BT_MESH_MODEL_ID_SCENE_CLI   0x1205

◆ BT_MESH_MODEL_ID_SCENE_SETUP_SRV

#define BT_MESH_MODEL_ID_SCENE_SETUP_SRV   0x1204

◆ BT_MESH_MODEL_ID_SCENE_SRV

#define BT_MESH_MODEL_ID_SCENE_SRV   0x1203

◆ BT_MESH_MODEL_ID_SCHEDULER_CLI

#define BT_MESH_MODEL_ID_SCHEDULER_CLI   0x1208

◆ BT_MESH_MODEL_ID_SCHEDULER_SETUP_SRV

#define BT_MESH_MODEL_ID_SCHEDULER_SETUP_SRV   0x1207

◆ BT_MESH_MODEL_ID_SCHEDULER_SRV

#define BT_MESH_MODEL_ID_SCHEDULER_SRV   0x1206

◆ BT_MESH_MODEL_ID_SENSOR_CLI

#define BT_MESH_MODEL_ID_SENSOR_CLI   0x1102

◆ BT_MESH_MODEL_ID_SENSOR_SETUP_SRV

#define BT_MESH_MODEL_ID_SENSOR_SETUP_SRV   0x1101

◆ BT_MESH_MODEL_ID_SENSOR_SRV

#define BT_MESH_MODEL_ID_SENSOR_SRV   0x1100

◆ BT_MESH_MODEL_ID_TIME_CLI

#define BT_MESH_MODEL_ID_TIME_CLI   0x1202

◆ BT_MESH_MODEL_ID_TIME_SETUP_SRV

#define BT_MESH_MODEL_ID_TIME_SETUP_SRV   0x1201

◆ BT_MESH_MODEL_ID_TIME_SRV

#define BT_MESH_MODEL_ID_TIME_SRV   0x1200

◆ BT_MESH_MODEL_NO_OPS

#define BT_MESH_MODEL_NO_OPS

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

Value:
((struct bt_mesh_model_op []) \
#define BT_MESH_MODEL_OP_END
Definition: access.h:201
Definition: access.h:165

Helper to define an empty opcode list.

◆ BT_MESH_MODEL_NONE

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

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

Helper to define an empty model array

◆ 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 <include/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 <include/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
Definition: access.h:351
int(* update)(struct bt_mesh_model *mod)
Callback for updating the publication buffer.
Definition: access.h:393
struct net_buf_simple * msg
Publication buffer, containing the publication message.
Definition: access.h:376

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 <include/bluetooth/mesh/access.h>

Composition data vendor model entry.

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 <include/bluetooth/mesh/access.h>

Value:
{ \
.vnd.company = (_company), \
.vnd.id = (_id), \
.op = _op, \
.pub = _pub, \
.user_data = _user_data, \
.cb = _cb, \
}

Composition data vendor model entry with callback functions.

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_PUB_TRANSMIT

#define BT_MESH_PUB_TRANSMIT (   count,
  int_ms 
)

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

Value:
(int_ms) / 5)
ZTEST_BMEM int count
Definition: main.c:33
#define BT_MESH_TRANSMIT(count, int_ms)
Encode transmission count & interval steps.
Definition: access.h:290

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 <include/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 <include/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 <include/bluetooth/mesh/access.h>

Value:
(CONFIG_BT_MESH_RX_SEG_MAX * \
BT_MESH_APP_SEG_SDU_MAX)

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

◆ BT_MESH_TRANSMIT

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

#include <include/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 <include/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 <include/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 <include/bluetooth/mesh/access.h>

Special TTL value to request using configured default TTL

◆ BT_MESH_TTL_MAX

#define BT_MESH_TTL_MAX   0x7f

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

Maximum allowed TTL value

◆ BT_MESH_TX_SDU_MAX

#define BT_MESH_TX_SDU_MAX

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

Value:
(CONFIG_BT_MESH_TX_SEG_MAX * \
BT_MESH_APP_SEG_SDU_MAX)

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

Function Documentation

◆ bt_mesh_model_data_store()

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

#include <include/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_elem()

struct bt_mesh_elem * bt_mesh_model_elem ( struct bt_mesh_model mod)

#include <include/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 ( struct bt_mesh_model extending_mod,
struct bt_mesh_model base_mod 
)

#include <include/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.

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()

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

#include <include/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()

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

#include <include/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 <include/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 ( struct bt_mesh_model model)

#include <include/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_publish()

int bt_mesh_model_publish ( struct bt_mesh_model model)

#include <include/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 ( 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 <include/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.