James Feist | 6ef2040 | 2019-01-07 16:45:08 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | #include "sensor.hpp" |
| 3 | |
| 4 | #include <boost/asio/deadline_timer.hpp> |
| 5 | #include <boost/container/flat_map.hpp> |
| 6 | #include <chrono> |
| 7 | #include <limits> |
| 8 | #include <vector> |
| 9 | |
| 10 | enum class IpmbType |
| 11 | { |
| 12 | meSensor, |
| 13 | PXE1410CVR, |
| 14 | IR38363VR, |
| 15 | mpsVR |
| 16 | }; |
| 17 | |
| 18 | struct IpmbSensor : public Sensor |
| 19 | { |
James Feist | d870587 | 2019-02-08 13:26:09 -0800 | [diff] [blame] | 20 | IpmbSensor(std::shared_ptr<sdbusplus::asio::connection>& conn, |
| 21 | boost::asio::io_service& io, const std::string& name, |
| 22 | const std::string& sensorConfiguration, |
| 23 | sdbusplus::asio::object_server& objectServer, |
| 24 | std::vector<thresholds::Threshold>&& thresholds, |
James Feist | 6ef2040 | 2019-01-07 16:45:08 -0800 | [diff] [blame] | 25 | uint8_t deviceAddress); |
| 26 | ~IpmbSensor(); |
| 27 | |
| 28 | void checkThresholds(void) override; |
| 29 | void read(void); |
| 30 | void init(void); |
| 31 | void loadDefaults(void); |
James Feist | f7e2c5d | 2019-02-13 17:27:51 -0800 | [diff] [blame] | 32 | void runInitCmd(void); |
James Feist | 6ef2040 | 2019-01-07 16:45:08 -0800 | [diff] [blame] | 33 | |
| 34 | IpmbType type; |
| 35 | uint8_t commandAddress; |
| 36 | uint8_t netfn; |
| 37 | uint8_t command; |
| 38 | uint8_t deviceAddress; |
| 39 | std::vector<uint8_t> commandData; |
| 40 | std::optional<uint8_t> initCommand; |
| 41 | std::vector<uint8_t> initData; |
| 42 | |
| 43 | // to date all ipmb sensors are power on only |
| 44 | PowerState readState = PowerState::on; |
| 45 | |
| 46 | private: |
James Feist | d870587 | 2019-02-08 13:26:09 -0800 | [diff] [blame] | 47 | sdbusplus::asio::object_server& objectServer; |
James Feist | 6ef2040 | 2019-01-07 16:45:08 -0800 | [diff] [blame] | 48 | std::shared_ptr<sdbusplus::asio::connection> dbusConnection; |
| 49 | boost::asio::deadline_timer waitTimer; |
| 50 | }; |