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