blob: b3ddff56b1e9c4f9eb40623f457530c465d5190e [file] [log] [blame]
Brad Bishopf3df6b42017-01-06 10:14:09 -05001#pragma once
2
Patrick Venture9331ab72018-01-29 09:48:47 -08003#include "sensorset.hpp"
Brad Bishopf3df6b42017-01-06 10:14:09 -05004
Patrick Venture043d3232018-08-31 10:10:53 -07005#include <string>
6
7namespace env
8{
Patrick Venture7a5285d2018-04-17 19:15:05 -07009
Matt Spinler049e0dd2017-10-12 16:33:22 -050010/** @brief Reads an environment variable
11 *
Patrick Venturea24c8802018-04-17 19:38:06 -070012 * Reads the environment for that key
13 *
14 * @param[in] key - the key
15 *
16 * @return string - the env var value
17 */
18std::string getEnv(const char* key);
19
20/** @brief Reads an environment variable
21 *
Matt Spinler049e0dd2017-10-12 16:33:22 -050022 * Reads <prefix>_<sensor.first><sensor.second>
23 *
24 * @param[in] prefix - the variable prefix
25 * @param[in] sensor - Sensor details
26 *
27 * @return string - the env var value
28 */
Patrick Venture043d3232018-08-31 10:10:53 -070029std::string getEnv(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 */
Patrick Venture043d3232018-08-31 10:10:53 -070039std::string getEnv(const char* prefix, const std::string& type,
40 const std::string& id);
Matt Spinler049e0dd2017-10-12 16:33:22 -050041
Matt Spinler82d507d2017-10-12 16:36:57 -050042/** @brief Gets the ID for the sensor with a level of indirection
43 *
Matt Spinler7c424802018-05-04 10:52:40 -050044 * Read the ID from the <path>/<item><X>_<suffix> file.
Matt Spinler82d507d2017-10-12 16:36:57 -050045 * <item> & <X> are populated from the sensor key.
46 *
47 * @param[in] path - Directory path of the label file
Matt Spinler7c424802018-05-04 10:52:40 -050048 * @param[in] fileSuffix - The file suffix
Matt Spinler82d507d2017-10-12 16:36:57 -050049 * @param[in] sensor - Sensor details
50 */
Patrick Venture043d3232018-08-31 10:10:53 -070051std::string getIndirectID(std::string path, const std::string& fileSuffix,
52 const SensorSet::key_type& sensor);
Patrick Venture7a5285d2018-04-17 19:15:05 -070053
Patrick Venture043d3232018-08-31 10:10:53 -070054} // namespace env