blob: e2475fac0cd71d535957f7cacaa5bfaadcf7c70b [file] [log] [blame]
Josh Lehan2a40e932020-09-02 11:48:14 -07001#pragma once
2
3#include <cstring>
Ed Tanous6cb732a2021-02-18 15:33:51 -08004#include <regex>
Josh Lehan2a40e932020-09-02 11:48:14 -07005#include <string>
6
Ed Tanous6cb732a2021-02-18 15:33:51 -08007namespace sensor_paths
Josh Lehan2a40e932020-09-02 11:48:14 -07008{
9
Josh Lehan2a40e932020-09-02 11:48:14 -070010// This is an allowlist of the units a sensor can measure. Should be in sync
11// with
Konstantin Aladyshevce6bcdf2022-06-09 20:03:46 +030012// phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Sensor/Value.interface.yaml#L38
Josh Lehan2a40e932020-09-02 11:48:14 -070013
Zev Weiss6b6891c2021-04-22 02:46:21 -050014constexpr const char* unitDegreesC =
15 "xyz.openbmc_project.Sensor.Value.Unit.DegreesC";
16constexpr const char* unitRPMs = "xyz.openbmc_project.Sensor.Value.Unit.RPMS";
17constexpr const char* unitVolts = "xyz.openbmc_project.Sensor.Value.Unit.Volts";
18constexpr const char* unitMeters =
19 "xyz.openbmc_project.Sensor.Value.Unit.Meters";
20constexpr const char* unitAmperes =
21 "xyz.openbmc_project.Sensor.Value.Unit.Amperes";
22constexpr const char* unitWatts = "xyz.openbmc_project.Sensor.Value.Unit.Watts";
23constexpr const char* unitJoules =
24 "xyz.openbmc_project.Sensor.Value.Unit.Joules";
25constexpr const char* unitPercent =
26 "xyz.openbmc_project.Sensor.Value.Unit.Percent";
27constexpr const char* unitCFM = "xyz.openbmc_project.Sensor.Value.Unit.CFM";
Bruce Mitchell323969b2021-07-15 16:23:00 -050028constexpr const char* unitPascals =
29 "xyz.openbmc_project.Sensor.Value.Unit.Pascals";
Zev Weiss6b6891c2021-04-22 02:46:21 -050030
Ed Tanous6cb732a2021-02-18 15:33:51 -080031std::string getPathForUnits(const std::string& units);
Josh Lehan2a40e932020-09-02 11:48:14 -070032
Ed Tanous6cb732a2021-02-18 15:33:51 -080033std::string escapePathForDbus(const std::string& name);
34
35} // namespace sensor_paths