Brad Bishop | f3df6b4 | 2017-01-06 10:14:09 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | 9331ab7 | 2018-01-29 09:48:47 -0800 | [diff] [blame] | 3 | #include <string> |
| 4 | |
| 5 | #include "sensorset.hpp" |
Brad Bishop | f3df6b4 | 2017-01-06 10:14:09 -0500 | [diff] [blame] | 6 | |
Patrick Venture | 7a5285d | 2018-04-17 19:15:05 -0700 | [diff] [blame] | 7 | namespace env { |
| 8 | |
Matt Spinler | 049e0dd | 2017-10-12 16:33:22 -0500 | [diff] [blame] | 9 | /** @brief Reads an environment variable |
| 10 | * |
Patrick Venture | a24c880 | 2018-04-17 19:38:06 -0700 | [diff] [blame] | 11 | * Reads the environment for that key |
| 12 | * |
| 13 | * @param[in] key - the key |
| 14 | * |
| 15 | * @return string - the env var value |
| 16 | */ |
| 17 | std::string getEnv(const char* key); |
| 18 | |
| 19 | /** @brief Reads an environment variable |
| 20 | * |
Matt Spinler | 049e0dd | 2017-10-12 16:33:22 -0500 | [diff] [blame] | 21 | * Reads <prefix>_<sensor.first><sensor.second> |
| 22 | * |
| 23 | * @param[in] prefix - the variable prefix |
| 24 | * @param[in] sensor - Sensor details |
| 25 | * |
| 26 | * @return string - the env var value |
| 27 | */ |
Brad Bishop | f3df6b4 | 2017-01-06 10:14:09 -0500 | [diff] [blame] | 28 | std::string getEnv( |
| 29 | const char* prefix, const SensorSet::key_type& sensor); |
Tom Joseph | 1f8a958 | 2017-06-12 20:10:59 +0530 | [diff] [blame] | 30 | |
Matt Spinler | 049e0dd | 2017-10-12 16:33:22 -0500 | [diff] [blame] | 31 | /** @brief Reads an environment variable, and takes type and id separately |
| 32 | * |
| 33 | * @param[in] prefix - the variable prefix |
| 34 | * @param[in] type - sensor type, like 'temp' |
| 35 | * @param[in] id - sensor ID, like '5' |
| 36 | * |
| 37 | * @return string - the env var value |
| 38 | */ |
| 39 | std::string getEnv( |
| 40 | const char* prefix, |
| 41 | const std::string& type, |
| 42 | const std::string& id); |
| 43 | |
Matt Spinler | 82d507d | 2017-10-12 16:36:57 -0500 | [diff] [blame] | 44 | /** @brief Gets the ID for the sensor with a level of indirection |
| 45 | * |
Matt Spinler | 7c42480 | 2018-05-04 10:52:40 -0500 | [diff] [blame^] | 46 | * Read the ID from the <path>/<item><X>_<suffix> file. |
Matt Spinler | 82d507d | 2017-10-12 16:36:57 -0500 | [diff] [blame] | 47 | * <item> & <X> are populated from the sensor key. |
| 48 | * |
| 49 | * @param[in] path - Directory path of the label file |
Matt Spinler | 7c42480 | 2018-05-04 10:52:40 -0500 | [diff] [blame^] | 50 | * @param[in] fileSuffix - The file suffix |
Matt Spinler | 82d507d | 2017-10-12 16:36:57 -0500 | [diff] [blame] | 51 | * @param[in] sensor - Sensor details |
| 52 | */ |
| 53 | std::string getIndirectID( |
| 54 | std::string path, |
Matt Spinler | 7c42480 | 2018-05-04 10:52:40 -0500 | [diff] [blame^] | 55 | const std::string& fileSuffix, |
Matt Spinler | 82d507d | 2017-10-12 16:36:57 -0500 | [diff] [blame] | 56 | const SensorSet::key_type& sensor); |
Patrick Venture | 7a5285d | 2018-04-17 19:15:05 -0700 | [diff] [blame] | 57 | |
| 58 | } // namespace env |