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

Method getState

src/fl/control/wled.cpp.hpp:405–508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405fl::json WLED::getState() const {
406 fl::json state = fl::json::object();
407 state.set("on", mWledOn);
408 state.set("bri", static_cast<i64>(mWledBri));
409 state.set("transition", static_cast<i64>(mTransition));
410 state.set("ps", static_cast<i64>(mPreset));
411 state.set("pl", static_cast<i64>(mPlaylist));
412 state.set("lor", static_cast<i64>(mLiveOverride));
413 state.set("mainseg", static_cast<i64>(mMainSegment));
414
415 // Nightlight object
416 fl::json nl = fl::json::object();
417 nl.set("on", mNightlightOn);
418 nl.set("dur", static_cast<i64>(mNightlightDuration));
419 nl.set("mode", static_cast<i64>(mNightlightMode));
420 nl.set("tbri", static_cast<i64>(mNightlightTargetBrightness));
421 state.set("nl", nl);
422
423 // UDP sync settings
424 fl::json udpn = fl::json::object();
425 udpn.set("send", mUdpSend);
426 udpn.set("recv", mUdpReceive);
427 state.set("udpn", udpn);
428
429 // Playlist configuration (if present)
430 if (hasPlaylistConfig()) {
431 state.set("playlist", getPlaylistConfig());
432 }
433
434 // Segments
435 if (!mSegments.empty()) {
436 fl::json segments = fl::json::array();
437 for (const auto& seg : mSegments) {
438 fl::json segJson = fl::json::object();
439
440 segJson.set("id", static_cast<i64>(seg.mId));
441 segJson.set("start", static_cast<i64>(seg.mStart));
442 segJson.set("stop", static_cast<i64>(seg.mStop));
443 segJson.set("len", static_cast<i64>(seg.mLen));
444 segJson.set("grp", static_cast<i64>(seg.mGrp));
445 segJson.set("spc", static_cast<i64>(seg.mSpc));
446 segJson.set("of", static_cast<i64>(seg.mOf));
447 segJson.set("on", seg.mOn);
448 segJson.set("bri", static_cast<i64>(seg.mBri));
449 segJson.set("cct", static_cast<i64>(seg.mCct));
450
451 // Effect properties
452 segJson.set("fx", static_cast<i64>(seg.mFx));
453 segJson.set("sx", static_cast<i64>(seg.mSx));
454 segJson.set("ix", static_cast<i64>(seg.mIx));
455 segJson.set("pal", static_cast<i64>(seg.mPal));
456 segJson.set("c1", static_cast<i64>(seg.mC1));
457 segJson.set("c2", static_cast<i64>(seg.mC2));
458 segJson.set("c3", static_cast<i64>(seg.mC3));
459
460 // Boolean flags
461 segJson.set("sel", seg.mSel);
462 segJson.set("rev", seg.mRev);

Callers

nothing calls this directly

Calls 8

rgbToHexFunction · 0.85
arrayClass · 0.50
jsonClass · 0.50
setMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected