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

Function getFrameData

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

* Frame Data Export Function * Exports frame data as JSON string with size information * Returns malloc'd buffer that must be freed with freeFrameData() */

Source from the content-addressed store, hash-verified

68 * Returns malloc'd buffer that must be freed with freeFrameData()
69 */
70EMSCRIPTEN_KEEPALIVE void* getFrameData(int* dataSize) {
71 // Fill active strips data
72 fl::ActiveStripData& active_strips = fl::ActiveStripData::Instance();
73 fl::jsFillInMissingScreenMaps(active_strips);
74
75 // Serialize to JSON
76 fl::string json_str = active_strips.infoJsonString();
77
78 // Allocate and return data pointer
79 char* buffer = (char*)fl::malloc(json_str.length() + 1);
80 fl::strcpy(buffer, json_str.c_str());
81 *dataSize = json_str.length();
82
83 return buffer;
84}
85
86/**
87 * ScreenMap Export Function

Callers

nothing calls this directly

Calls 6

strcpyFunction · 0.85
infoJsonStringMethod · 0.80
mallocFunction · 0.50
lengthMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected