nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
gen_plvl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
14#ifndef BT_MESH_GEN_PLVL_H__
15#define BT_MESH_GEN_PLVL_H__
16
17#include <zephyr/bluetooth/mesh.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
37
41 uint16_t current;
43 uint16_t target;
50};
51
54 uint16_t min;
55 uint16_t max;
56};
57
65
73static inline uint8_t bt_mesh_plvl_to_percent(uint16_t plvl)
74{
75 return (100UL * plvl) / UINT16_MAX;
76}
77
85static inline uint16_t bt_mesh_plvl_from_percent(uint8_t plvl_percent)
86{
87 return (UINT16_MAX * plvl_percent) / 100;
88}
89
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)
105
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
122#ifdef __cplusplus
123}
124#endif
125
126#endif /* BT_MESH_GEN_PLVL_H__ */
127
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