blob: 023d61538f1c195da5451ec24c99b3414998d021 [file] [log] [blame]
Josh Lehan2a40e932020-09-02 11:48:14 -07001#pragma once
2
3#include <cstring>
Ed Tanous6cb732a2021-02-18 15:33:51 -08004#include <regex>
Josh Lehan2a40e932020-09-02 11:48:14 -07005#include <string>
6
Ed Tanous6cb732a2021-02-18 15:33:51 -08007namespace sensor_paths
Josh Lehan2a40e932020-09-02 11:48:14 -07008{
9
Josh Lehan2a40e932020-09-02 11:48:14 -070010// This is an allowlist of the units a sensor can measure. Should be in sync
11// with
12// phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Sensor/Value.interface.yaml#L35
13
Zev Weiss6b6891c2021-04-22 02:46:21 -050014constexpr const char* unitDegreesC =
15 "xyz.openbmc_project.Sensor.Value.Unit.DegreesC";
16constexpr const char* unitRPMs = "xyz.openbmc_project.Sensor.Value.Unit.RPMS";
17constexpr const char* unitVolts = "xyz.openbmc_project.Sensor.Value.Unit.Volts";
18constexpr const char* unitMeters =
19 "xyz.openbmc_project.Sensor.Value.Unit.Meters";
20constexpr const char* unitAmperes =
21 "xyz.openbmc_project.Sensor.Value.Unit.Amperes";
22constexpr const char* unitWatts = "xyz.openbmc_project.Sensor.Value.Unit.Watts";
23constexpr const char* unitJoules =
24 "xyz.openbmc_project.Sensor.Value.Unit.Joules";
25constexpr const char* unitPercent =
26 "xyz.openbmc_project.Sensor.Value.Unit.Percent";
27constexpr const char* unitCFM = "xyz.openbmc_project.Sensor.Value.Unit.CFM";
28
Ed Tanous6cb732a2021-02-18 15:33:51 -080029std::string getPathForUnits(const std::string& units);
Josh Lehan2a40e932020-09-02 11:48:14 -070030
Ed Tanous6cb732a2021-02-18 15:33:51 -080031std::string escapePathForDbus(const std::string& name);
32
33} // namespace sensor_paths