14#ifndef BT_MESH_GEN_PLVL_H__
15#define BT_MESH_GEN_PLVL_H__
17#include <zephyr/bluetooth/mesh.h>
75 return (100UL * plvl) / UINT16_MAX;
87 return (UINT16_MAX * plvl_percent) / 100;
91#define BT_MESH_PLVL_OP_LEVEL_GET BT_MESH_MODEL_OP_2(0x82, 0x15)
92#define BT_MESH_PLVL_OP_LEVEL_SET BT_MESH_MODEL_OP_2(0x82, 0x16)
93#define BT_MESH_PLVL_OP_LEVEL_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x17)
94#define BT_MESH_PLVL_OP_LEVEL_STATUS BT_MESH_MODEL_OP_2(0x82, 0x18)
95#define BT_MESH_PLVL_OP_LAST_GET BT_MESH_MODEL_OP_2(0x82, 0x19)
96#define BT_MESH_PLVL_OP_LAST_STATUS BT_MESH_MODEL_OP_2(0x82, 0x1A)
97#define BT_MESH_PLVL_OP_DEFAULT_GET BT_MESH_MODEL_OP_2(0x82, 0x1B)
98#define BT_MESH_PLVL_OP_DEFAULT_STATUS BT_MESH_MODEL_OP_2(0x82, 0x1C)
99#define BT_MESH_PLVL_OP_RANGE_GET BT_MESH_MODEL_OP_2(0x82, 0x1D)
100#define BT_MESH_PLVL_OP_RANGE_STATUS BT_MESH_MODEL_OP_2(0x82, 0x1E)
101#define BT_MESH_PLVL_OP_DEFAULT_SET BT_MESH_MODEL_OP_2(0x82, 0x1F)
102#define BT_MESH_PLVL_OP_DEFAULT_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x20)
103#define BT_MESH_PLVL_OP_RANGE_SET BT_MESH_MODEL_OP_2(0x82, 0x21)
104#define BT_MESH_PLVL_OP_RANGE_SET_UNACK BT_MESH_MODEL_OP_2(0x82, 0x22)
106#define BT_MESH_PLVL_MSG_LEN_LEVEL_GET 0
107#define BT_MESH_PLVL_MSG_MINLEN_LEVEL_SET 3
108#define BT_MESH_PLVL_MSG_MAXLEN_LEVEL_SET 5
109#define BT_MESH_PLVL_MSG_MINLEN_LEVEL_STATUS 2
110#define BT_MESH_PLVL_MSG_MAXLEN_LEVEL_STATUS 5
111#define BT_MESH_PLVL_MSG_LEN_LAST_GET 0
112#define BT_MESH_PLVL_MSG_LEN_LAST_STATUS 2
113#define BT_MESH_PLVL_MSG_LEN_DEFAULT_GET 0
114#define BT_MESH_PLVL_MSG_LEN_DEFAULT_STATUS 2
115#define BT_MESH_PLVL_MSG_LEN_RANGE_GET 0
116#define BT_MESH_PLVL_MSG_LEN_RANGE_STATUS 5
117#define BT_MESH_PLVL_MSG_LEN_DEFAULT_SET 2
118#define BT_MESH_PLVL_MSG_LEN_RANGE_SET 4
bt_mesh_model_status
Definition: model_types.h:54
static uint8_t bt_mesh_plvl_to_percent(uint16_t plvl)
Convert Power Level to a percent.
Definition: gen_plvl.h:73
static uint16_t bt_mesh_plvl_from_percent(uint8_t plvl_percent)
Convert percent to raw Power Level.
Definition: gen_plvl.h:85
Definition: model_types.h:37
enum bt_mesh_model_status status
Definition: gen_plvl.h:61
struct bt_mesh_plvl_range range
Definition: gen_plvl.h:63
Definition: gen_plvl.h:59
uint16_t min
Definition: gen_plvl.h:54
uint16_t max
Definition: gen_plvl.h:55
Definition: gen_plvl.h:53
uint16_t power_lvl
Definition: gen_plvl.h:27
const struct bt_mesh_model_transition * transition
Definition: gen_plvl.h:35
Definition: gen_plvl.h:25
uint16_t current
Definition: gen_plvl.h:41
uint16_t target
Definition: gen_plvl.h:43
int32_t remaining_time
Definition: gen_plvl.h:49
Definition: gen_plvl.h:39