Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <stdint.h> |
| 4 | |
| 5 | #include <map> |
| 6 | #include <string> |
| 7 | |
| 8 | #include <sdbusplus/server.hpp> |
Dhruvaraj Subhashchandran | e0af720 | 2017-07-12 06:35:20 -0500 | [diff] [blame] | 9 | #include "sensorhandler.h" |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 10 | |
| 11 | namespace ipmi |
| 12 | { |
Ratan Gupta | dcb1067 | 2017-07-10 10:33:50 +0530 | [diff] [blame] | 13 | |
| 14 | using DbusObjectPath = std::string; |
| 15 | using DbusService = std::string; |
| 16 | using DbusInterface = std::string; |
| 17 | using DbusObjectInfo = std::pair<DbusObjectPath, DbusService>; |
| 18 | using DbusProperty = std::string; |
Dhruvaraj Subhashchandran | e0af720 | 2017-07-12 06:35:20 -0500 | [diff] [blame] | 19 | using Value = sdbusplus::message::variant<bool, int64_t, uint8_t, |
| 20 | std::string, uint32_t>; |
Ratan Gupta | dcb1067 | 2017-07-10 10:33:50 +0530 | [diff] [blame] | 21 | using PropertyMap = std::map<DbusProperty, Value>; |
| 22 | using ObjectTree = std::map<DbusObjectPath, |
| 23 | std::map<DbusService, std::vector<DbusInterface>>>; |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 24 | namespace sensor |
| 25 | { |
| 26 | |
| 27 | using Offset = uint8_t; |
Ratan Gupta | dcb1067 | 2017-07-10 10:33:50 +0530 | [diff] [blame] | 28 | using Value = ipmi::Value; |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 29 | |
| 30 | struct Values |
| 31 | { |
| 32 | Value assert; |
| 33 | Value deassert; |
| 34 | }; |
| 35 | |
| 36 | using OffsetValueMap = std::map<Offset,Values>; |
| 37 | |
Ratan Gupta | dcb1067 | 2017-07-10 10:33:50 +0530 | [diff] [blame] | 38 | using DbusProperty = ipmi::DbusProperty; |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 39 | using DbusPropertyMap = std::map<DbusProperty,OffsetValueMap>; |
| 40 | |
Ratan Gupta | dcb1067 | 2017-07-10 10:33:50 +0530 | [diff] [blame] | 41 | using DbusInterface = ipmi::DbusInterface; |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 42 | using DbusInterfaceMap = std::map<DbusInterface,DbusPropertyMap>; |
| 43 | |
| 44 | using InstancePath = std::string; |
| 45 | using Type = uint8_t; |
| 46 | using ReadingType = uint8_t; |
Emily Shaffer | 10f4959 | 2017-05-10 12:01:10 -0700 | [diff] [blame] | 47 | using Multiplier = uint16_t; |
| 48 | using OffsetB = uint16_t; |
| 49 | using Exponent = uint8_t; |
| 50 | using ScaledOffset = int64_t; |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 51 | |
| 52 | struct Info |
| 53 | { |
| 54 | Type sensorType; |
| 55 | InstancePath sensorPath; |
| 56 | ReadingType sensorReadingType; |
Emily Shaffer | 10f4959 | 2017-05-10 12:01:10 -0700 | [diff] [blame] | 57 | Multiplier coefficientM; |
| 58 | OffsetB coefficientB; |
| 59 | Exponent exponentB; |
| 60 | ScaledOffset scaledOffset; |
Dhruvaraj Subhashchandran | e0af720 | 2017-07-12 06:35:20 -0500 | [diff] [blame] | 61 | std::function<uint8_t(SetSensorReadingReq&,const Info&)> updateFunc; |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 62 | DbusInterfaceMap sensorInterfaces; |
| 63 | }; |
| 64 | |
| 65 | using Id = uint8_t; |
| 66 | using IdInfoMap = std::map<Id,Info>; |
| 67 | |
Ratan Gupta | dcb1067 | 2017-07-10 10:33:50 +0530 | [diff] [blame] | 68 | using PropertyMap = ipmi::PropertyMap; |
Tom Joseph | be703f7 | 2017-03-09 12:34:35 +0530 | [diff] [blame] | 69 | |
| 70 | using InterfaceMap = std::map<DbusInterface, PropertyMap>; |
| 71 | |
| 72 | using Object = sdbusplus::message::object_path; |
| 73 | using ObjectMap = std::map<Object, InterfaceMap>; |
| 74 | |
Dhruvaraj Subhashchandran | e0af720 | 2017-07-12 06:35:20 -0500 | [diff] [blame] | 75 | using IpmiUpdateData = sdbusplus::message::message; |
| 76 | |
Tom Joseph | dd78a1d | 2017-05-05 11:04:29 +0530 | [diff] [blame] | 77 | struct SelData |
| 78 | { |
| 79 | Id sensorID; |
| 80 | Type sensorType; |
| 81 | ReadingType eventReadingType; |
| 82 | Offset eventOffset; |
| 83 | }; |
| 84 | |
| 85 | using InventoryPath = std::string; |
| 86 | |
| 87 | using InvObjectIDMap = std::map<InventoryPath, SelData>; |
| 88 | |
Ratan Gupta | 0065905 | 2017-02-23 17:29:08 +0530 | [diff] [blame] | 89 | }//namespce sensor |
| 90 | }//namespace ipmi |