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