Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
|
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) |
Check if a Bluetooth Mesh address is a unicast address. | |
#define | BT_MESH_ADDR_IS_GROUP(addr) |
Check if a Bluetooth Mesh address is a group address. | |
#define | BT_MESH_ADDR_IS_FIXED_GROUP(addr) |
Check if a Bluetooth Mesh address is a fixed group address. | |
#define | BT_MESH_ADDR_IS_VIRTUAL(addr) |
Check if a Bluetooth Mesh address is a virtual address. | |
#define | BT_MESH_ADDR_IS_RFU(addr) |
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) |
#define | BT_MESH_MODEL_OP_2(b0, b1) |
#define | BT_MESH_MODEL_OP_3(b0, cid) |
#define | BT_MESH_LEN_EXACT(len) |
Macro for encoding exact message length for fixed-length messages. | |
#define | BT_MESH_LEN_MIN(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) |
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) |
Composition data vendor model entry with callback functions and metadata. | |
#define | BT_MESH_MODEL(_id, _op, _pub, _user_data) |
Composition data SIG model entry. | |
#define | BT_MESH_MODEL_VND(_company, _id, _op, _pub, _user_data) |
Composition data vendor model entry. | |
#define | BT_MESH_TRANSMIT(count, int_ms) |
Encode transmission count & interval steps. | |
#define | BT_MESH_TRANSMIT_COUNT(transmit) |
Decode transmit count from a transmit value. | |
#define | BT_MESH_TRANSMIT_INT(transmit) |
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) |
Decode Publish Retransmit count from a given value. | |
#define | BT_MESH_PUB_TRANSMIT_INT(transmit) |
Decode Publish Retransmit interval from a given value. | |
#define | BT_MESH_PUB_MSG_TOTAL(pub) |
Get total number of messages within one publication interval including initial publication. | |
#define | BT_MESH_PUB_MSG_NUM(pub) |
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_elem * | bt_mesh_model_elem (const struct bt_mesh_model *mod) |
Get the element that a model belongs to. | |
const struct bt_mesh_model * | bt_mesh_model_find (const struct bt_mesh_elem *elem, uint16_t id) |
Find a SIG model. | |
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. | |
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. |
Access layer.
#define BT_MESH_ADDR_ALL_NODES 0xffff |
#include <zephyr/bluetooth/mesh/access.h>
all-nodes
#define BT_MESH_ADDR_DFW_NODES 0xfffb |
#include <zephyr/bluetooth/mesh/access.h>
all-directed-forwarding-nodes
#define BT_MESH_ADDR_FRIENDS 0xfffd |
#include <zephyr/bluetooth/mesh/access.h>
all-friends
#define BT_MESH_ADDR_IP_BR_ROUTERS 0xfff9 |
#include <zephyr/bluetooth/mesh/access.h>
all-ipt-border-routers
#define BT_MESH_ADDR_IP_NODES 0xfffa |
#include <zephyr/bluetooth/mesh/access.h>
all-ipt-nodes
#define BT_MESH_ADDR_IS_FIXED_GROUP | ( | addr | ) |
#include <zephyr/bluetooth/mesh/access.h>
Check if a Bluetooth Mesh address is a fixed group address.
#define BT_MESH_ADDR_IS_GROUP | ( | addr | ) |
#include <zephyr/bluetooth/mesh/access.h>
Check if a Bluetooth Mesh address is a group address.
#define BT_MESH_ADDR_IS_RFU | ( | addr | ) |
#include <zephyr/bluetooth/mesh/access.h>
Check if a Bluetooth Mesh address is an RFU address.
#define BT_MESH_ADDR_IS_UNICAST | ( | addr | ) |
#include <zephyr/bluetooth/mesh/access.h>
Check if a Bluetooth Mesh address is a unicast address.
#define BT_MESH_ADDR_IS_VIRTUAL | ( | addr | ) |
#include <zephyr/bluetooth/mesh/access.h>
Check if a Bluetooth Mesh address is a virtual address.
#define BT_MESH_ADDR_PROXIES 0xfffc |
#include <zephyr/bluetooth/mesh/access.h>
all-proxies
#define BT_MESH_ADDR_RELAYS 0xfffe |
#include <zephyr/bluetooth/mesh/access.h>
all-relays
#define BT_MESH_ADDR_UNASSIGNED 0x0000 |
#include <zephyr/bluetooth/mesh/access.h>
unassigned
#define BT_MESH_APP_SEG_SDU_MAX 12 |
#include <zephyr/bluetooth/mesh/access.h>
Maximum size of an access message segment (in octets).
#define BT_MESH_APP_UNSEG_SDU_MAX 15 |
#include <zephyr/bluetooth/mesh/access.h>
Maximum payload size of an unsegmented access message (in octets).
#define BT_MESH_ELEM | ( | _loc, | |
_mods, | |||
_vnd_mods ) |
#include <zephyr/bluetooth/mesh/access.h>
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.
_loc | Location Descriptor. |
_mods | Array of models. |
_vnd_mods | Array of vendor models. |
#define BT_MESH_IS_DEV_KEY | ( | key | ) |
#include <zephyr/bluetooth/mesh/access.h>
Check if a Bluetooth Mesh key is a device key.
#define BT_MESH_KEY_ANY 0xffff |
#include <zephyr/bluetooth/mesh/access.h>
Any key index.
#define BT_MESH_KEY_DEV 0xfffe |
#include <zephyr/bluetooth/mesh/access.h>
Device key.
#define BT_MESH_KEY_DEV_ANY 0xfffc |
#include <zephyr/bluetooth/mesh/access.h>
Any device key.
#define BT_MESH_KEY_DEV_LOCAL BT_MESH_KEY_DEV |
#include <zephyr/bluetooth/mesh/access.h>
Local device key.
#define BT_MESH_KEY_DEV_REMOTE 0xfffd |
#include <zephyr/bluetooth/mesh/access.h>
Remote device key.
#define BT_MESH_KEY_UNUSED 0xffff |
#include <zephyr/bluetooth/mesh/access.h>
Key unused.
#define BT_MESH_LEN_EXACT | ( | len | ) |
#include <zephyr/bluetooth/mesh/access.h>
Macro for encoding exact message length for fixed-length messages.
#define BT_MESH_LEN_MIN | ( | len | ) |
#include <zephyr/bluetooth/mesh/access.h>
Macro for encoding minimum message length for variable-length messages.
#define BT_MESH_MODEL | ( | _id, | |
_op, | |||
_pub, | |||
_user_data ) |
#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++.
_id | Model ID. |
_op | Array of model opcode handlers. |
_pub | Model publish parameters. |
_user_data | User data for the model. |
#define BT_MESH_MODEL_CB | ( | _id, | |
_op, | |||
_pub, | |||
_user_data, | |||
_cb ) |
#include <zephyr/bluetooth/mesh/access.h>
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++.
_id | Model ID. |
_op | Array of model opcode handlers. |
_pub | Model publish parameters. |
_user_data | User data for the model. |
_cb | Callback structure, or NULL to keep no callbacks. |
#define BT_MESH_MODEL_CNT_CB | ( | _id, | |
_op, | |||
_pub, | |||
_user_data, | |||
_keys, | |||
_grps, | |||
_cb ) |
#include <zephyr/bluetooth/mesh/access.h>
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++.
_id | Model ID. |
_op | Array of model opcode handlers. |
_pub | Model publish parameters. |
_user_data | User data for the model. |
_keys | Number of keys that can be bound to the model. Shall not exceed CONFIG_BT_MESH_MODEL_KEY_COUNT . |
_grps | Number of addresses that the model can be subscribed to. Shall not exceed CONFIG_BT_MESH_MODEL_GROUP_COUNT . |
_cb | Callback structure, or NULL to keep no callbacks. |
#define BT_MESH_MODEL_CNT_VND_CB | ( | _company, | |
_id, | |||
_op, | |||
_pub, | |||
_user_data, | |||
_keys, | |||
_grps, | |||
_cb ) |
#include <zephyr/bluetooth/mesh/access.h>
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++.
_company | Company ID. |
_id | Model ID. |
_op | Array of model opcode handlers. |
_pub | Model publish parameters. |
_user_data | User data for the model. |
_keys | Number of keys that can be bound to the model. Shall not exceed CONFIG_BT_MESH_MODEL_KEY_COUNT . |
_grps | Number of addresses that the model can be subscribed to. Shall not exceed CONFIG_BT_MESH_MODEL_GROUP_COUNT . |
_cb | Callback structure, or NULL to keep no callbacks. |
#define BT_MESH_MODEL_METADATA_CB | ( | _id, | |
_op, | |||
_pub, | |||
_user_data, | |||
_cb, | |||
_metadata ) |
#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++.
_id | Model ID. |
_op | Array of model opcode handlers. |
_pub | Model publish parameters. |
_user_data | User data for the model. |
_cb | Callback structure, or NULL to keep no callbacks. |
_metadata | Metadata structure. Used if CONFIG_BT_MESH_LARGE_COMP_DATA_SRV is enabled. |
#define BT_MESH_MODEL_NO_OPS |
#include <zephyr/bluetooth/mesh/access.h>
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++.
#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++.
#define BT_MESH_MODEL_OP_1 | ( | b0 | ) |
#include <zephyr/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_OP_2 | ( | b0, | |
b1 ) |
#include <zephyr/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_OP_3 | ( | b0, | |
cid ) |
#include <zephyr/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_OP_END { 0, 0, NULL } |
#define BT_MESH_MODEL_PUB_DEFINE | ( | _name, | |
_update, | |||
_msg_len ) |
#include <zephyr/bluetooth/mesh/access.h>
Define a model publication context.
_name | Variable name given to the context. |
_update | Optional message update callback (may be NULL). |
_msg_len | Length of the publication message. |
#define BT_MESH_MODEL_VND | ( | _company, | |
_id, | |||
_op, | |||
_pub, | |||
_user_data ) |
#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++.
_company | Company ID. |
_id | Model ID. |
_op | Array of model opcode handlers. |
_pub | Model publish parameters. |
_user_data | User data for the model. |
#define 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.
This macro uses compound literal feature of C99 standard and thus is available only from C, not C++.
_company | Company ID. |
_id | Model ID. |
_op | Array of model opcode handlers. |
_pub | Model publish parameters. |
_user_data | User data for the model. |
_cb | Callback structure, or NULL to keep no callbacks. |
#define BT_MESH_MODEL_VND_METADATA_CB | ( | _company, | |
_id, | |||
_op, | |||
_pub, | |||
_user_data, | |||
_cb, | |||
_metadata ) |
#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++.
_company | Company ID. |
_id | Model ID. |
_op | Array of model opcode handlers. |
_pub | Model publish parameters. |
_user_data | User data for the model. |
_cb | Callback structure, or NULL to keep no callbacks. |
_metadata | Metadata structure. Used if CONFIG_BT_MESH_LARGE_COMP_DATA_SRV is enabled. |
#define BT_MESH_MODELS_METADATA_END { 0, 0, NULL } |
#define BT_MESH_MODELS_METADATA_ENTRY | ( | _len, | |
_id, | |||
_data ) |
#include <zephyr/bluetooth/mesh/access.h>
Initialize a Models Metadata entry structure in a list.
_len | Length of the metadata entry. |
_id | ID of the Models Metadata entry. |
_data | Pointer to a contiguous memory that contains the metadata. |
#define BT_MESH_MODELS_METADATA_NONE NULL |
#include <zephyr/bluetooth/mesh/access.h>
Helper to define an empty Models metadata array.
#define BT_MESH_PUB_MSG_NUM | ( | pub | ) |
#include <zephyr/bluetooth/mesh/access.h>
Get message number within one publication interval.
Meant to be used inside bt_mesh_model_pub::update.
pub | Model publication context. |
#define BT_MESH_PUB_MSG_TOTAL | ( | pub | ) |
#include <zephyr/bluetooth/mesh/access.h>
Get total number of messages within one publication interval including initial publication.
pub | Model publication context. |
#define BT_MESH_PUB_TRANSMIT | ( | count, | |
int_ms ) |
#include <zephyr/bluetooth/mesh/access.h>
Encode Publish Retransmit count & interval steps.
count | Number of retransmissions (first transmission is excluded). |
int_ms | Interval steps in milliseconds. Must be greater than 0 and a multiple of 50. |
#define BT_MESH_PUB_TRANSMIT_COUNT | ( | transmit | ) |
#include <zephyr/bluetooth/mesh/access.h>
Decode Publish Retransmit count from a given value.
transmit | Encoded Publish Retransmit count & interval value. |
#define BT_MESH_PUB_TRANSMIT_INT | ( | transmit | ) |
#include <zephyr/bluetooth/mesh/access.h>
Decode Publish Retransmit interval from a given value.
transmit | Encoded Publish Retransmit count & interval value. |
#define BT_MESH_RX_SDU_MAX |
#include <zephyr/bluetooth/mesh/access.h>
Maximum possible payload size of an incoming access message (in octets).
#define BT_MESH_RX_SEG_MAX 0 |
#include <zephyr/bluetooth/mesh/access.h>
Maximum number of segments supported for incoming messages.
#define BT_MESH_TRANSMIT | ( | count, | |
int_ms ) |
#include <zephyr/bluetooth/mesh/access.h>
Encode transmission count & interval steps.
count | Number of retransmissions (first transmission is excluded). |
int_ms | Interval steps in milliseconds. Must be greater than 0, less than or equal to 320, and a multiple of 10. |
#define BT_MESH_TRANSMIT_COUNT | ( | transmit | ) |
#include <zephyr/bluetooth/mesh/access.h>
Decode transmit count from a transmit value.
transmit | Encoded transmit count & interval value. |
#define BT_MESH_TRANSMIT_INT | ( | transmit | ) |
#include <zephyr/bluetooth/mesh/access.h>
Decode transmit interval from a transmit value.
transmit | Encoded transmit count & interval value. |
#define BT_MESH_TTL_DEFAULT 0xff |
#include <zephyr/bluetooth/mesh/access.h>
Special TTL value to request using configured default TTL.
#define BT_MESH_TTL_MAX 0x7f |
#include <zephyr/bluetooth/mesh/access.h>
Maximum allowed TTL value.
#define BT_MESH_TX_SDU_MAX |
#include <zephyr/bluetooth/mesh/access.h>
Maximum possible payload size of an outgoing access message (in octets).
#define BT_MESH_TX_SEG_MAX 0 |
#include <zephyr/bluetooth/mesh/access.h>
Maximum number of segments supported for outgoing messages.
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.
comp2
comp2 | Pointer to composition data page 2. |
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.
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.
corresponding_mod | Mesh model that is corresponding to the base model. |
base_mod | The model being corresponded to. |
0 | Successfully saved correspondence to the base_mod model. |
-ENOMEM | There is no more space to save this relation. |
-ENOTSUP | Composition Data Page 1 is not supported. |
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.
mod | Mesh model. |
vnd | This is a vendor model. |
name | Name/key of the settings item. Only SETTINGS_MAX_DIR_DEPTH bytes will be used at most. |
data | Model data to store, or NULL to delete any model data. |
data_len | Length of the model data. |
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.
mod | Mesh model. |
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.
mod | Mesh model. |
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.
extending_mod | Mesh model that is extending the base model. |
base_mod | The model being extended. |
0 | Successfully extended the base_mod model. |
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.
elem | Element to search for the model in. |
id | Model ID of the model. |
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.
elem | Element to search for the model in. |
company | Company ID of the model. |
id | Model ID of the model. |
|
inlinestatic |
#include <zephyr/bluetooth/mesh/access.h>
Get whether the model is in the primary element of the device.
mod | Mesh model. |
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.
model | The model to check. |
true | If model is extended by another model, otherwise false |
|
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.
model | Mesh Model that supports publication. |
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.
model | Mesh (client) Model that's publishing the message. |
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.
model | Mesh (client) Model that the message belongs to. |
ctx | Message context, includes keys, TTL, etc. |
msg | Access Layer payload (the actual message to be sent). |
cb | Optional "message sent" callback. |
cb_data | User data to be passed to the callback. |
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.