blob: e1169e15148e2d4bddde852c046409669f56cc9c [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
Matt Spinler82d507d2017-10-12 16:36:57 -050030/** @brief Gets the ID for the sensor with a level of indirection
31 *
32 * Read the sensor number/ID from the <path>/<item><X>_label file.
33 * <item> & <X> are populated from the sensor key.
34 *
35 * @param[in] path - Directory path of the label file
36 * @param[in] sensor - Sensor details
37 */
38std::string getIndirectID(
39 std::string path,
40 const SensorSet::key_type& sensor);
41
Tom Joseph1f8a9582017-06-12 20:10:59 +053042/** @brief Get the label for the sensor with a level of indirection.
43 *
44 * Read the sensor number from the <path>/<item><X>_label file.<item> & <X> is
45 * populated from the sensor key. The sensor label is read from the environment
46 * variable <prefix>_<item><sensorNum>.
47 *
48 * @param[in] prefix - Prefix of the environment variable.
49 * @param[in] path - Directory path of the label file.
50 * @param[in] sensor - Sensor details.
51 *
52 * @return On success return the sensor label, in case of failure return empty
53 * string.
54 */
55std::string getIndirectLabelEnv(
56 const char* prefix, std::string path, const SensorSet::key_type& sensor);