Josh Lehan | 2a40e93 | 2020-09-02 11:48:14 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <cstring> |
Ed Tanous | 6cb732a | 2021-02-18 15:33:51 -0800 | [diff] [blame] | 4 | #include <regex> |
Josh Lehan | 2a40e93 | 2020-09-02 11:48:14 -0700 | [diff] [blame] | 5 | #include <string> |
| 6 | |
Ed Tanous | 6cb732a | 2021-02-18 15:33:51 -0800 | [diff] [blame] | 7 | namespace sensor_paths |
Josh Lehan | 2a40e93 | 2020-09-02 11:48:14 -0700 | [diff] [blame] | 8 | { |
| 9 | |
Josh Lehan | 2a40e93 | 2020-09-02 11:48:14 -0700 | [diff] [blame] | 10 | // This is an allowlist of the units a sensor can measure. Should be in sync |
| 11 | // with |
Konstantin Aladyshev | ce6bcdf | 2022-06-09 20:03:46 +0300 | [diff] [blame] | 12 | // phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Sensor/Value.interface.yaml#L38 |
Josh Lehan | 2a40e93 | 2020-09-02 11:48:14 -0700 | [diff] [blame] | 13 | |
Zev Weiss | 6b6891c | 2021-04-22 02:46:21 -0500 | [diff] [blame] | 14 | constexpr const char* unitDegreesC = |
| 15 | "xyz.openbmc_project.Sensor.Value.Unit.DegreesC"; |
| 16 | constexpr const char* unitRPMs = "xyz.openbmc_project.Sensor.Value.Unit.RPMS"; |
| 17 | constexpr const char* unitVolts = "xyz.openbmc_project.Sensor.Value.Unit.Volts"; |
| 18 | constexpr const char* unitMeters = |
| 19 | "xyz.openbmc_project.Sensor.Value.Unit.Meters"; |
| 20 | constexpr const char* unitAmperes = |
| 21 | "xyz.openbmc_project.Sensor.Value.Unit.Amperes"; |
| 22 | constexpr const char* unitWatts = "xyz.openbmc_project.Sensor.Value.Unit.Watts"; |
| 23 | constexpr const char* unitJoules = |
| 24 | "xyz.openbmc_project.Sensor.Value.Unit.Joules"; |
| 25 | constexpr const char* unitPercent = |
| 26 | "xyz.openbmc_project.Sensor.Value.Unit.Percent"; |
| 27 | constexpr const char* unitCFM = "xyz.openbmc_project.Sensor.Value.Unit.CFM"; |
Bruce Mitchell | 323969b | 2021-07-15 16:23:00 -0500 | [diff] [blame] | 28 | constexpr const char* unitPascals = |
| 29 | "xyz.openbmc_project.Sensor.Value.Unit.Pascals"; |
Zev Weiss | 6b6891c | 2021-04-22 02:46:21 -0500 | [diff] [blame] | 30 | |
Ed Tanous | 6cb732a | 2021-02-18 15:33:51 -0800 | [diff] [blame] | 31 | std::string getPathForUnits(const std::string& units); |
Josh Lehan | 2a40e93 | 2020-09-02 11:48:14 -0700 | [diff] [blame] | 32 | |
Ed Tanous | 6cb732a | 2021-02-18 15:33:51 -0800 | [diff] [blame] | 33 | std::string escapePathForDbus(const std::string& name); |
| 34 | |
| 35 | } // namespace sensor_paths |