xref: /openbmc/dbus-sensors/src/SensorPaths.hpp (revision 18b6186e531ae37dd22b634c6530f793528473f4)
1 #pragma once
2 
3 #include <cstring>
4 #include <string>
5 
6 namespace sensor_paths
7 {
8 
9 // This is an allowlist of the units a sensor can measure. Should be in sync
10 // with
11 // phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Sensor/Value.interface.yaml#L38
12 
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";
27 constexpr const char* unitPascals =
28     "xyz.openbmc_project.Sensor.Value.Unit.Pascals";
29 constexpr const char* unitPercentRH =
30     "xyz.openbmc_project.Sensor.Value.Unit.PercentRH";
31 
32 std::string getPathForUnits(const std::string& units);
33 
34 std::string escapePathForDbus(const std::string& name);
35 
36 } // namespace sensor_paths
37