Generic Power Level models

The Generic Power Level models allow remote control of power levels on a mesh device. Typical applications for the Generic Power Level model are heaters, fans and dimmer outlets.

The Generic Power Level models also feature their own common types, listed below. For types common to all models, see Bluetooth Mesh models.

Common types

This section lists the types common to the Generic Power Level mesh models.

Header file: include/bluetooth/mesh/gen_plvl.h
group bt_mesh_plvl

API for the Generic Power Level models.

Functions

static inline uint8_t bt_mesh_plvl_to_percent(uint16_t plvl)

Convert Power Level to a percent.

Parameters:
  • plvl[in] Raw Power Level.

Returns:

The Power Level in percent.

static inline uint16_t bt_mesh_plvl_from_percent(uint8_t plvl_percent)

Convert percent to raw Power Level.

Parameters:
  • plvl_percent[in] Power Level in percent.

Returns:

The raw Power Level.

struct bt_mesh_plvl_set
#include <gen_plvl.h>

Power Level set message parameters.

Public Members

uint16_t power_lvl

Power Level.

const struct bt_mesh_model_transition *transition

Transition time parameters for the state change, or NULL.

When sending, setting the transition to NULL makes the receiver use its default transition time parameters, or 0 if no default transition time is set.

struct bt_mesh_plvl_status
#include <gen_plvl.h>

Power Level status message parameters.

Public Members

uint16_t current

Current Power Level.

uint16_t target

Target Power Level.

int32_t remaining_time

Time remaining of the ongoing transition in milliseconds, or SYS_FOREVER_MS. If there’s no ongoing transition, remaining_time is 0.

struct bt_mesh_plvl_range
#include <gen_plvl.h>

Power Level range parameters.

Public Members

uint16_t min

Minimum allowed Power Level.

uint16_t max

Maximum allowed Power Level.

struct bt_mesh_plvl_range_status
#include <gen_plvl.h>

Power Level range message parameters.

Public Members

enum bt_mesh_model_status status

Status of the previous operation.

struct bt_mesh_plvl_range range

Current Power Level range.