MCPcopy Create free account
hub / github.com/HASwitchPlate/openHASP / httpSetConfig

Function httpSetConfig

src/sys/svc/hasp_http.cpp:2328–2347  ·  view source on GitHub ↗

Set HTTP Configuration. * * Read the settings from json and sets the application variables. * * @note: data pixel should be formated to uint32_t RGBA. Imagemagick requirements. * * @param[in] settings JsonObject with the config settings. **/

Source from the content-addressed store, hash-verified

2326 * @param[in] settings JsonObject with the config settings.
2327 **/
2328bool httpSetConfig(const JsonObject& settings)
2329{
2330 configOutput(settings, TAG_HTTP);
2331 bool changed = false;
2332
2333 changed |= configSet(http_config.port, settings[FPSTR(FP_CONFIG_PORT)], F("httpPort"));
2334
2335 if(!settings[FPSTR(FP_CONFIG_USER)].isNull()) {
2336 changed |= strcmp(http_config.username, settings[FPSTR(FP_CONFIG_USER)]) != 0;
2337 strncpy(http_config.username, settings[FPSTR(FP_CONFIG_USER)], sizeof(http_config.username));
2338 }
2339
2340 if(!settings[FPSTR(FP_CONFIG_PASS)].isNull() &&
2341 settings[FPSTR(FP_CONFIG_PASS)].as<String>() != String(FPSTR(D_PASSWORD_MASK))) {
2342 changed |= strcmp(http_config.password, settings[FPSTR(FP_CONFIG_PASS)]) != 0;
2343 strncpy(http_config.password, settings[FPSTR(FP_CONFIG_PASS)], sizeof(http_config.password));
2344 }
2345
2346 return changed;
2347}
2348#endif // HASP_USE_CONFIG
2349
2350size_t httpClientWrite(const uint8_t* buf, size_t size)

Callers 4

saveConfigFunction · 0.70
webHandleApiConfigFunction · 0.70
configSetupFunction · 0.50
dispatch_configFunction · 0.50

Calls 2

configOutputFunction · 0.85
configSetFunction · 0.85

Tested by

no test coverage detected