blob: 1775c139181c8de77d765651fe34486d935805e1 [file] [log] [blame]
James Feist6ef20402019-01-07 16:45:08 -08001#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
10enum class IpmbType
11{
12 meSensor,
13 PXE1410CVR,
14 IR38363VR,
15 mpsVR
16};
17
18struct IpmbSensor : public Sensor
19{
James Feistd8705872019-02-08 13:26:09 -080020 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 Feist6ef20402019-01-07 16:45:08 -080025 uint8_t deviceAddress);
26 ~IpmbSensor();
27
28 void checkThresholds(void) override;
29 void read(void);
30 void init(void);
31 void loadDefaults(void);
James Feistf7e2c5d2019-02-13 17:27:51 -080032 void runInitCmd(void);
James Feist6ef20402019-01-07 16:45:08 -080033
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 Feistd8705872019-02-08 13:26:09 -080047 sdbusplus::asio::object_server& objectServer;
James Feist6ef20402019-01-07 16:45:08 -080048 std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
49 boost::asio::deadline_timer waitTimer;
50};