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

Method handle_maybe

src/fl/remote/rpc/rpc.cpp.hpp:192–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190// =============================================================================
191
192fl::optional<json> Rpc::handle_maybe(const json& request) {
193 // If no id, this is a notification - process but don't return response
194 if (!request.contains("id")) {
195 // Still need to execute the method
196 if (request.contains("method")) {
197 auto methodOpt = request["method"].as_string();
198 if (methodOpt.has_value()) {
199 fl::string methodName = methodOpt.value();
200 auto it = mRegistry.find(methodName);
201 if (it != mRegistry.end()) {
202 json params = request.contains("params") ? request["params"] : json::parse("[]");
203 if (params.is_array()) {
204 it->second.mInvoker->invoke(params);
205 }
206 }
207 }
208 }
209 return fl::nullopt;
210 }
211
212 return handle(request);
213}
214
215// =============================================================================
216// Rpc::tags() - Returns list of unique tags

Callers

nothing calls this directly

Calls 9

handleClass · 0.85
containsMethod · 0.45
as_stringMethod · 0.45
has_valueMethod · 0.45
valueMethod · 0.45
findMethod · 0.45
endMethod · 0.45
is_arrayMethod · 0.45
invokeMethod · 0.45

Tested by

no test coverage detected