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