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