MCPcopy Create free account
hub / github.com/FastLED/FastLED / getStripUpdateData

Function getStripUpdateData

src/platforms/wasm/js_bindings.cpp.hpp:203–218  ·  view source on GitHub ↗

* Pure C++ Strip Update Data Export Function * Exports strip update data as JSON for specific strip */

Source from the content-addressed store, hash-verified

201 * Exports strip update data as JSON for specific strip
202 */
203EMSCRIPTEN_KEEPALIVE void* getStripUpdateData(int stripId, int* dataSize) {
204 // Generate basic strip update JSON
205 fl::json doc = fl::json::object();
206 doc.set("strip_id", stripId);
207 doc.set("event", "strip_update");
208 doc.set("timestamp", static_cast<int>(fl::millis()));
209
210 fl::string jsonBuffer = doc.to_string();
211
212 // Allocate and return data pointer
213 char* buffer = (char*)fl::malloc(jsonBuffer.length() + 1);
214 fl::strcpy(buffer, jsonBuffer.c_str());
215 *dataSize = jsonBuffer.length();
216
217 return buffer;
218}
219
220/**
221 * Pure C++ Strip Addition Notification

Callers

nothing calls this directly

Calls 7

strcpyFunction · 0.85
millisFunction · 0.70
mallocFunction · 0.50
setMethod · 0.45
to_stringMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected