Patrick Venture | 5426c34 | 2019-02-11 12:03:30 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <nlohmann/json.hpp> |
| 4 | #include <string> |
| 5 | |
| 6 | using json = nlohmann::json; |
| 7 | |
| 8 | /** |
| 9 | * Given json data, validate the minimum. |
| 10 | * The json data must be valid, and must contain two keys: |
| 11 | * sensors, and zones. |
| 12 | * |
| 13 | * @param[in] data - the json data. |
| 14 | * @return nothing - throws exceptions on invalid bits. |
| 15 | */ |
| 16 | void validateJson(const json& data); |
| 17 | |
| 18 | /** |
| 19 | * Given a json configuration file, parse it. |
| 20 | * |
| 21 | * There must be at least one sensor, and one zone. |
| 22 | * That one zone must contain at least one PID. |
| 23 | * |
| 24 | * @param[in] path - path to the configuration |
| 25 | * @return the json data. |
| 26 | */ |
| 27 | json parseValidateJson(const std::string& path); |