sensors: split building from manager object
To increase testability, split out the building of sensors
from the sensor manager. And this further splits out building
from a configuration file.
Tested: Verified code continued to build and link.
Tested: Ran on quanta-q71l board and it behaved as expected.
Change-Id: Ib63a11e1107b1864c3c370bba2bd9ef2effa42f3
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/sensors/manager.hpp b/sensors/manager.hpp
index d466039..a3e7420 100644
--- a/sensors/manager.hpp
+++ b/sensors/manager.hpp
@@ -32,18 +32,7 @@
void addSensor(
std::string type,
std::string name,
- std::unique_ptr<Sensor> sensor)
- {
- _sensorMap[name] = std::move(sensor);
-
- auto entry = _sensorTypeList.find(type);
- if (entry == _sensorTypeList.end())
- {
- _sensorTypeList[type] = {};
- }
-
- _sensorTypeList[type].push_back(name);
- }
+ std::unique_ptr<Sensor> sensor);
// TODO(venture): Should implement read/write by name.
std::unique_ptr<Sensor>& getSensor(std::string name)
@@ -69,7 +58,3 @@
sdbusplus::bus::bus _hostSensorBus;
};
-std::shared_ptr<SensorManager> BuildSensors(
- std::map<std::string, struct sensor>& Config);
-
-std::shared_ptr<SensorManager> BuildSensorsFromConfig(std::string& path);