| 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 | { | 
|  | 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, | 
|  | 25 | uint8_t deviceAddress); | 
|  | 26 | ~IpmbSensor(); | 
|  | 27 |  | 
|  | 28 | void checkThresholds(void) override; | 
|  | 29 | void read(void); | 
|  | 30 | void init(void); | 
|  | 31 | void loadDefaults(void); | 
|  | 32 |  | 
|  | 33 | IpmbType type; | 
|  | 34 | uint8_t commandAddress; | 
|  | 35 | uint8_t netfn; | 
|  | 36 | uint8_t command; | 
|  | 37 | uint8_t deviceAddress; | 
|  | 38 | std::vector<uint8_t> commandData; | 
|  | 39 | std::optional<uint8_t> initCommand; | 
|  | 40 | std::vector<uint8_t> initData; | 
|  | 41 |  | 
|  | 42 | // to date all ipmb sensors are power on only | 
|  | 43 | PowerState readState = PowerState::on; | 
|  | 44 |  | 
|  | 45 | private: | 
|  | 46 | sdbusplus::asio::object_server &objectServer; | 
|  | 47 | std::shared_ptr<sdbusplus::asio::connection> dbusConnection; | 
|  | 48 | boost::asio::deadline_timer waitTimer; | 
|  | 49 | }; |