xref: /openbmc/dbus-sensors/src/SensorPaths.hpp (revision 0d2f96f1e95a6a37f00a3c458c8562d6af92e4a4)
1 #pragma once
2 
3 #include <string>
4 
5 namespace sensor_paths
6 {
7 
8 // This is an allowlist of the units a sensor can measure. Should be in sync
9 // with
10 // phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Sensor/Value.interface.yaml#L38
11 
12 constexpr const char* unitDegreesC =
13     "xyz.openbmc_project.Sensor.Value.Unit.DegreesC";
14 constexpr const char* unitRPMs = "xyz.openbmc_project.Sensor.Value.Unit.RPMS";
15 constexpr const char* unitVolts = "xyz.openbmc_project.Sensor.Value.Unit.Volts";
16 constexpr const char* unitMeters =
17     "xyz.openbmc_project.Sensor.Value.Unit.Meters";
18 constexpr const char* unitAmperes =
19     "xyz.openbmc_project.Sensor.Value.Unit.Amperes";
20 constexpr const char* unitWatts = "xyz.openbmc_project.Sensor.Value.Unit.Watts";
21 constexpr const char* unitJoules =
22     "xyz.openbmc_project.Sensor.Value.Unit.Joules";
23 constexpr const char* unitPercent =
24     "xyz.openbmc_project.Sensor.Value.Unit.Percent";
25 constexpr const char* unitCFM = "xyz.openbmc_project.Sensor.Value.Unit.CFM";
26 constexpr const char* unitPascals =
27     "xyz.openbmc_project.Sensor.Value.Unit.Pascals";
28 constexpr const char* unitPercentRH =
29     "xyz.openbmc_project.Sensor.Value.Unit.PercentRH";
30 
31 std::string getPathForUnits(const std::string& units);
32 
33 std::string escapePathForDbus(const std::string& name);
34 
35 } // namespace sensor_paths
36