xref: /nrf52832-nimble/packages/NimBLE-latest/apps/blemesh_models_example_2/README.md (revision 042d53a763ad75cb1465103098bb88c245d95138)
1*042d53a7SEvalZero#### Bluetooth: Mesh Generic OnOff, Generic Level, Lighting & Vendor Models
2*042d53a7SEvalZero
3*042d53a7SEvalZero##### Overview
4*042d53a7SEvalZero********
5*042d53a7SEvalZero
6*042d53a7SEvalZeroThis is a application demonstrating a Bluetooth mesh node in
7*042d53a7SEvalZerowhich Root element has following models
8*042d53a7SEvalZero
9*042d53a7SEvalZero- Generic OnOff Server
10*042d53a7SEvalZero- Generic OnOff Client
11*042d53a7SEvalZero- Generic Level Server
12*042d53a7SEvalZero- Generic Level Client
13*042d53a7SEvalZero- Generic Power OnOff Server
14*042d53a7SEvalZero- Generic Power OnOff Setup Server
15*042d53a7SEvalZero- Generic Power OnOff Client
16*042d53a7SEvalZero- Light Lightness Server
17*042d53a7SEvalZero- Light Lightness Setup Server
18*042d53a7SEvalZero- Light Lightness Client
19*042d53a7SEvalZero- Light CTL Server
20*042d53a7SEvalZero- Light CTL Setup Server
21*042d53a7SEvalZero- Light CTL Client
22*042d53a7SEvalZero- Vendor Model
23*042d53a7SEvalZero
24*042d53a7SEvalZeroAnd Secondary element has following models
25*042d53a7SEvalZero
26*042d53a7SEvalZero- Generic OnOff Server
27*042d53a7SEvalZero- Generic OnOff Client
28*042d53a7SEvalZero- Generic Level Server
29*042d53a7SEvalZero- Generic Level Client
30*042d53a7SEvalZero- Light CTL Temperature Server
31*042d53a7SEvalZero
32*042d53a7SEvalZeroPrior to provisioning, an unprovisioned beacon is broadcast that contains
33*042d53a7SEvalZeroa unique UUID. Each button controls the state of its
34*042d53a7SEvalZerocorresponding LED and does not initiate any mesh activity
35*042d53a7SEvalZero
36*042d53a7SEvalZero##### Associations of Models with hardware
37*042d53a7SEvalZero************************************
38*042d53a7SEvalZeroFor the nRF52840-PDK board, these are the model associations:
39*042d53a7SEvalZero
40*042d53a7SEvalZero* LED1 is associated with generic OnOff Server's state which is part of Root element
41*042d53a7SEvalZero* LED2 is associated with Vendor Model which is part of Root element
42*042d53a7SEvalZero* LED3 is associated with generic Level (ROOT) / Light Lightness Actual value
43*042d53a7SEvalZero* LED4 is associated with generic Level (Secondary) / Light CTL Temperature value
44*042d53a7SEvalZero* Button1 and Button2 are associated with gen. OnOff Client or Vendor Model which is part of Root element
45*042d53a7SEvalZero* Button3 and Button4 are associated with gen. Level Client / Light Lightness Client / Light CTL Client which is part of Root element
46*042d53a7SEvalZero
47*042d53a7SEvalZeroStates of Servers are bounded as per Bluetooth SIG Mesh Model Specification v1.0
48*042d53a7SEvalZero
49*042d53a7SEvalZeroAfter provisioning, the button clients must
50*042d53a7SEvalZerobe configured to publish and the LED servers to subscribe.
51*042d53a7SEvalZeroIf a server is provided with a publish address, it will
52*042d53a7SEvalZeroalso publish its relevant status.
53*042d53a7SEvalZero
54*042d53a7SEvalZero##### Requirements
55*042d53a7SEvalZero************
56*042d53a7SEvalZeroThis sample has been tested on the Nordic nRF52840-PDK board, but would
57*042d53a7SEvalZerolikely also run on the nrf52_pca10040 board.
58*042d53a7SEvalZero
59*042d53a7SEvalZero
60*042d53a7SEvalZero##### Running
61*042d53a7SEvalZero************
62*042d53a7SEvalZero
63*042d53a7SEvalZeroProvisioning is done using the BlueZ meshctl utility. In this example, we'll use meshctl commands to bind:
64*042d53a7SEvalZero
65*042d53a7SEvalZero- Button1, Button2, and LED1 to application key 1. It then configures Button1 and Button2
66*042d53a7SEvalZero  to publish to group 0xC000 and LED1 to subscribe to that group.
67*042d53a7SEvalZero- Button3, Button4, and LED3 to application key 1. It then configures Button3 and Button4
68*042d53a7SEvalZero  to publish to group 0xC000 and LED3 to subscribe to that group.
69*042d53a7SEvalZero
70*042d53a7SEvalZero```
71*042d53a7SEvalZerodiscover-unprovisioned on
72*042d53a7SEvalZeroprovision <discovered UUID>
73*042d53a7SEvalZeromenu config
74*042d53a7SEvalZerotarget 0100
75*042d53a7SEvalZeroappkey-add 1
76*042d53a7SEvalZerobind 0 1 1000
77*042d53a7SEvalZerobind 0 1 1001
78*042d53a7SEvalZerobind 0 1 1002
79*042d53a7SEvalZerobind 0 1 1003
80*042d53a7SEvalZerosub-add 0100 c000 1000
81*042d53a7SEvalZerosub-add 0100 c000 1002
82*042d53a7SEvalZeropub-set 0100 c000 1 0 5 1001
83*042d53a7SEvalZeropub-set 0100 c000 1 0 5 1003
84*042d53a7SEvalZero```
85*042d53a7SEvalZero
86*042d53a7SEvalZeroThe meshctl utility maintains a persistent JSON database containing
87*042d53a7SEvalZerothe mesh configuration. As additional nodes (boards) are provisioned, it
88*042d53a7SEvalZeroassigns sequential unicast addresses based on the number of elements
89*042d53a7SEvalZerosupported by the node. This example supports 2 elements per node.
90*042d53a7SEvalZero
91*042d53a7SEvalZeroThe meshctl target for configuration must be the root element's unicast
92*042d53a7SEvalZeroaddress as it is the only one that has a configuration server model. If
93*042d53a7SEvalZeromeshctl is gracefully exited, it can be restarted and reconnected to
94*042d53a7SEvalZeronetwork 0x0.
95*042d53a7SEvalZero
96*042d53a7SEvalZeroThe meshctl utility also supports a onoff model client that can be used to
97*042d53a7SEvalZerochange the state of any LED that is bound to application key 0x1.
98*042d53a7SEvalZeroThis is done by setting the target to the unicast address of the element
99*042d53a7SEvalZerothat has that LED's model and issuing the onoff command.
100*042d53a7SEvalZeroGroup addresses are not supported.
101*042d53a7SEvalZero
102