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