Brad Bishop | f3df6b4 | 2017-01-06 10:14:09 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | class SensorSet; |
| 4 | |
Matt Spinler | 049e0dd | 2017-10-12 16:33:22 -0500 | [diff] [blame] | 5 | /** @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 Bishop | f3df6b4 | 2017-01-06 10:14:09 -0500 | [diff] [blame] | 14 | std::string getEnv( |
| 15 | const char* prefix, const SensorSet::key_type& sensor); |
Tom Joseph | 1f8a958 | 2017-06-12 20:10:59 +0530 | [diff] [blame] | 16 | |
Matt Spinler | 049e0dd | 2017-10-12 16:33:22 -0500 | [diff] [blame] | 17 | /** @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 | */ |
| 25 | std::string getEnv( |
| 26 | const char* prefix, |
| 27 | const std::string& type, |
| 28 | const std::string& id); |
| 29 | |
Matt Spinler | 82d507d | 2017-10-12 16:36:57 -0500 | [diff] [blame^] | 30 | /** @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 | */ |
| 38 | std::string getIndirectID( |
| 39 | std::string path, |
| 40 | const SensorSet::key_type& sensor); |
| 41 | |
Tom Joseph | 1f8a958 | 2017-06-12 20:10:59 +0530 | [diff] [blame] | 42 | /** @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 | */ |
| 55 | std::string getIndirectLabelEnv( |
| 56 | const char* prefix, std::string path, const SensorSet::key_type& sensor); |