smartledz-protocol
Smart LEDZ protocol v1 command and state codec library
Loading...
Searching...
No Matches
state_codec.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <array>
9#include <cstddef>
10#include <cstdint>
11#include <map>
12#include <vector>
13
14namespace smartledz_protocol {
15namespace v1 {
16
22 bool seen{false};
24 uint8_t online_status{0};
30 bool has_power{false};
32 bool power{false};
34 bool has_brightness{false};
36 uint8_t brightness{0};
38 uint8_t type_raw{0};
40 bool has_ct{false};
42 uint8_t ct_raw{0};
44 bool has_rgb{false};
46 std::array<uint8_t, 3> rgb{0, 0, 0};
48 uint32_t last_update_ms{0};
49};
50
62void apply_online_status_payload(const uint8_t *payload10, size_t payload_len, uint32_t now_ms,
63 std::map<uint16_t, DeviceStateSnapshot> *states,
64 std::vector<uint16_t> *updated_addresses);
65
77void apply_status_payload(uint16_t src, const uint8_t *payload10, size_t payload_len, uint32_t now_ms,
78 std::map<uint16_t, DeviceStateSnapshot> *states,
79 std::vector<uint16_t> *updated_addresses);
80
92void apply_f1_response_payload(uint16_t src, const uint8_t *payload10, size_t payload_len, uint32_t now_ms,
93 std::map<uint16_t, DeviceStateSnapshot> *states,
94 std::vector<uint16_t> *updated_addresses);
95
96} // namespace v1
97} // namespace smartledz_protocol
Last known state fields decoded from mesh notifications.
Definition state_codec.h:20
std::array< uint8_t, 3 > rgb
RGB channels decoded from status payload.
Definition state_codec.h:46
uint8_t online_brightness
Brightness byte from online-status payload.
Definition state_codec.h:28
bool has_ct
True when ct_raw is valid.
Definition state_codec.h:40
uint8_t brightness
Brightness byte from dimming/online payloads.
Definition state_codec.h:36
uint8_t ct_raw
Raw CT byte (18..65 in currently known payloads).
Definition state_codec.h:42
bool has_online_brightness
True when online_brightness is valid.
Definition state_codec.h:26
bool has_rgb
True when rgb is valid.
Definition state_codec.h:44
bool has_brightness
True when brightness has been decoded from any payload type.
Definition state_codec.h:34
uint8_t online_status
Raw online status byte from 0xDC online-status payloads.
Definition state_codec.h:24
uint8_t type_raw
Device type/raw mode byte seen in online-status payloads.
Definition state_codec.h:38
bool has_power
True when power has been derived from a payload.
Definition state_codec.h:30
uint32_t last_update_ms
Caller-provided timestamp for latest decoded update.
Definition state_codec.h:48
bool power
Derived power state (status != 0 && brightness != 0).
Definition state_codec.h:32
bool seen
True after at least one payload was applied for this address.
Definition state_codec.h:22