Return sensor object state data as optional

Previously, the getObject function moved the sensor data passed in as a
constant reference, which should not have been done. The intention of
the getObject function is to retrieve the sensor's object state data.
Then, the necessary sensor data and the created object state data can be
appropriately handled for monitoring.

This change is to remove this confusion and clearly create the sensor's
object state data without modifying the sensor set data passed in to
getObject.

Tested:
    Sensor objects are still created correctly
    Sensor states are monitoring and updated as before

Change-Id: I19fc22fa79094d749e7d5f3b2693094e245b5a4a
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
2 files changed
tree: 5cf4e264edfc722fb7bf71e7ac2a12834db33cf6
  1. msl/
  2. test/
  3. tools/
  4. .gitignore
  5. argument.cpp
  6. argument.hpp
  7. bootstrap.sh
  8. configure.ac
  9. env.cpp
  10. env.hpp
  11. fan_pwm.cpp
  12. fan_pwm.hpp
  13. fan_speed.cpp
  14. fan_speed.hpp
  15. hwmon.cpp
  16. hwmon.hpp
  17. hwmonio.cpp
  18. hwmonio.hpp
  19. interface.hpp
  20. LICENSE
  21. mainloop.cpp
  22. mainloop.hpp
  23. Makefile.am
  24. readd.cpp
  25. README.iio.md
  26. README.md
  27. sensorset.cpp
  28. sensorset.hpp
  29. sysfs.cpp
  30. sysfs.hpp
  31. targets.hpp
  32. thresholds.hpp
  33. timer.cpp
  34. timer.hpp
  35. util.hpp
README.md

Exposes generic hwmon entries as DBus objects.

To Build

To build this package, do the following steps:

    1. ./bootstrap.sh
    2. ./configure ${CONFIGURE_FLAGS}
    3. make

To clean the repository run `./bootstrap.sh clean`.

D-Bus bus names

To enable the use of Linux features like cgroups prioritization and
udev/systemd control, one instance of phosphor-hwmon is intended to
be run per hwmon sysfs class instance.

This requires an algorithm for selecting a stable, well-known D-Bus busname.

The algorithm is <PREFIX>-<ID>.Hwmon<N> where PREFIX is an autoconf
configurable prefix (BUSNAME_PREFIX, xyz.openbmc_project by default),
ID is a std::hash of the /sys/devices path backing the hwmon class
instance, and N is the implemented phosphor-hwmon D-Bus API version.