blob: e7a9540aa53d91bf39078a68e71c90ef98a2544d [file] [log] [blame]
#pragma once
#include "sensor.hpp"
#include <boost/asio/deadline_timer.hpp>
#include <boost/container/flat_map.hpp>
#include <chrono>
#include <limits>
#include <vector>
enum class IpmbType
{
meSensor,
PXE1410CVR,
IR38363VR,
ADM1278HSC,
mpsVR
};
enum class IpmbSubType
{
temp,
curr,
power,
volt
};
struct IpmbSensor : public Sensor
{
IpmbSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
boost::asio::io_service& io, const std::string& name,
const std::string& sensorConfiguration,
sdbusplus::asio::object_server& objectServer,
std::vector<thresholds::Threshold>&& thresholds,
uint8_t deviceAddress, std::string& sensorTypeName);
~IpmbSensor();
void checkThresholds(void) override;
void read(void);
void init(void);
void loadDefaults(void);
void runInitCmd(void);
IpmbType type;
IpmbSubType subType;
double scaleVal;
double offsetVal;
uint8_t commandAddress;
uint8_t netfn;
uint8_t command;
uint8_t deviceAddress;
std::vector<uint8_t> commandData;
std::optional<uint8_t> initCommand;
std::vector<uint8_t> initData;
// to date all ipmb sensors are power on only
PowerState readState;
private:
sdbusplus::asio::object_server& objectServer;
std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
boost::asio::deadline_timer waitTimer;
};