|
| 1 | +.. _bt_mesh_plvl_readme: |
| 2 | + |
| 3 | +Generic Power Level models |
| 4 | +########################## |
| 5 | + |
| 6 | +The Generic Power Level models allow remote control of power levels on a |
| 7 | +mesh device. Typical applications for the Generic Power Level model are |
| 8 | +heaters, fans and dimmer outlets. |
| 9 | + |
| 10 | +There are two Generic Power Level models: |
| 11 | + |
| 12 | +- :ref:`bt_mesh_plvl_srv_readme` |
| 13 | +- :ref:`bt_mesh_plvl_cli_readme` |
| 14 | + |
| 15 | +.. _bt_mesh_plvl_srv_readme: |
| 16 | + |
| 17 | +Generic Power Level Server |
| 18 | +========================== |
| 19 | + |
| 20 | +The Generic Power Level Server controls the output power level of a peripheral |
| 21 | +on the Mesh-enabled device. |
| 22 | + |
| 23 | +Generic Power Level Server adds two model instances in the composition data: |
| 24 | + |
| 25 | +- The Generic Power Level Server |
| 26 | +- The Generic Power Level Setup Server |
| 27 | + |
| 28 | +The two model instances share the states of the Generic Power Level Server, |
| 29 | +but accept different messages. This allows fine-grained control of the access |
| 30 | +rights for the Generic Power Level states, as the two model instances can be |
| 31 | +bound to different application keys. |
| 32 | + |
| 33 | +The Generic Power Level Server is the "user facing" model instance in the pair, |
| 34 | +and only provides access to the Generic Power Level state, and its last |
| 35 | +non-zero value. |
| 36 | + |
| 37 | +The Generic Power Level Setup Server provides access to the two metastates, |
| 38 | +Default Power and Power Range, allowing configurator devices to set up the |
| 39 | +range and default value for the Generic Power Level state. |
| 40 | + |
| 41 | +States |
| 42 | +******* |
| 43 | + |
| 44 | +**Generic Power Level**: ``u16_t`` |
| 45 | + |
| 46 | +The Generic Power Level state controls the Power level of an element, and |
| 47 | +ranges from 0 to 65535. The Generic Power Level state is bound to the |
| 48 | +Generic Level State of the :ref:`bt_mesh_lvl_srv_readme`: |
| 49 | + |
| 50 | +:: |
| 51 | + |
| 52 | + Generic Power Level = Generic Level + 32768 |
| 53 | + |
| 54 | +The Generic OnOff state of the :ref:`bt_mesh_onoff_srv_readme` (extended |
| 55 | +through the :ref:`bt_mesh_ponoff_srv_readme`) is derived from the Power state: |
| 56 | + |
| 57 | +:: |
| 58 | + |
| 59 | + Generic OnOff = (Generic Power Level > 0) |
| 60 | + |
| 61 | +Conversely, if the Generic OnOff state is changed to Off, the Generic Power |
| 62 | +Level is set to 0. If the Generic OnOff state is changed to On and the Default |
| 63 | +Level state is set, the Generic Power level is set to the value of the Default |
| 64 | +level state. If the Generic OnOff state is changed to On and the Default Level |
| 65 | +state is not set, the Generic Power Level state is set to the last known |
| 66 | +non-zero value. |
| 67 | + |
| 68 | +The Power state power up behavior is determined by the On Power Up state of the |
| 69 | +extended :ref:`bt_mesh_ponoff_srv_readme`: |
| 70 | + |
| 71 | +- :cpp:enumerator:`BT_MESH_ON_POWER_UP_OFF <bt_mesh_ponoff::BT_MESH_ON_POWER_UP_OFF>`: |
| 72 | + The Power level is set to 0 on power up. |
| 73 | +- :cpp:enumerator:`BT_MESH_ON_POWER_UP_ON <bt_mesh_ponoff::BT_MESH_ON_POWER_UP_ON>`: |
| 74 | + The Power level is set to Default Level on power up, or the last known |
| 75 | + non-zero Power level if the Default level is not set. |
| 76 | +- :cpp:enumerator:`BT_MESH_ON_POWER_UP_RESTORE <bt_mesh_ponoff::BT_MESH_ON_POWER_UP_RESTORE>`: |
| 77 | + The Power level is set to the last known Power level (zero or otherwise). |
| 78 | + |
| 79 | +The user is expected to hold the state memory and provide access to the state |
| 80 | +through the :cpp:type:`bt_mesh_plvl_srv_handlers` handler structure. |
| 81 | + |
| 82 | +**Default Power**: ``s16_t`` |
| 83 | + |
| 84 | +The Default Power state is a metastate that controls the default non-zero |
| 85 | +Generic Power Level. It is used when the Generic Power Level turns on, but its |
| 86 | +exact level is not specified. |
| 87 | + |
| 88 | +The memory for the Default Power state is held by the model, and the |
| 89 | +application may receive updates on state changes through the |
| 90 | +:cpp:member:`bt_mesh_plvl_srv_handlers::default_update` callback. |
| 91 | + |
| 92 | +**Power Range**: :cpp:type:`bt_mesh_plvl_range` |
| 93 | + |
| 94 | +The Power Range state is a metastate that determines the accepted Generic Power |
| 95 | +Level range. |
| 96 | + |
| 97 | +If the Generic Power Level is set to a value outside the current Power Range, |
| 98 | +the actual Generic Power Level is moved to fit inside the range. |
| 99 | + |
| 100 | +If the Power Level Range changes to exclude the current Generic Power Level, |
| 101 | +the Generic Power Level should be changed accordingly. Note that the Generic |
| 102 | +Power Level may always be set to zero, even if this is outside the current |
| 103 | +Power Range. |
| 104 | + |
| 105 | +The memory for the Power Range state is held by the model, and the |
| 106 | +application may receive updates on state changes through the |
| 107 | +:cpp:member:`bt_mesh_plvl_srv_handlers::range_update` callback. |
| 108 | + |
| 109 | +Extended models |
| 110 | +**************** |
| 111 | + |
| 112 | +The Generic Power Level Server extends the following models: |
| 113 | + |
| 114 | +- :ref:`bt_mesh_lvl_srv_readme` |
| 115 | +- :ref:`bt_mesh_ponoff_srv_readme` |
| 116 | + |
| 117 | +As the states of both extended models are bound to states in the Generic Power |
| 118 | +Level Server, the states of the extended models are not exposed directly to the |
| 119 | +application. |
| 120 | + |
| 121 | +Persistent storage |
| 122 | +******************* |
| 123 | + |
| 124 | +The Generic Power Level Server stores any changes to the Default Power and |
| 125 | +Power Range states, as well as the last known non-zero Generic Power Level and |
| 126 | +whether the Generic Power Level is on or off. This information is used to |
| 127 | +reestablish the correct Generic Power Level when the device powers up. |
| 128 | + |
| 129 | +API documentation |
| 130 | +****************** |
| 131 | + |
| 132 | +| Header file: :file:`include/bluetooth/mesh/gen_plvl_srv.h` |
| 133 | +| Source file: :file:`subsys/bluetooth/mesh/gen_plvl_srv.c` |
| 134 | +
|
| 135 | +.. doxygengroup:: bt_mesh_plvl_srv |
| 136 | + :project: nrf |
| 137 | + :members: |
| 138 | + |
| 139 | +---- |
| 140 | + |
| 141 | +.. _bt_mesh_plvl_cli_readme: |
| 142 | + |
| 143 | +Generic Power Level Client |
| 144 | +========================== |
| 145 | + |
| 146 | +The Generic Power Level Client model remotely controls the state of a Generic |
| 147 | +Power Level Server model. |
| 148 | + |
| 149 | +Contrary to the Server model, the Client only creates a single model instance |
| 150 | +in the mesh composition data. The Generic Power Level Client may send |
| 151 | +messages to both the Generic Power Level Server and the Generic Power Level |
| 152 | +Setup Server, as long as it has the right application keys. |
| 153 | + |
| 154 | +Extended models |
| 155 | +**************** |
| 156 | + |
| 157 | +None. |
| 158 | + |
| 159 | +Persistent storage |
| 160 | +******************* |
| 161 | + |
| 162 | +None. |
| 163 | + |
| 164 | +API documentation |
| 165 | +****************** |
| 166 | + |
| 167 | +| Header file: :file:`include/bluetooth/mesh/gen_plvl_cli.h` |
| 168 | +| Source file: :file:`subsys/bluetooth/mesh/gen_plvl_cli.c` |
| 169 | +
|
| 170 | +.. doxygengroup:: bt_mesh_plvl_cli |
| 171 | + :project: nrf |
| 172 | + :members: |
| 173 | + |
| 174 | +---- |
| 175 | + |
| 176 | +Common types |
| 177 | +============= |
| 178 | + |
| 179 | +| Header file: :file:`include/bluetooth/mesh/gen_plvl.h` |
| 180 | +
|
| 181 | +.. doxygengroup:: bt_mesh_plvl |
| 182 | + :project: nrf |
| 183 | + :members: |
0 commit comments