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. **/
| 2326 | * @param[in] settings JsonObject with the config settings. |
| 2327 | **/ |
| 2328 | bool 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 | |
| 2350 | size_t httpClientWrite(const uint8_t* buf, size_t size) |
no test coverage detected