* Load configuration from JSON file. * * @return If successful loaded, it will return true otherwise false. */
| 295 | * @return If successful loaded, it will return true otherwise false. |
| 296 | */ |
| 297 | bool loadConfiguration() |
| 298 | { |
| 299 | bool status = true; |
| 300 | JsonFile jsonFile(m_fs); |
| 301 | const size_t JSON_DOC_SIZE = 1024U; |
| 302 | DynamicJsonDocument jsonDoc(JSON_DOC_SIZE); |
| 303 | JsonObjectConst jsonRootObject = jsonDoc.to<JsonObject>(); |
| 304 | String configurationFilename = getFullPathToConfiguration(); |
| 305 | |
| 306 | if (false == jsonFile.load(configurationFilename, jsonDoc)) |
| 307 | { |
| 308 | status = false; |
| 309 | } |
| 310 | else |
| 311 | { |
| 312 | status = setConfiguration(jsonRootObject); |
| 313 | } |
| 314 | |
| 315 | return status; |
| 316 | } |
| 317 | |
| 318 | private: |
| 319 |