FastLED 3.10.6
Loading...
Searching...
No Matches
parser.h
Go to the documentation of this file.
1#pragma once
2
3// Free functions in fl::fled that parse a .fled v1 byte buffer into its
4// header + JSON envelope. The fl::Fled factories in fled.cpp.hpp delegate
5// here so the public type stays a thin facade and the parser internals
6// can be reused (e.g. by FledBuilder) without dragging in the PIMPL type.
7//
8// See FLED_FORMAT.md for the on-disk layout.
9
10#include "fl/stl/int.h"
11#include "fl/stl/noexcept.h"
12
13namespace fl {
14
15class json; // fl/stl/json.h
16
17namespace fled {
18
24
25// Parse the 12-byte header + JSON envelope.
26// Returns true on success and populates outHeader + outEnvelope.
27// Returns false on any of:
28// - len < 12
29// - magic != "FLED"
30// - version != 1
31// - jsonLen > kMaxJsonBytes
32// - jsonLen > len - 12 (truncated)
33// - JSON parse failed
34bool parseHeaderAndEnvelope(const fl::u8* data, fl::size len,
35 ParsedHeader* outHeader,
36 fl::json* outEnvelope) FL_NO_EXCEPT;
37
38// Section-name aliases recognized by Fled::blob(). Centralized here so
39// FledBuilder and the public accessor agree on the canonical name.
40bool sectionNameIsPayload(const char* name) FL_NO_EXCEPT;
41
42} // namespace fled
43} // namespace fl
bool parseHeaderAndEnvelope(const fl::u8 *data, fl::size len, ParsedHeader *outHeader, fl::json *outEnvelope) FL_NO_EXCEPT
bool sectionNameIsPayload(const char *name) FL_NO_EXCEPT
fl::size payloadOffset
Definition parser.h:22
unsigned char u8
Definition stdint.h:131
InputGamut g FL_NO_EXCEPT
Definition rgbw.h:121
Base definition for an LED controller.
Definition crgb.hpp:179