Expose WriteToSensor API in the Store
Redfish Sensor PATCH will call this API from the store. It needs to be accessible at the store level.
#tlbmc
#pid-tlbmc-migration
PiperOrigin-RevId: 826213616
Change-Id: I3095bd5add260a05df9c7ad97a50e1d45402f2c3
diff --git a/tlbmc/store/store.h b/tlbmc/store/store.h
index 0dbcff1..a77f038 100644
--- a/tlbmc/store/store.h
+++ b/tlbmc/store/store.h
@@ -80,6 +80,9 @@
const std::string& board_config_key,
const std::string& sensor_key) const = 0;
+ virtual absl::Status WriteToSensor(const std::string& sensor_key,
+ const SensorValue& value) = 0;
+
// Returns the sensor devpath for the given sensor object.
virtual absl::StatusOr<const std::string&> GetDevpathFromSensor(
std::shared_ptr<const Sensor> sensor) const = 0;
diff --git a/tlbmc/store/store_impl.cc b/tlbmc/store/store_impl.cc
index f28df97..abf760d 100644
--- a/tlbmc/store/store_impl.cc
+++ b/tlbmc/store/store_impl.cc
@@ -87,6 +87,11 @@
board_config_key, sensor_key);
}
+absl::Status StoreImpl::WriteToSensor(const std::string& sensor_key,
+ const SensorValue& value) {
+ return all_collectors_.sensor_collector->WriteToSensor(sensor_key, value);
+}
+
absl::StatusOr<const std::string&> StoreImpl::GetDevpathFromSensor(
std::shared_ptr<const Sensor> sensor) const {
// Get devpath for the sensor.
diff --git a/tlbmc/store/store_impl.h b/tlbmc/store/store_impl.h
index 42559b8..1930f2b 100644
--- a/tlbmc/store/store_impl.h
+++ b/tlbmc/store/store_impl.h
@@ -114,6 +114,10 @@
std::shared_ptr<const Sensor> GetSensorByConfigKeyAndSensorKey(
const std::string& board_config_key,
const std::string& sensor_key) const override;
+
+ absl::Status WriteToSensor(const std::string& sensor_key,
+ const SensorValue& value) override;
+
// Returns the sensor devpath for the given sensor key.
absl::StatusOr<const std::string&> GetDevpathFromSensor(
std::shared_ptr<const Sensor> sensor) const override;