blob: 50a9fdb49ff7a89c95fd5593c31ea80a040b1420 [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 *
11 * Reads <prefix>_<sensor.first><sensor.second>
12 *
13 * @param[in] prefix - the variable prefix
14 * @param[in] sensor - Sensor details
15 *
16 * @return string - the env var value
17 */
Brad Bishopf3df6b42017-01-06 10:14:09 -050018std::string getEnv(
19 const char* prefix, const SensorSet::key_type& sensor);
Tom Joseph1f8a9582017-06-12 20:10:59 +053020
Matt Spinler049e0dd2017-10-12 16:33:22 -050021/** @brief Reads an environment variable, and takes type and id separately
22 *
23 * @param[in] prefix - the variable prefix
24 * @param[in] type - sensor type, like 'temp'
25 * @param[in] id - sensor ID, like '5'
26 *
27 * @return string - the env var value
28 */
29std::string getEnv(
30 const char* prefix,
31 const std::string& type,
32 const std::string& id);
33
Matt Spinler82d507d2017-10-12 16:36:57 -050034/** @brief Gets the ID for the sensor with a level of indirection
35 *
36 * Read the sensor number/ID from the <path>/<item><X>_label file.
37 * <item> & <X> are populated from the sensor key.
38 *
39 * @param[in] path - Directory path of the label file
40 * @param[in] sensor - Sensor details
41 */
42std::string getIndirectID(
43 std::string path,
44 const SensorSet::key_type& sensor);
Patrick Venture7a5285d2018-04-17 19:15:05 -070045
46} // namespace env