smartledz-protocol
Smart LEDZ protocol v1 command and state codec library
Loading...
Searching...
No Matches
commands.h File Reference

Smart LEDZ v1 mesh command builders and opcode constants. More...

#include <array>
#include <cstddef>
#include <cstdint>
Include dependency graph for commands.h:

Go to the source code of this file.

Classes

struct  smartledz_protocol::v1::MeshCommand
 Mesh command frame used by the session transport layer. More...
 

Functions

MeshCommand smartledz_protocol::v1::make_on_off (bool on)
 Builds an on/off command.
 
MeshCommand smartledz_protocol::v1::make_brightness (uint8_t brightness_pct)
 Builds a brightness command.
 
MeshCommand smartledz_protocol::v1::make_rgb (uint8_t red, uint8_t green, uint8_t blue)
 Builds an RGB color command.
 
MeshCommand smartledz_protocol::v1::make_ct_raw (uint8_t ct_raw)
 Builds a color-temperature command using the raw protocol unit.
 
MeshCommand smartledz_protocol::v1::make_status_query ()
 Builds a status query command.
 
MeshCommand smartledz_protocol::v1::make_dimming_query ()
 Builds a dimming query command (0xF1 request wrapper).
 

Detailed Description

Smart LEDZ v1 mesh command builders and opcode constants.

Function Documentation

◆ make_brightness()

MeshCommand smartledz_protocol::v1::make_brightness ( uint8_t  brightness_pct)

Builds a brightness command.

Parameters
brightness_pctBrightness percentage byte expected by the device.
Returns
Command with opcode kOpcodeBrightness and payload length 1.
Note
The value is forwarded as-is and is not clamped.

◆ make_ct_raw()

MeshCommand smartledz_protocol::v1::make_ct_raw ( uint8_t  ct_raw)

Builds a color-temperature command using the raw protocol unit.

Parameters
ct_rawRaw CT byte from 18 (warmest) to 65 (coolest).
Returns
Command with opcode kOpcodeColor and payload [0x05, CT].
Note
Values are clamped to the supported range [18, 65].

◆ make_dimming_query()

MeshCommand smartledz_protocol::v1::make_dimming_query ( )

Builds a dimming query command (0xF1 request wrapper).

Returns
Command with opcode kOpcodeDimmingQuery and fixed 5-byte payload.

◆ make_on_off()

MeshCommand smartledz_protocol::v1::make_on_off ( bool  on)

Builds an on/off command.

Parameters
ontrue sends 0x01, false sends 0x00.
Returns
Command with opcode kOpcodeOnOff and payload length 1.

◆ make_rgb()

MeshCommand smartledz_protocol::v1::make_rgb ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

Builds an RGB color command.

Parameters
redRed channel (0..255).
greenGreen channel (0..255).
blueBlue channel (0..255).
Returns
Command with opcode kOpcodeColor and payload [0x04, R, G, B].

◆ make_status_query()

MeshCommand smartledz_protocol::v1::make_status_query ( )

Builds a status query command.

Returns
Command with opcode kOpcodeStatusQuery and payload [0x10].