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 |
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_elem * | bt_mesh_model_elem (struct bt_mesh_model *mod) |
Get the element that a model belongs to. More... | |
struct bt_mesh_model * | bt_mesh_model_find (const struct bt_mesh_elem *elem, uint16_t id) |
Find a SIG model. More... | |
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. 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... | |
Access layer.
#define BT_MESH_ADDR_ALL_NODES 0xffff |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_ADDR_FRIENDS 0xfffd |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_ADDR_IS_GROUP | ( | addr | ) | ((addr) >= 0xc000 && (addr) <= 0xff00) |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_ADDR_IS_RFU | ( | addr | ) | ((addr) >= 0xff00 && (addr) <= 0xfffb) |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_ADDR_IS_UNICAST | ( | addr | ) | ((addr) && (addr) < 0x8000) |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_ADDR_IS_VIRTUAL | ( | addr | ) | ((addr) >= 0x8000 && (addr) < 0xc000) |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_ADDR_PROXIES 0xfffc |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_ADDR_RELAYS 0xfffe |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_ADDR_UNASSIGNED 0x0000 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_APP_SEG_SDU_MAX 12 |
#include <include/bluetooth/mesh/access.h>
Maximum payload size of an access message (in octets).
#define BT_MESH_ELEM | ( | _loc, | |
_mods, | |||
_vnd_mods | |||
) |
#include <include/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 <include/bluetooth/mesh/access.h>
#define BT_MESH_KEY_ANY 0xffff |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_KEY_DEV 0xfffe |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_KEY_DEV_ANY 0xfffc |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_KEY_DEV_LOCAL BT_MESH_KEY_DEV |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_KEY_DEV_REMOTE 0xfffd |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_KEY_UNUSED 0xffff |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_LEN_EXACT | ( | len | ) | (-len) |
#include <include/bluetooth/mesh/access.h>
Macro for encoding exact message length for fixed-length messages.
#define BT_MESH_LEN_MIN | ( | len | ) | (len) |
#include <include/bluetooth/mesh/access.h>
Macro for encoding minimum message length for variable-length messages.
#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.
_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 <include/bluetooth/mesh/access.h>
Composition data SIG model entry with callback functions.
_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_ID_CFG_CLI 0x0001 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_CFG_SRV 0x0000 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV 0x1011 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_BATTERY_CLI 0x100d |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_BATTERY_SRV 0x100c |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV 0x1014 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI 0x1005 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV 0x1004 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_LEVEL_CLI 0x1003 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_LEVEL_SRV 0x1002 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_LOCATION_CLI 0x1010 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_LOCATION_SETUPSRV 0x100f |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_LOCATION_SRV 0x100e |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV 0x1012 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_ONOFF_CLI 0x1001 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_ONOFF_SRV 0x1000 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI 0x100b |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV 0x100a |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV 0x1009 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI 0x1008 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV 0x1007 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV 0x1006 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_PROP_CLI 0x1015 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_GEN_USER_PROP_SRV 0x1013 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_HEALTH_CLI 0x0003 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_HEALTH_SRV 0x0002 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_CTL_CLI 0x1305 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV 0x1304 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_CTL_SRV 0x1303 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV 0x1306 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_HSL_CLI 0x1309 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV 0x130a |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV 0x130b |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV 0x1308 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_HSL_SRV 0x1307 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_LC_CLI 0x1311 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_LC_SETUPSRV 0x1310 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_LC_SRV 0x130f |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI 0x1302 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV 0x1301 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV 0x1300 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_XYL_CLI 0x130e |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV 0x130d |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_LIGHT_XYL_SRV 0x130c |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_SCENE_CLI 0x1205 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_SCENE_SETUP_SRV 0x1204 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_SCENE_SRV 0x1203 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_SCHEDULER_CLI 0x1208 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_SCHEDULER_SETUP_SRV 0x1207 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_SCHEDULER_SRV 0x1206 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_SENSOR_CLI 0x1102 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_SENSOR_SETUP_SRV 0x1101 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_SENSOR_SRV 0x1100 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_TIME_CLI 0x1202 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_TIME_SETUP_SRV 0x1201 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_ID_TIME_SRV 0x1200 |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_NO_OPS |
#include <include/bluetooth/mesh/access.h>
Helper to define an empty opcode list.
#define BT_MESH_MODEL_NONE ((struct bt_mesh_model []){}) |
#include <include/bluetooth/mesh/access.h>
Helper to define an empty model array
#define BT_MESH_MODEL_OP_1 | ( | b0 | ) | (b0) |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_OP_2 | ( | b0, | |
b1 | |||
) | (((b0) << 8) | (b1)) |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_OP_3 | ( | b0, | |
cid | |||
) | ((((b0) << 16) | 0xc00000) | (cid)) |
#include <include/bluetooth/mesh/access.h>
#define BT_MESH_MODEL_OP_END { 0, 0, NULL } |
#include <include/bluetooth/mesh/access.h>
End of the opcode list. Must always be present.
#define BT_MESH_MODEL_PUB_DEFINE | ( | _name, | |
_update, | |||
_msg_len | |||
) |
#include <include/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 | |||
) | BT_MESH_MODEL_VND_CB(_company, _id, _op, _pub, _user_data, NULL) |
#include <include/bluetooth/mesh/access.h>
Composition data vendor model entry.
_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 <include/bluetooth/mesh/access.h>
Composition data vendor model entry with callback functions.
_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_PUB_TRANSMIT | ( | count, | |
int_ms | |||
) |
#include <include/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 | ) | BT_MESH_TRANSMIT_COUNT(transmit) |
#include <include/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 | ) | ((((transmit) >> 3) + 1) * 50) |
#include <include/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 <include/bluetooth/mesh/access.h>
Maximum possible payload size of an incoming access message (in octets).
#include <include/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. |
#include <include/bluetooth/mesh/access.h>
Decode transmit count from a transmit value.
transmit | Encoded transmit count & interval value. |
#define BT_MESH_TRANSMIT_INT | ( | transmit | ) | ((((transmit) >> 3) + 1) * 10) |
#include <include/bluetooth/mesh/access.h>
Decode transmit interval from a transmit value.
transmit | Encoded transmit count & interval value. |
#define BT_MESH_TTL_DEFAULT 0xff |
#include <include/bluetooth/mesh/access.h>
Special TTL value to request using configured default TTL
#define BT_MESH_TTL_MAX 0x7f |
#include <include/bluetooth/mesh/access.h>
Maximum allowed TTL value
#define BT_MESH_TX_SDU_MAX |
#include <include/bluetooth/mesh/access.h>
Maximum possible payload size of an outgoing access message (in octets).
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.
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. |
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.
mod | Mesh model. |
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.
extending_mod | Mesh model that is extending the base model. |
base_mod | The model being extended. |
0 | Successfully extended the base_mod model. |
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.
elem | Element to search for the model in. |
id | Model ID of the model. |
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.
elem | Element to search for the model in. |
company | Company ID of the model. |
id | Model ID of the model. |
|
inlinestatic |
#include <include/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 | ( | struct bt_mesh_model * | model | ) |
#include <include/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 |
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.
model | Mesh (client) Model that's publishing the message. |
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.
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. |