blob: 91654afde068176c1b74710be8cdcf3e17468db7 [file] [log] [blame]
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -05001#pragma once
2
Brandon Kim9cf85622019-06-19 12:05:08 -07003#include "config.h"
4
Patrick Venture46470a32018-09-07 19:26:25 -07005#include "sensorhandler.hpp"
Patrick Venture0b02be92018-08-31 11:55:55 -07006
Patrick Venture586d35b2018-09-07 19:56:18 -07007#include <cmath>
Vernon Mauerye08fbff2019-04-03 09:19:34 -07008#include <ipmid/api.hpp>
Vernon Mauery33250242019-03-12 16:49:26 -07009#include <ipmid/types.hpp>
Vernon Mauery6a98fe72019-03-11 15:57:48 -070010#include <ipmid/utils.hpp>
Tony Leec5324252019-10-31 17:24:16 +080011#include <phosphor-logging/elog-errors.hpp>
12#include <phosphor-logging/log.hpp>
William A. Kennington III4c008022018-10-12 17:18:14 -070013#include <sdbusplus/message/types.hpp>
Patrick Venture0b02be92018-08-31 11:55:55 -070014
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -050015namespace ipmi
16{
17namespace sensor
18{
19
20using Assertion = uint16_t;
21using Deassertion = uint16_t;
22using AssertionSet = std::pair<Assertion, Deassertion>;
23
24using Service = std::string;
25using Path = std::string;
26using Interface = std::string;
27
28using ServicePath = std::pair<Path, Service>;
29
30using Interfaces = std::vector<Interface>;
31
32using MapperResponseType = std::map<Path, std::map<Service, Interfaces>>;
Tony Leec5324252019-10-31 17:24:16 +080033using namespace phosphor::logging;
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -050034
35/** @brief get the D-Bus service and service path
36 * @param[in] bus - The Dbus bus object
37 * @param[in] interface - interface to the service
38 * @param[in] path - interested path in the list of objects
39 * @return pair of service path and service
40 */
41ServicePath getServiceAndPath(sdbusplus::bus::bus& bus,
42 const std::string& interface,
43 const std::string& path = std::string());
44
45/** @brief Make assertion set from input data
46 * @param[in] cmdData - Input sensor data
47 * @return pair of assertion and deassertion set
48 */
49AssertionSet getAssertionSet(const SetSensorReadingReq& cmdData);
50
51/** @brief send the message to DBus
52 * @param[in] msg - message to send
53 * @return failure status in IPMI error code
54 */
Dhruvaraj Subhashchandran2a444d02017-08-07 01:45:14 -050055ipmi_ret_t updateToDbus(IpmiUpdateData& msg);
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -050056
Tom Joseph816e92b2017-09-06 19:23:00 +053057namespace get
58{
59
Tom Josephb0adbcd2018-01-24 11:51:29 +053060/** @brief Populate sensor name from the D-Bus property associated with the
61 * sensor. In the example entry from the yaml, the name of the D-bus
62 * property "AttemptsLeft" is the sensor name.
63 *
64 * 0x07:
65 * sensorType: 195
66 * path: /xyz/openbmc_project/state/host0
67 * sensorReadingType: 0x6F
68 * serviceInterface: org.freedesktop.DBus.Properties
69 * readingType: readingAssertion
70 * sensorNamePattern: nameProperty
71 * interfaces:
72 * xyz.openbmc_project.Control.Boot.RebootAttempts:
73 * AttemptsLeft:
74 * Offsets:
75 * 0xFF:
76 * type: uint32_t
77 *
78 *
79 * @param[in] sensorInfo - Dbus info related to sensor.
80 *
81 * @return On success return the sensor name for the sensor.
82 */
83inline SensorName nameProperty(const Info& sensorInfo)
84{
85 return sensorInfo.propertyInterfaces.begin()->second.begin()->first;
86}
87
88/** @brief Populate sensor name from the D-Bus object associated with the
89 * sensor. If the object path is /system/chassis/motherboard/dimm0 then
90 * the leaf dimm0 is considered as the sensor name.
91 *
92 * @param[in] sensorInfo - Dbus info related to sensor.
93 *
94 * @return On success return the sensor name for the sensor.
95 */
96inline SensorName nameLeaf(const Info& sensorInfo)
97{
98 return sensorInfo.sensorPath.substr(
Patrick Venture0b02be92018-08-31 11:55:55 -070099 sensorInfo.sensorPath.find_last_of('/') + 1,
100 sensorInfo.sensorPath.length());
Tom Josephb0adbcd2018-01-24 11:51:29 +0530101}
102
103/** @brief Populate sensor name from the D-Bus object associated with the
Lotus Xu2101a442020-12-24 16:01:56 +0800104 * sensor and the property.
105 * If the object path is /xyz/openbmc_project/inventory/Fan0 and
106 * the property is Present, the leaf Fan0 and the Property is
107 * joined to Fan0_Present as the sensor name.
108 *
109 * @param[in] sensorInfo - Dbus info related to sensor.
110 *
111 * @return On success return the sensor name for the sensor.
112 */
113inline SensorName nameLeafProperty(const Info& sensorInfo)
114{
115 return nameLeaf(sensorInfo) + "_" + nameProperty(sensorInfo);
116}
117
118/** @brief Populate sensor name from the D-Bus object associated with the
Tom Josephb0adbcd2018-01-24 11:51:29 +0530119 * sensor. If the object path is /system/chassis/motherboard/cpu0/core0
120 * then the sensor name is cpu0_core0. The leaf and the parent is put
121 * together to get the sensor name.
122 *
123 * @param[in] sensorInfo - Dbus info related to sensor.
124 *
125 * @return On success return the sensor name for the sensor.
126 */
127SensorName nameParentLeaf(const Info& sensorInfo);
128
Tom Joseph816e92b2017-09-06 19:23:00 +0530129/**
130 * @brief Helper function to map the dbus info to sensor's assertion status
131 * for the get sensor reading command.
132 *
133 * @param[in] sensorInfo - Dbus info related to sensor.
134 * @param[in] path - Dbus object path.
135 * @param[in] interface - Dbus interface.
136 *
137 * @return Response for get sensor reading command.
138 */
139GetSensorResponse mapDbusToAssertion(const Info& sensorInfo,
140 const InstancePath& path,
141 const DbusInterface& interface);
142
Lei YU8c2c0482021-09-16 17:28:28 +0800143#ifndef FEATURE_SENSORS_CACHE
Tom Joseph816e92b2017-09-06 19:23:00 +0530144/**
145 * @brief Map the Dbus info to sensor's assertion status in the Get sensor
146 * reading command response.
147 *
148 * @param[in] sensorInfo - Dbus info related to sensor.
149 *
150 * @return Response for get sensor reading command.
151 */
152GetSensorResponse assertion(const Info& sensorInfo);
153
Tom Josephe4014fc2017-09-06 23:57:36 +0530154/**
155 * @brief Maps the Dbus info to the reading field in the Get sensor reading
156 * command response.
157 *
158 * @param[in] sensorInfo - Dbus info related to sensor.
159 *
160 * @return Response for get sensor reading command.
161 */
162GetSensorResponse eventdata2(const Info& sensorInfo);
163
Tom Joseph295f17e2017-09-07 00:09:46 +0530164/**
165 * @brief readingAssertion is a case where the entire assertion state field
166 * serves as the sensor value.
167 *
168 * @tparam T - type of the dbus property related to sensor.
169 * @param[in] sensorInfo - Dbus info related to sensor.
170 *
171 * @return Response for get sensor reading command.
172 */
Patrick Venture0b02be92018-08-31 11:55:55 -0700173template <typename T>
Tom Joseph295f17e2017-09-07 00:09:46 +0530174GetSensorResponse readingAssertion(const Info& sensorInfo)
175{
176 sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
Patrick Venture0b02be92018-08-31 11:55:55 -0700177 GetSensorResponse response{};
Tom Joseph295f17e2017-09-07 00:09:46 +0530178
Jeremy Kerr3dc35582020-05-17 15:47:07 +0800179 enableScanning(&response);
180
Patrick Venture0b02be92018-08-31 11:55:55 -0700181 auto service = ipmi::getService(bus, sensorInfo.sensorInterface,
Tom Joseph295f17e2017-09-07 00:09:46 +0530182 sensorInfo.sensorPath);
183
184 auto propValue = ipmi::getDbusProperty(
Patrick Venture0b02be92018-08-31 11:55:55 -0700185 bus, service, sensorInfo.sensorPath,
186 sensorInfo.propertyInterfaces.begin()->first,
187 sensorInfo.propertyInterfaces.begin()->second.begin()->first);
Tom Joseph295f17e2017-09-07 00:09:46 +0530188
Sui Chen4cc42552019-09-11 10:28:35 -0700189 setAssertionBytes(static_cast<uint16_t>(std::get<T>(propValue)), &response);
Tom Joseph295f17e2017-09-07 00:09:46 +0530190
191 return response;
192}
193
Tom Josephe05b2922017-09-07 00:43:16 +0530194/** @brief Map the Dbus info to the reading field in the Get sensor reading
195 * command response
196 *
197 * @tparam T - type of the dbus property related to sensor.
198 * @param[in] sensorInfo - Dbus info related to sensor.
199 *
200 * @return Response for get sensor reading command.
201 */
Patrick Venture0b02be92018-08-31 11:55:55 -0700202template <typename T>
Tom Josephe05b2922017-09-07 00:43:16 +0530203GetSensorResponse readingData(const Info& sensorInfo)
204{
205 sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
Tom Josephe05b2922017-09-07 00:43:16 +0530206
Sui Chen4cc42552019-09-11 10:28:35 -0700207 GetSensorResponse response{};
208
209 enableScanning(&response);
Tom Josephe05b2922017-09-07 00:43:16 +0530210
Patrick Venture0b02be92018-08-31 11:55:55 -0700211 auto service = ipmi::getService(bus, sensorInfo.sensorInterface,
Tom Josephe05b2922017-09-07 00:43:16 +0530212 sensorInfo.sensorPath);
213
Brandon Kim9cf85622019-06-19 12:05:08 -0700214#ifdef UPDATE_FUNCTIONAL_ON_FAIL
215 // Check the OperationalStatus interface for functional property
216 if (sensorInfo.propertyInterfaces.begin()->first ==
217 "xyz.openbmc_project.Sensor.Value")
218 {
219 bool functional = true;
220 try
221 {
222 auto funcValue = ipmi::getDbusProperty(
223 bus, service, sensorInfo.sensorPath,
224 "xyz.openbmc_project.State.Decorator.OperationalStatus",
225 "Functional");
226 functional = std::get<bool>(funcValue);
227 }
228 catch (...)
229 {
230 // No-op if Functional property could not be found since this
231 // check is only valid for Sensor.Value read for hwmonio
232 }
233 if (!functional)
234 {
235 throw SensorFunctionalError();
236 }
237 }
238#endif
239
Tom Josephe05b2922017-09-07 00:43:16 +0530240 auto propValue = ipmi::getDbusProperty(
Patrick Venture0b02be92018-08-31 11:55:55 -0700241 bus, service, sensorInfo.sensorPath,
242 sensorInfo.propertyInterfaces.begin()->first,
243 sensorInfo.propertyInterfaces.begin()->second.begin()->first);
Tom Josephe05b2922017-09-07 00:43:16 +0530244
Vernon Maueryf442e112019-04-09 11:44:36 -0700245 double value = std::get<T>(propValue) *
Patrick Venture586d35b2018-09-07 19:56:18 -0700246 std::pow(10, sensorInfo.scale - sensorInfo.exponentR);
Tony Leec5324252019-10-31 17:24:16 +0800247 int32_t rawData =
248 (value - sensorInfo.scaledOffset) / sensorInfo.coefficientM;
Tom Josephe05b2922017-09-07 00:43:16 +0530249
Tony Leec5324252019-10-31 17:24:16 +0800250 constexpr uint8_t sensorUnitsSignedBits = 2 << 6;
251 constexpr uint8_t signedDataFormat = 0x80;
252 // if sensorUnits1 [7:6] = 10b, sensor is signed
253 if ((sensorInfo.sensorUnits1 & sensorUnitsSignedBits) == signedDataFormat)
254 {
255 if (rawData > std::numeric_limits<int8_t>::max() ||
256 rawData < std::numeric_limits<int8_t>::lowest())
257 {
258 log<level::ERR>("Value out of range");
259 throw std::out_of_range("Value out of range");
260 }
261 setReading(static_cast<int8_t>(rawData), &response);
262 }
263 else
264 {
265 if (rawData > std::numeric_limits<uint8_t>::max() ||
266 rawData < std::numeric_limits<uint8_t>::lowest())
267 {
268 log<level::ERR>("Value out of range");
269 throw std::out_of_range("Value out of range");
270 }
271 setReading(static_cast<uint8_t>(rawData), &response);
272 }
Tom Josephe05b2922017-09-07 00:43:16 +0530273
Konstantin Aladyshevf93b29c2021-05-05 14:49:14 +0300274 if (!std::isfinite(value))
275 {
276 response.readingOrStateUnavailable = 1;
277 }
278
Konstantin Aladyshev778f6592021-11-02 11:28:25 +0300279 bool critAlarmHigh;
280 try
281 {
282 critAlarmHigh = std::get<bool>(ipmi::getDbusProperty(
283 bus, service, sensorInfo.sensorPath,
284 "xyz.openbmc_project.Sensor.Threshold.Critical",
285 "CriticalAlarmHigh"));
286 }
287 catch (const std::exception& e)
288 {
289 critAlarmHigh = false;
290 }
291 bool critAlarmLow;
292 try
293 {
294 critAlarmLow = std::get<bool>(ipmi::getDbusProperty(
295 bus, service, sensorInfo.sensorPath,
296 "xyz.openbmc_project.Sensor.Threshold.Critical",
297 "CriticalAlarmLow"));
298 }
299 catch (const std::exception& e)
300 {
301 critAlarmLow = false;
302 }
303 bool warningAlarmHigh;
304 try
305 {
306 warningAlarmHigh = std::get<bool>(ipmi::getDbusProperty(
307 bus, service, sensorInfo.sensorPath,
308 "xyz.openbmc_project.Sensor.Threshold.Warning",
309 "WarningAlarmHigh"));
310 }
311 catch (const std::exception& e)
312 {
313 warningAlarmHigh = false;
314 }
315 bool warningAlarmLow;
316 try
317 {
318 warningAlarmLow = std::get<bool>(ipmi::getDbusProperty(
319 bus, service, sensorInfo.sensorPath,
320 "xyz.openbmc_project.Sensor.Threshold.Warning", "WarningAlarmlow"));
321 }
322 catch (const std::exception& e)
323 {
324 warningAlarmLow = false;
325 }
326 response.thresholdLevelsStates =
327 (static_cast<uint8_t>(critAlarmHigh) << 4) |
328 (static_cast<uint8_t>(warningAlarmHigh) << 3) |
329 (static_cast<uint8_t>(warningAlarmLow) << 2) |
330 (static_cast<uint8_t>(critAlarmLow) << 1);
331
Tom Josephe05b2922017-09-07 00:43:16 +0530332 return response;
333}
334
Lei YU8c2c0482021-09-16 17:28:28 +0800335#else
336
337using SensorCacheMap =
338 std::map<uint8_t, std::optional<ipmi::sensor::GetSensorResponse>>;
339extern SensorCacheMap sensorCacheMap;
340
341/**
342 * @brief Map the Dbus info to sensor's assertion status in the Get sensor
343 * reading command response.
344 *
345 * @param[in] id - The sensor id
346 * @param[in] sensorInfo - Dbus info related to sensor.
347 * @param[in] msg - Dbus message from match callback.
348 *
349 * @return Response for get sensor reading command.
350 */
351std::optional<GetSensorResponse> assertion(uint8_t id, const Info& sensorInfo,
352 sdbusplus::message::message& msg);
353
354/**
355 * @brief Maps the Dbus info to the reading field in the Get sensor reading
356 * command response.
357 *
358 * @param[in] id - The sensor id
359 * @param[in] sensorInfo - Dbus info related to sensor.
360 * @param[in] msg - Dbus message from match callback.
361 *
362 * @return Response for get sensor reading command.
363 */
364std::optional<GetSensorResponse> eventdata2(uint8_t id, const Info& sensorInfo,
365 sdbusplus::message::message& msg);
366
367/**
368 * @brief readingAssertion is a case where the entire assertion state field
369 * serves as the sensor value.
370 *
371 * @tparam T - type of the dbus property related to sensor.
372 * @param[in] id - The sensor id
373 * @param[in] sensorInfo - Dbus info related to sensor.
374 * @param[in] msg - Dbus message from match callback.
375 *
376 * @return Response for get sensor reading command.
377 */
378template <typename T>
379std::optional<GetSensorResponse>
380 readingAssertion(uint8_t id, const Info& sensorInfo,
381 sdbusplus::message::message& msg)
382{
383 // TODO
384 return {};
385}
386
387/** @brief Get sensor reading from the dbus message from match
388 *
389 * @tparam T - type of the dbus property related to sensor.
390 * @param[in] id - The sensor id
391 * @param[in] sensorInfo - Dbus info related to sensor.
392 * @param[in] msg - Dbus message from match callback.
393 *
394 * @return Response for get sensor reading command.
395 */
396template <typename T>
397std::optional<GetSensorResponse> readingData(uint8_t id, const Info& sensorInfo,
398 sdbusplus::message::message& msg)
399{
400 // TODO
401 return {};
402}
403
404#endif // FEATURE_SENSORS_CACHE
405
Patrick Venture0b02be92018-08-31 11:55:55 -0700406} // namespace get
Tom Joseph816e92b2017-09-06 19:23:00 +0530407
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500408namespace set
409{
410
411/** @brief Make a DBus message for a Dbus call
412 * @param[in] updateInterface - Interface name
413 * @param[in] sensorPath - Path of the sensor
414 * @param[in] command - command to be executed
415 * @param[in] sensorInterface - DBus interface of sensor
416 * @return a dbus message
417 */
418IpmiUpdateData makeDbusMsg(const std::string& updateInterface,
419 const std::string& sensorPath,
420 const std::string& command,
421 const std::string& sensorInterface);
422
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500423/** @brief Update d-bus based on assertion type sensor data
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500424 * @param[in] cmdData - input sensor data
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500425 * @param[in] sensorInfo - sensor d-bus info
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500426 * @return a IPMI error code
427 */
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500428ipmi_ret_t assertion(const SetSensorReadingReq& cmdData,
429 const Info& sensorInfo);
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500430
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500431/** @brief Update d-bus based on a reading assertion
432 * @tparam T - type of d-bus property mapping this sensor
433 * @param[in] cmdData - input sensor data
434 * @param[in] sensorInfo - sensor d-bus info
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500435 * @return a IPMI error code
436 */
Patrick Venture0b02be92018-08-31 11:55:55 -0700437template <typename T>
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500438ipmi_ret_t readingAssertion(const SetSensorReadingReq& cmdData,
439 const Info& sensorInfo)
440{
Patrick Venture0b02be92018-08-31 11:55:55 -0700441 auto msg =
442 makeDbusMsg("org.freedesktop.DBus.Properties", sensorInfo.sensorPath,
443 "Set", sensorInfo.sensorInterface);
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500444
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500445 const auto& interface = sensorInfo.propertyInterfaces.begin();
446 msg.append(interface->first);
447 for (const auto& property : interface->second)
448 {
449 msg.append(property.first);
Andrew Geissler6467ed22020-05-16 16:03:53 -0500450 std::variant<T> value = static_cast<T>((cmdData.assertOffset8_14 << 8) |
451 cmdData.assertOffset0_7);
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500452 msg.append(value);
453 }
454 return updateToDbus(msg);
455}
456
Emily Shaffercc941e12017-06-14 13:06:26 -0700457/** @brief Update d-bus based on a discrete reading
458 * @param[in] cmdData - input sensor data
459 * @param[in] sensorInfo - sensor d-bus info
460 * @return an IPMI error code
461 */
Patrick Venture0b02be92018-08-31 11:55:55 -0700462template <typename T>
Emily Shaffercc941e12017-06-14 13:06:26 -0700463ipmi_ret_t readingData(const SetSensorReadingReq& cmdData,
464 const Info& sensorInfo)
465{
Patrick Venture0b02be92018-08-31 11:55:55 -0700466 T raw_value =
467 (sensorInfo.coefficientM * cmdData.reading) + sensorInfo.scaledOffset;
Tom Joseph22102152018-03-02 18:46:39 +0530468
Patrick Venture586d35b2018-09-07 19:56:18 -0700469 raw_value *= std::pow(10, sensorInfo.exponentR - sensorInfo.scale);
Tom Joseph22102152018-03-02 18:46:39 +0530470
Patrick Venture0b02be92018-08-31 11:55:55 -0700471 auto msg =
472 makeDbusMsg("org.freedesktop.DBus.Properties", sensorInfo.sensorPath,
473 "Set", sensorInfo.sensorInterface);
Emily Shaffercc941e12017-06-14 13:06:26 -0700474
475 const auto& interface = sensorInfo.propertyInterfaces.begin();
476 msg.append(interface->first);
477
Emily Shaffercc941e12017-06-14 13:06:26 -0700478 for (const auto& property : interface->second)
479 {
480 msg.append(property.first);
Vernon Mauery16b86932019-05-01 08:36:11 -0700481 std::variant<T> value = raw_value;
Emily Shaffercc941e12017-06-14 13:06:26 -0700482 msg.append(value);
483 }
484 return updateToDbus(msg);
485}
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500486
487/** @brief Update d-bus based on eventdata type sensor data
488 * @param[in] cmdData - input sensor data
489 * @param[in] sensorInfo - sensor d-bus info
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500490 * @return a IPMI error code
491 */
Patrick Venture0b02be92018-08-31 11:55:55 -0700492ipmi_ret_t eventdata(const SetSensorReadingReq& cmdData, const Info& sensorInfo,
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500493 uint8_t data);
494
495/** @brief Update d-bus based on eventdata1 type sensor data
496 * @param[in] cmdData - input sensor data
497 * @param[in] sensorInfo - sensor d-bus info
498 * @return a IPMI error code
499 */
500inline ipmi_ret_t eventdata1(const SetSensorReadingReq& cmdData,
501 const Info& sensorInfo)
502{
503 return eventdata(cmdData, sensorInfo, cmdData.eventData1);
504}
505
506/** @brief Update d-bus based on eventdata2 type sensor data
507 * @param[in] cmdData - input sensor data
508 * @param[in] sensorInfo - sensor d-bus info
509 * @return a IPMI error code
510 */
511inline ipmi_ret_t eventdata2(const SetSensorReadingReq& cmdData,
512 const Info& sensorInfo)
513{
514 return eventdata(cmdData, sensorInfo, cmdData.eventData2);
515}
516
517/** @brief Update d-bus based on eventdata3 type sensor data
518 * @param[in] cmdData - input sensor data
519 * @param[in] sensorInfo - sensor d-bus info
520 * @return a IPMI error code
521 */
522inline ipmi_ret_t eventdata3(const SetSensorReadingReq& cmdData,
523 const Info& sensorInfo)
524{
525 return eventdata(cmdData, sensorInfo, cmdData.eventData3);
526}
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500527
Patrick Venture0b02be92018-08-31 11:55:55 -0700528} // namespace set
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500529
530namespace notify
531{
532
533/** @brief Make a DBus message for a Dbus call
534 * @param[in] updateInterface - Interface name
535 * @param[in] sensorPath - Path of the sensor
536 * @param[in] command - command to be executed
537 * @param[in] sensorInterface - DBus interface of sensor
538 * @return a dbus message
539 */
540IpmiUpdateData makeDbusMsg(const std::string& updateInterface,
541 const std::string& sensorPath,
542 const std::string& command,
543 const std::string& sensorInterface);
544
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500545/** @brief Update d-bus based on assertion type sensor data
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500546 * @param[in] interfaceMap - sensor interface
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500547 * @param[in] cmdData - input sensor data
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500548 * @param[in] sensorInfo - sensor d-bus info
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500549 * @return a IPMI error code
550 */
Deepak Kodihalli1bb0d382017-08-12 02:01:27 -0500551ipmi_ret_t assertion(const SetSensorReadingReq& cmdData,
552 const Info& sensorInfo);
Dhruvaraj Subhashchandrane0af7202017-07-12 06:35:20 -0500553
Patrick Venture0b02be92018-08-31 11:55:55 -0700554} // namespace notify
Tom Joseph816e92b2017-09-06 19:23:00 +0530555
556namespace inventory
557{
558
559namespace get
560{
561
562/**
563 * @brief Map the Dbus info to sensor's assertion status in the Get sensor
564 * reading command response.
565 *
566 * @param[in] sensorInfo - Dbus info related to sensor.
567 *
568 * @return Response for get sensor reading command.
569 */
570GetSensorResponse assertion(const Info& sensorInfo);
571
572} // namespace get
573
574} // namespace inventory
Patrick Venture0b02be92018-08-31 11:55:55 -0700575} // namespace sensor
576} // namespace ipmi