FastLED 3.10.6
Loading...
Searching...
No Matches

◆ build()

fl::Fled fl::fled::FledBuilder::build ( ) const

Definition at line 168 of file builder.cpp.hpp.

168 {
169 const fl::string envelope =
171 const fl::u32 jsonLen = static_cast<fl::u32>(envelope.size());
172
173 fl::vector<fl::u8> buf;
174 buf.reserve(12 + envelope.size() + mPayload.size());
175
176 // 12-byte header: 4-byte magic, version, pixel_format, 2 reserved,
177 // u32 little-endian JSON length.
178 buf.push_back('F');
179 buf.push_back('L');
180 buf.push_back('E');
181 buf.push_back('D');
182 buf.push_back(mVersion);
184 buf.push_back(0); // reserved
185 buf.push_back(0); // reserved
186 appendU32LE(buf, jsonLen);
187
188 // JSON envelope.
189 appendString(buf, envelope);
190
191 // Optional frame payload (already a copy held by the builder).
192 for (fl::size i = 0; i < mPayload.size(); ++i) {
193 buf.push_back(mPayload[i]);
194 }
195
197}
static Fled loadFromVector(fl::vector< fl::u8 > &&bytes) FL_NO_EXCEPT
Definition fled.cpp.hpp:59
fl::size size() const FL_NO_EXCEPT
fl::string mScreenMapJson
Definition builder.h:67
fl::string mVideoColorJson
Definition builder.h:69
fl::vector< fl::u8 > mPayload
Definition builder.h:70
fl::string mChannelsJson
Definition builder.h:68
void reserve(fl::size n) FL_NO_EXCEPT
Definition vector.h:591
void push_back(const T &value) FL_NO_EXCEPT
Definition vector.h:624
fl::string buildEnvelope(const fl::string &screenMapJson, const fl::string &channelsJson, const fl::string &videoColorJson) FL_NO_EXCEPT
void appendString(fl::vector< fl::u8 > &out, const fl::string &s) FL_NO_EXCEPT
void appendU32LE(fl::vector< fl::u8 > &out, fl::u32 v) FL_NO_EXCEPT
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition move.h:28

References fl::FL_NO_EXCEPT, fl::Fled::loadFromVector(), mChannelsJson, fl::move(), mPayload, mPixelFormat, mScreenMapJson, mVersion, mVideoColorJson, fl::vector< T >::push_back(), fl::vector< T >::reserve(), and fl::basic_string::size().

+ Here is the call graph for this function: