smartledz-protocol
Smart LEDZ protocol v1 command and state codec library
Loading...
Searching...
No Matches
commands.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <array>
9#include <cstddef>
10#include <cstdint>
11
12namespace smartledz_protocol {
13namespace v1 {
14
21constexpr uint8_t kOpcodeOnOff = 0xD0;
22constexpr uint8_t kOpcodeBrightness = 0xD2;
23constexpr uint8_t kOpcodeColor = 0xE2;
24constexpr uint8_t kOpcodeStatusQuery = 0xDA;
25constexpr uint8_t kOpcodeDimmingQuery = 0xF0;
27
30constexpr uint8_t kNotifyOpcodeOnlineStatus = 0xDC;
31constexpr uint8_t kNotifyOpcodeStatus = 0xDB;
32constexpr uint8_t kNotifyOpcodeExtended = 0xEA;
34
40 uint8_t opcode{0};
42 std::array<uint8_t, 10> payload{};
44 uint8_t payload_len{0};
45};
46
52MeshCommand make_on_off(bool on);
53
60MeshCommand make_brightness(uint8_t brightness_pct);
61
69MeshCommand make_rgb(uint8_t red, uint8_t green, uint8_t blue);
70
77MeshCommand make_ct_raw(uint8_t ct_raw);
78
83MeshCommand make_status_query();
84
89MeshCommand make_dimming_query();
90
91} // namespace v1
92} // namespace smartledz_protocol
Mesh command frame used by the session transport layer.
Definition commands.h:38
uint8_t opcode
Mesh opcode (for example kOpcodeOnOff, kOpcodeColor).
Definition commands.h:40
std::array< uint8_t, 10 > payload
Command payload bytes; only the first payload_len bytes are used.
Definition commands.h:42
uint8_t payload_len
Number of valid bytes in payload.
Definition commands.h:44