Skip to content

Commit deeb4f3

Browse files
trond-snekviknashif
authored andcommitted
Bluetooth: Mesh: Restructure doc
Adds a deeper hierarchy to the Bluetooth Mesh documentation by moving the modules in separate pages with a brief description of the concepts in each module. Adds the full list of specification defined Health model faults. Signed-off-by: Trond Einar Snekvik <[email protected]>
1 parent 73ed1ba commit deeb4f3

File tree

14 files changed

+630
-93
lines changed

14 files changed

+630
-93
lines changed

doc/reference/bluetooth/mesh.rst

Lines changed: 12 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,21 @@
11
.. _bluetooth_mesh:
22

3-
4-
53
Bluetooth Mesh Profile
64
######################
75

6+
The Bluetooth Mesh Profile adds secure wireless multi-hop communication for
7+
Bluetooth Low Energy. This module implements the
8+
`Bluetooth Mesh Profile Specification v1.0.1 <https://www.bluetooth.com/specifications/mesh-specifications/>`_.
89

10+
Read more about Bluetooth Mesh on the
11+
`Bluetooth SIG Website <https://www.bluetooth.com/bluetooth-resources/?tags=mesh>`_.
912

10-
API Reference
11-
**************
12-
13-
Mesh Profile
14-
============
15-
16-
.. doxygengroup:: bt_mesh
17-
:project: Zephyr
18-
19-
Bluetooth Mesh Access Layer
20-
===========================
21-
22-
.. doxygengroup:: bt_mesh_access
23-
:project: Zephyr
24-
25-
Bluetooth Mesh Configuration Client Model
26-
=========================================
27-
28-
.. doxygengroup:: bt_mesh_cfg_cli
29-
:project: Zephyr
30-
31-
Bluetooth Mesh Configuration Server Model
32-
=========================================
33-
34-
.. doxygengroup:: bt_mesh_cfg_srv
35-
:project: Zephyr
36-
37-
Bluetooth Mesh Health Client Model
38-
==================================
39-
40-
.. doxygengroup:: bt_mesh_health_cli
41-
:project: Zephyr
42-
43-
Bluetooth Mesh Health Server Model
44-
==================================
45-
46-
.. doxygengroup:: bt_mesh_health_srv
47-
:project: Zephyr
48-
49-
Bluetooth Mesh Provisioning
50-
===========================
51-
52-
.. doxygengroup:: bt_mesh_prov
53-
:project: Zephyr
13+
.. toctree::
14+
:maxdepth: 1
5415

55-
Bluetooth Mesh Proxy
56-
====================
16+
mesh/core.rst
17+
mesh/access.rst
18+
mesh/models.rst
19+
mesh/provisioning.rst
20+
mesh/proxy.rst
5721

58-
.. doxygengroup:: bt_mesh_proxy
59-
:project: Zephyr
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
.. _bluetooth_mesh_access:
2+
3+
Access
4+
######
5+
6+
The Bluetooth Mesh access layer is the application's interface to the mesh
7+
network. The access layer provides mechanisms for compartmentalizing the node
8+
behavior into elements and models, which are implemented by the application.
9+
10+
Mesh models
11+
***********
12+
13+
The functionality of a mesh node is represented by models. A model implements
14+
a single behavior the node supports, like being a light, a sensor or a
15+
thermostat. The mesh models are grouped into *elements*. Each element is
16+
assigned its own unicast address, and may only contain one of each type of
17+
model. Conventionally, each element represents a single aspect of the mesh
18+
node behavior. For instance, a node that contains a sensor, two lights and a
19+
power outlet would spread this functionality across four elements, with each
20+
element instantiating all the models required for a single aspect of the
21+
supported behavior.
22+
23+
The node's element and model structure is specified in the node composition
24+
data, which is passed to :cpp:func:`bt_mesh_init()` during initialization. The
25+
Bluetooth SIG have defined a set of foundation models (see
26+
:ref:`bluetooth_mesh_models`) and a set of models for implementing common
27+
behavior in the `Bluetooth Mesh Model Specification
28+
<https://www.bluetooth.com/specifications/mesh-specifications/>`_. All models
29+
not specified by the Bluetooth SIG are vendor models, and must be tied to a
30+
Company ID.
31+
32+
Mesh Models have several parameters that can be configured either through
33+
initialization of the mesh stack or with the
34+
:ref:`bluetooth_mesh_models_cfg_srv`:
35+
36+
Opcode list
37+
===========
38+
39+
The opcode list contains all message opcodes the model can receive, as well as
40+
the minimum acceptable payload length and the callback to pass them to. Models
41+
can support any number of opcodes, but each opcode can only be listed by one
42+
model in each element.
43+
44+
The full opcode list must be passed to the model structure in the composition
45+
data, and cannot be changed at runtime. The end of the opcode list is
46+
determined by the special :c:macro:`BT_MESH_MODEL_OP_END` entry. This entry
47+
must always be present in the opcode list, unless the list is empty. In that
48+
case, :c:macro:`BT_MESH_MODEL_NO_OPS` should be used in place of a proper
49+
opcode list definition.
50+
51+
AppKey list
52+
===========
53+
54+
The AppKey list contains all the application keys the model can receive
55+
messages on. Only messages encrypted with application keys in the AppKey list
56+
will be passed to the model.
57+
58+
The maximum number of supported application keys each model can hold is
59+
configured with the :option:`CONFIG_BT_MESH_MODEL_KEY_COUNT` configuration
60+
option. The contents of the AppKey list is managed by the
61+
:ref:`bluetooth_mesh_models_cfg_srv`.
62+
63+
Subscription list
64+
=================
65+
66+
A model will process all messages addressed to the unicast address of their
67+
element (given that the utilized application key is present in the AppKey
68+
list). Additionally, the model will process packets addressed to any group or
69+
virtual address in its subscription list. This allows nodes to address
70+
multiple nodes throughout the mesh network with a single message.
71+
72+
The maximum number of supported addresses in the Subscription list each model
73+
can hold is configured with the :option:`CONFIG_BT_MESH_MODEL_GROUP_COUNT`
74+
configuration option. The contents of the subscription list is managed by the
75+
:ref:`bluetooth_mesh_models_cfg_srv`.
76+
77+
Model publication
78+
=================
79+
80+
The models may send messages in two ways:
81+
82+
* By specifying a set of message parameters in a :cpp:type:`bt_mesh_msg_ctx`,
83+
and calling :cpp:func:`bt_mesh_model_send()`.
84+
* By setting up a :cpp:type:`bt_mesh_model_pub` structure and calling
85+
:cpp:func:`bt_mesh_model_publish()`.
86+
87+
When publishing messages with :cpp:func:`bt_mesh_model_publish()`, the model
88+
will use the publication parameters configured by the
89+
:ref:`bluetooth_mesh_models_cfg_srv`. This is the recommended way to send
90+
unprompted model messages, as it passes the responsibility of selecting
91+
message parameters to the network administrator, which likely knows more about
92+
the mesh network than the individual nodes will.
93+
94+
To support publishing with the publication parameters, the model must allocate
95+
a packet buffer for publishing, and pass it to
96+
:cpp:var:`bt_mesh_model_pub::msg`. The Config Server may also set up period
97+
publication for the publication message. To support this, the model must
98+
populate the :cpp:var:`bt_mesh_model_pub::update` callback. The
99+
:cpp:var:`bt_mesh_model_pub::update` callback will be called right before the
100+
message is published, allowing the model to change the payload to reflect its
101+
current state.
102+
103+
Extended models
104+
===============
105+
106+
The Bluetooth Mesh specification allows the Mesh models to extend each other.
107+
When a model extends another, it inherits that model's functionality, and
108+
extension can be used to construct complex models out of simple ones,
109+
leveraging the existing model functionality to avoid defining new opcodes.
110+
Models may extend any number of models, from any element. When one model
111+
extends another in the same element, the two models will share subscription
112+
lists. The mesh stack implements this by merging the subscription lists of the
113+
two models into one, combining the number of subscriptions the models can have
114+
in total. Models may extend models that extend others, creating an "extension
115+
tree". All models in an extension tree share a single subscription list per
116+
element it spans.
117+
118+
Model extensions are done by calling :cpp:func:`bt_mesh_model_extend()` during
119+
initialization. A model can only be extended by one other model, and
120+
extensions cannot be circular. Note that binding of node states and other
121+
relationships between the models must be defined by the model implementations.
122+
123+
The model extension concept adds some overhead in the access layer packet
124+
processing, and must be explicitly enabled with
125+
:option:`CONFIG_BT_MESH_MODEL_EXTENSIONS` to have any effect.
126+
127+
Model data storage
128+
==================
129+
130+
Mesh models may have data associated with each model instance that needs to be
131+
stored persistently. The access API provides a mechanism for storing this
132+
data, leveraging the internal model instance encoding scheme. Models can store
133+
one user defined data entry per instance by calling
134+
:cpp:func:`bt_mesh_model_data_store()`. To be able to read out the data the
135+
next time the device reboots, the model's
136+
:cpp:var:`bt_mesh_model_cb::settings_set()` callback must be populated. This
137+
callback gets called when model specific data is found in the persistent
138+
storage. The model can retrieve the data by calling the ``read_cb`` passed as
139+
a parameter to the callback. See the :ref:`settings` module documentation for
140+
details.
141+
142+
API reference
143+
*************
144+
145+
.. doxygengroup:: bt_mesh_access
146+
:project: Zephyr
147+
:members:
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. _bluetooth_mesh_models_cfg_cli:
2+
3+
Configuration Client
4+
####################
5+
6+
Configuration Client model is a foundation model defined by the Bluetooth Mesh
7+
specification. It provides functionality for configuring most parameters of a
8+
mesh node, including encryption keys, model configuration and feature
9+
enabling.
10+
11+
The Configuration Client model communicates with a
12+
:ref:`bluetooth_mesh_models_cfg_srv` model using the device key of the target
13+
node. The Configuration Client model may communicate with servers on other
14+
nodes or self-configure through the local Configuration Server model.
15+
16+
All configuration functions in the Configuration Client API have ``net_idx``
17+
and ``addr`` as their first parameters. These should be set to the network
18+
index and primary unicast address that the target node was provisioned with.
19+
20+
The Configuration Client model is optional, but should be instantiated on the
21+
first element if it is present in the composition data.
22+
23+
API reference
24+
*************
25+
26+
.. doxygengroup:: bt_mesh_cfg_cli
27+
:project: Zephyr
28+
:members:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.. _bluetooth_mesh_models_cfg_srv:
2+
3+
Configuration Server
4+
####################
5+
6+
Configuration Server model is a foundation model defined by the Bluetooth Mesh
7+
specification. The Configuration Server model controls most parameters of the
8+
mesh node. It does not have an API of its own, but relies on a
9+
:ref:`bluetooth_mesh_models_cfg_cli` to control it.
10+
11+
The application can configure the initial parameters of the Configuration
12+
Server model through the :cpp:type:`bt_mesh_cfg_srv` instance passed to
13+
:c:macro:`BT_MESH_MODEL_CFG_SRV`. Note that if the mesh node stored changes to
14+
this configuration in the settings subsystem, the initial values may be
15+
overwritten upon loading.
16+
17+
The Configuration Server model is mandatory on all Bluetooth Mesh nodes, and
18+
should be instantiated in the first element.
19+
20+
API reference
21+
*************
22+
23+
.. doxygengroup:: bt_mesh_cfg_srv
24+
:project: Zephyr
25+
:members:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.. _bluetooth_mesh_core:
2+
3+
Core API
4+
########
5+
6+
The Bluetooth Mesh Core API provides functionality for managing the general
7+
Bluetooth Mesh state.
8+
9+
Low Power Node
10+
**************
11+
12+
The Low Power Node (LPN) role allows battery powered devices to participate in
13+
a mesh network as a leaf node. An LPN interacts with the mesh network through
14+
a Friend node, which is responsible for relaying any messages directed to the
15+
LPN. The LPN saves power by keeping its radio turned off, and only wakes up to
16+
either send messages or poll the Friend node for any incoming messages.
17+
18+
The radio control and polling is managed automatically by the mesh stack, but
19+
the LPN API allows the application to trigger the polling at any time through
20+
:cpp:func:`bt_mesh_lpn_poll()`. The LPN operation parameters, including poll
21+
interval, poll event timing and Friend requirements is controlled through the
22+
:option:`CONFIG_BT_MESH_LOW_POWER` option and related configuration options.
23+
24+
API reference
25+
**************
26+
27+
.. doxygengroup:: bt_mesh
28+
:project: Zephyr
29+
:members:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.. _bluetooth_mesh_models_health_cli:
2+
3+
Health Client
4+
#############
5+
6+
The Health Client model interacts with a Health Server model to read out
7+
diagnostics and control the node's attention state.
8+
9+
All message passing functions in the Health Client API have ``net_idx`` and
10+
``addr`` as their first parameters. These should be set to the network index
11+
and primary unicast address that the target node was provisioned with.
12+
13+
The Health Client model is optional, and may be instantiated in any element.
14+
However, if a Health Client model is instantiated in an element other than the
15+
first, an instance must also be present in the first element.
16+
17+
See :ref:`bluetooth_mesh_health_faults` for a list of specification defined
18+
fault values.
19+
20+
API reference
21+
*************
22+
23+
.. doxygengroup:: bt_mesh_health_cli
24+
:project: Zephyr
25+
:members:
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
.. _bluetooth_mesh_models_health_srv:
2+
3+
Health Server
4+
#############
5+
6+
The Health Server model provides attention callbacks and node diagnostics for
7+
:ref:`bluetooth_mesh_models_health_cli` models. It is primarily used to report
8+
faults in the mesh node and map the mesh nodes to their physical location.
9+
10+
Faults
11+
******
12+
13+
The Health Server model may report a list of faults that have occurred in the
14+
device's lifetime. Typically, the faults are events or conditions that may
15+
alter the behavior of the node, like power outages or faulty peripherals.
16+
Faults are split into warnings and errors. Warnings indicate conditions that
17+
are close to the limits of what the node is designed to withstand, but not
18+
necessarily damaging to the device. Errors indicate conditions that are
19+
outside of the node's design limits, and may have caused invalid behavior or
20+
permanent damage to the device.
21+
22+
Fault values ``0x01`` to ``0x7f`` are reserved for the Bluetooth Mesh
23+
specification, and the full list of specification defined faults are available
24+
in :ref:`bluetooth_mesh_health_faults`. Fault values ``0x80`` to ``0xff`` are
25+
vendor specific. The list of faults are always reported with a company ID to
26+
help interpreting the vendor specific faults.
27+
28+
.. _bluetooth_mesh_models_health_srv_attention:
29+
30+
Attention state
31+
***************
32+
33+
The attention state is used to make the device call attention to itself
34+
through some physical behavior like blinking, playing a sound or vibrating.
35+
The attention state may be used during provisioning to let the user know which
36+
device they're provisioning, as well as through the Health models at runtime.
37+
38+
The attention state is always assigned a timeout in the range of one to 255
39+
seconds when enabled. The Health Server API provides two callbacks for the
40+
application to run their attention calling behavior:
41+
:cpp:var:`bt_mesh_health_srv_cb::attn_on` is called at the beginning of the
42+
attention period, :cpp:var:`bt_mesh_health_srv_cb::attn_off` is called at
43+
the end.
44+
45+
The remaining time for the attention period may be queried through
46+
:cpp:var:`bt_mesh_health_srv::attn_timer`.
47+
48+
API reference
49+
*************
50+
51+
.. doxygengroup:: bt_mesh_health_srv
52+
:project: Zephyr
53+
:members:
54+
55+
56+
.. _bluetooth_mesh_health_faults:
57+
58+
Bluetooth Mesh Health Faults
59+
============================
60+
61+
Fault values defined by the Bluetooth Mesh specification.
62+
63+
.. doxygengroup:: bt_mesh_health_faults
64+
:project: Zephyr
65+

0 commit comments

Comments
 (0)