blob: 6342e25ae782309a6cc56a60e7dccfc56def5475 [file] [log] [blame]
Brad Bishopf3df6b42017-01-06 10:14:09 -05001#pragma once
2
3class SensorSet;
4
Matt Spinler049e0dd2017-10-12 16:33:22 -05005/** @brief Reads an environment variable
6 *
7 * Reads <prefix>_<sensor.first><sensor.second>
8 *
9 * @param[in] prefix - the variable prefix
10 * @param[in] sensor - Sensor details
11 *
12 * @return string - the env var value
13 */
Brad Bishopf3df6b42017-01-06 10:14:09 -050014std::string getEnv(
15 const char* prefix, const SensorSet::key_type& sensor);
Tom Joseph1f8a9582017-06-12 20:10:59 +053016
Matt Spinler049e0dd2017-10-12 16:33:22 -050017/** @brief Reads an environment variable, and takes type and id separately
18 *
19 * @param[in] prefix - the variable prefix
20 * @param[in] type - sensor type, like 'temp'
21 * @param[in] id - sensor ID, like '5'
22 *
23 * @return string - the env var value
24 */
25std::string getEnv(
26 const char* prefix,
27 const std::string& type,
28 const std::string& id);
29
Tom Joseph1f8a9582017-06-12 20:10:59 +053030/** @brief Get the label for the sensor with a level of indirection.
31 *
32 * Read the sensor number from the <path>/<item><X>_label file.<item> & <X> is
33 * populated from the sensor key. The sensor label is read from the environment
34 * variable <prefix>_<item><sensorNum>.
35 *
36 * @param[in] prefix - Prefix of the environment variable.
37 * @param[in] path - Directory path of the label file.
38 * @param[in] sensor - Sensor details.
39 *
40 * @return On success return the sensor label, in case of failure return empty
41 * string.
42 */
43std::string getIndirectLabelEnv(
44 const char* prefix, std::string path, const SensorSet::key_type& sensor);