blob: 56dd2aa71f3ec7cfe0b6d690540c79c1fc06c937 [file] [log] [blame]
Brad Bishopf3df6b42017-01-06 10:14:09 -05001#pragma once
2
Patrick Venture9331ab72018-01-29 09:48:47 -08003#include <string>
4
5#include "sensorset.hpp"
Brad Bishopf3df6b42017-01-06 10:14:09 -05006
Patrick Venture7a5285d2018-04-17 19:15:05 -07007namespace env {
8
Matt Spinler049e0dd2017-10-12 16:33:22 -05009/** @brief Reads an environment variable
10 *
Patrick Venturea24c8802018-04-17 19:38:06 -070011 * Reads the environment for that key
12 *
13 * @param[in] key - the key
14 *
15 * @return string - the env var value
16 */
17std::string getEnv(const char* key);
18
19/** @brief Reads an environment variable
20 *
Matt Spinler049e0dd2017-10-12 16:33:22 -050021 * 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 Bishopf3df6b42017-01-06 10:14:09 -050028std::string getEnv(
29 const char* prefix, const SensorSet::key_type& sensor);
Tom Joseph1f8a9582017-06-12 20:10:59 +053030
Matt Spinler049e0dd2017-10-12 16:33:22 -050031/** @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 */
39std::string getEnv(
40 const char* prefix,
41 const std::string& type,
42 const std::string& id);
43
Matt Spinler82d507d2017-10-12 16:36:57 -050044/** @brief Gets the ID for the sensor with a level of indirection
45 *
Matt Spinler7c424802018-05-04 10:52:40 -050046 * Read the ID from the <path>/<item><X>_<suffix> file.
Matt Spinler82d507d2017-10-12 16:36:57 -050047 * <item> & <X> are populated from the sensor key.
48 *
49 * @param[in] path - Directory path of the label file
Matt Spinler7c424802018-05-04 10:52:40 -050050 * @param[in] fileSuffix - The file suffix
Matt Spinler82d507d2017-10-12 16:36:57 -050051 * @param[in] sensor - Sensor details
52 */
53std::string getIndirectID(
54 std::string path,
Matt Spinler7c424802018-05-04 10:52:40 -050055 const std::string& fileSuffix,
Matt Spinler82d507d2017-10-12 16:36:57 -050056 const SensorSet::key_type& sensor);
Patrick Venture7a5285d2018-04-17 19:15:05 -070057
58} // namespace env