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
13
namespace
fl
{
14
15
class
json
;
// fl/stl/json.h
16
17
namespace
fled
{
18
19
struct
ParsedHeader
{
20
fl::u8
version
;
21
fl::u8
pixelFormat
;
22
fl::size
payloadOffset
;
23
};
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
34
bool
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.
40
bool
sectionNameIsPayload
(
const
char
* name)
FL_NO_EXCEPT
;
41
42
}
// namespace fled
43
}
// namespace fl
fl::json
Definition
json.h:261
int.h
fl::fled::parseHeaderAndEnvelope
bool parseHeaderAndEnvelope(const fl::u8 *data, fl::size len, ParsedHeader *outHeader, fl::json *outEnvelope) FL_NO_EXCEPT
Definition
parser.cpp.hpp:22
fl::fled::sectionNameIsPayload
bool sectionNameIsPayload(const char *name) FL_NO_EXCEPT
Definition
parser.cpp.hpp:77
fl::fled
Definition
builder.cpp.hpp:17
fl::fled::ParsedHeader::payloadOffset
fl::size payloadOffset
Definition
parser.h:22
fl::fled::ParsedHeader::version
fl::u8 version
Definition
parser.h:20
fl::fled::ParsedHeader::pixelFormat
fl::u8 pixelFormat
Definition
parser.h:21
fl::fled::ParsedHeader
Definition
parser.h:19
fl::u8
unsigned char u8
Definition
stdint.h:131
fl::FL_NO_EXCEPT
InputGamut g FL_NO_EXCEPT
Definition
rgbw.h:121
fl
Base definition for an LED controller.
Definition
crgb.hpp:179
noexcept.h
fl
fled
detail
parser.h
Generated on Sun Oct 4 2026 23:09:00 for FastLED by
1.13.2