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

Method executeCommand

src/platforms/shared/ui/json/json_console.cpp.hpp:71–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71bool JsonConsole::executeCommand(const fl::string& command) FL_NOEXCEPT {
72 FL_WARN("JsonConsole::executeCommand called with: '" << command.c_str() << "'");
73
74 if (command.empty()) {
75 FL_WARN("JsonConsole::executeCommand: Command is empty");
76 return false;
77 }
78
79 // Trim whitespace
80 fl::string trimmed = command;
81 // Simple trim - remove leading/trailing spaces
82 while (!trimmed.empty() && trimmed[0] == ' ') {
83 trimmed = trimmed.substr(1, trimmed.size());
84 }
85 while (!trimmed.empty() && trimmed[trimmed.size()-1] == ' ') {
86 trimmed = trimmed.substr(0, trimmed.size()-1);
87 }
88
89 FL_WARN("JsonConsole::executeCommand: Trimmed command: '" << trimmed.c_str() << "'");
90
91 if (trimmed.empty()) {
92 FL_WARN("JsonConsole::executeCommand: Trimmed command is empty");
93 return false;
94 }
95
96 // Handle help command
97 if (trimmed == "help") {
98 FL_WARN("JsonConsole::executeCommand: Executing help command");
99 writeOutput("Available commands:");
100 writeOutput(" <component_name>: <value> - Set component value by name");
101 writeOutput(" <component_id>: <value> - Set component value by ID");
102 writeOutput(" help - Show this help");
103 writeOutput("Examples:");
104 writeOutput(" slider: 80 - Set component named 'slider' to 80");
105 writeOutput(" 1: 80 - Set component with ID 1 to 80");
106 return true;
107 }
108
109 FL_WARN("JsonConsole::executeCommand: Calling parseCommand");
110 parseCommand(trimmed);
111 FL_WARN("JsonConsole::executeCommand: parseCommand completed");
112 return true;
113}
114
115void JsonConsole::processJsonFromUI(const char* jsonStr) FL_NOEXCEPT {
116 if (!jsonStr) {

Callers 1

FL_TEST_FILEFunction · 0.80

Calls 4

c_strMethod · 0.45
emptyMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected