| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * This file is part of the Falcon Player (FPP) and is Copyright (C) | ||
| 4 | * 2013-2026 by the Falcon Player Developers. | ||
| 5 | * | ||
| 6 | * The Falcon Player (FPP) is free software, and is covered under | ||
| 7 | * multiple Open Source licenses. Please see the included 'LICENSES' | ||
| 8 | * file for descriptions of what files are covered by each license. | ||
| 9 | * | ||
| 10 | * This source file is covered under the LGPL v2.1 as described in the | ||
| 11 | * included LICENSE.LGPL file. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include "Commands.h" | ||
| 15 | |||
| 16 | // Base class for FPP-internal commands whose whole job is evaluating *local* | ||
| 17 | // state (a GPIO pin, a local Variable, a local sensor reading) and reacting to | ||
| 18 | // it. Multisync broadcasts a command's args verbatim to other instances, which | ||
| 19 | // then execute it independently - coherent for a plain action, but for a | ||
| 20 | // local-state check "multisync the check" silently becomes "every instance | ||
| 21 | // re-evaluates the same check against its own, possibly different, local state" | ||
| 22 | // rather than propagating the result of one evaluation. The way to actually | ||
| 23 | // multisync the *outcome* of a check is to put a Multisync-enabled command | ||
| 24 | // inside the check's Then/Else branch instead. | ||
| 25 | // | ||
| 26 | // This is surfaced by overriding the existing getDescription() virtual (which | ||
| 27 | // makes the UI hide the Multisync option), NOT by adding a virtual to Command - | ||
| 28 | // see the ABI RULE in Commands.h. Only FPP's own commands subclass this; | ||
| 29 | // external plugins subclass Command directly, so nothing here affects the | ||
| 30 | // Command vtable they were compiled against. | ||
| 31 | class LocalOnlyCommand : public Command { | ||
| 32 | public: | ||
| 33 | using Command::Command; | ||
| 34 | |||
| 35 | 60 | Json::Value getDescription() override { | |
| 36 | 60 | Json::Value cmd = Command::getDescription(); | |
| 37 |
2/4✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
|
60 | cmd["disallowMultisync"] = true; |
| 38 | 60 | return cmd; | |
| 39 | ✗ | } | |
| 40 | }; | ||
| 41 |