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