MCPcopy Create free account
hub / github.com/bdring/FluidNC / setWebSetting

Method setWebSetting

FluidNC/src/WebUI/WebCommands.cpp:140–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138 }
139
140 static Error setWebSetting(const char* parameter, AuthenticationLevel auth_level, Channel& out) { // ESP401
141 // The string is of the form "P=name T=type V=value
142 // We do not need the "T=" (type) parameter because the
143 // Setting objects know their own type. We do not use
144 // split_params because if fails if the value string
145 // contains '='
146 std::string p, v;
147 bool isJSON = paramIsJSON(parameter);
148 if (!(get_param(parameter, "P=", p) && get_param(parameter, "V=", v))) {
149 if (isJSON) {
150 send_json_command_response(out, 401, false, errorString(Error::InvalidValue));
151 }
152 return Error::InvalidValue;
153 }
154
155 Error ret = do_command_or_setting(p, v, auth_level, out);
156 if (isJSON) {
157 send_json_command_response(out, 401, ret == Error::Ok, errorString(ret));
158 }
159
160 return ret;
161 }
162
163 // Used by js/setting.js
164 static Error listSettingsJSON(const char* parameter, AuthenticationLevel auth_level, Channel& out) { // ESP400

Callers

nothing calls this directly

Calls 4

paramIsJSONFunction · 0.85
errorStringFunction · 0.85
do_command_or_settingFunction · 0.85
get_paramFunction · 0.50

Tested by

no test coverage detected