140e9b92eSEd Tanous // SPDX-License-Identifier: Apache-2.0 240e9b92eSEd Tanous // SPDX-FileCopyrightText: Copyright OpenBMC Authors 30ec8b83dSEd Tanous #pragma once 40ec8b83dSEd Tanous #include <nlohmann/json.hpp> 50ec8b83dSEd Tanous 60ec8b83dSEd Tanous namespace sensor 70ec8b83dSEd Tanous { 80ec8b83dSEd Tanous // clang-format off 90ec8b83dSEd Tanous 100ec8b83dSEd Tanous enum class VoltageType{ 110ec8b83dSEd Tanous Invalid, 120ec8b83dSEd Tanous AC, 130ec8b83dSEd Tanous DC, 140ec8b83dSEd Tanous }; 150ec8b83dSEd Tanous 160ec8b83dSEd Tanous enum class ElectricalContext{ 170ec8b83dSEd Tanous Invalid, 180ec8b83dSEd Tanous Line1, 190ec8b83dSEd Tanous Line2, 200ec8b83dSEd Tanous Line3, 210ec8b83dSEd Tanous Neutral, 220ec8b83dSEd Tanous LineToLine, 230ec8b83dSEd Tanous Line1ToLine2, 240ec8b83dSEd Tanous Line2ToLine3, 250ec8b83dSEd Tanous Line3ToLine1, 260ec8b83dSEd Tanous LineToNeutral, 270ec8b83dSEd Tanous Line1ToNeutral, 280ec8b83dSEd Tanous Line2ToNeutral, 290ec8b83dSEd Tanous Line3ToNeutral, 300ec8b83dSEd Tanous Line1ToNeutralAndL1L2, 310ec8b83dSEd Tanous Line2ToNeutralAndL1L2, 320ec8b83dSEd Tanous Line2ToNeutralAndL2L3, 330ec8b83dSEd Tanous Line3ToNeutralAndL3L1, 340ec8b83dSEd Tanous Total, 350ec8b83dSEd Tanous }; 360ec8b83dSEd Tanous 370ec8b83dSEd Tanous enum class ThresholdActivation{ 380ec8b83dSEd Tanous Invalid, 390ec8b83dSEd Tanous Increasing, 400ec8b83dSEd Tanous Decreasing, 410ec8b83dSEd Tanous Either, 42f263e09cSEd Tanous Disabled, 430ec8b83dSEd Tanous }; 440ec8b83dSEd Tanous 450ec8b83dSEd Tanous enum class ReadingType{ 460ec8b83dSEd Tanous Invalid, 470ec8b83dSEd Tanous Temperature, 480ec8b83dSEd Tanous Humidity, 490ec8b83dSEd Tanous Power, 500ec8b83dSEd Tanous EnergykWh, 510ec8b83dSEd Tanous EnergyJoules, 520ec8b83dSEd Tanous EnergyWh, 530ec8b83dSEd Tanous ChargeAh, 540ec8b83dSEd Tanous Voltage, 550ec8b83dSEd Tanous Current, 560ec8b83dSEd Tanous Frequency, 570ec8b83dSEd Tanous Pressure, 580ec8b83dSEd Tanous PressurekPa, 59f263e09cSEd Tanous PressurePa, 600ec8b83dSEd Tanous LiquidLevel, 610ec8b83dSEd Tanous Rotational, 620ec8b83dSEd Tanous AirFlow, 63f263e09cSEd Tanous AirFlowCMM, 640ec8b83dSEd Tanous LiquidFlow, 65f263e09cSEd Tanous LiquidFlowLPM, 660ec8b83dSEd Tanous Barometric, 670ec8b83dSEd Tanous Altitude, 680ec8b83dSEd Tanous Percent, 690ec8b83dSEd Tanous AbsoluteHumidity, 70f263e09cSEd Tanous Heat, 71*c6d7a45dSGunnar Mills LinearPosition, 72*c6d7a45dSGunnar Mills LinearVelocity, 73*c6d7a45dSGunnar Mills LinearAcceleration, 74*c6d7a45dSGunnar Mills RotationalPosition, 75*c6d7a45dSGunnar Mills RotationalVelocity, 76*c6d7a45dSGunnar Mills RotationalAcceleration, 77*c6d7a45dSGunnar Mills Valve, 780ec8b83dSEd Tanous }; 790ec8b83dSEd Tanous 800ec8b83dSEd Tanous enum class ImplementationType{ 810ec8b83dSEd Tanous Invalid, 820ec8b83dSEd Tanous PhysicalSensor, 830ec8b83dSEd Tanous Synthesized, 840ec8b83dSEd Tanous Reported, 850ec8b83dSEd Tanous }; 860ec8b83dSEd Tanous 87f263e09cSEd Tanous enum class ReadingBasisType{ 88f263e09cSEd Tanous Invalid, 89f263e09cSEd Tanous Zero, 90f263e09cSEd Tanous Delta, 91f263e09cSEd Tanous Headroom, 92f263e09cSEd Tanous }; 93f263e09cSEd Tanous 940ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(VoltageType, { 950ec8b83dSEd Tanous {VoltageType::Invalid, "Invalid"}, 960ec8b83dSEd Tanous {VoltageType::AC, "AC"}, 970ec8b83dSEd Tanous {VoltageType::DC, "DC"}, 980ec8b83dSEd Tanous }); 990ec8b83dSEd Tanous 1000ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(ElectricalContext, { 1010ec8b83dSEd Tanous {ElectricalContext::Invalid, "Invalid"}, 1020ec8b83dSEd Tanous {ElectricalContext::Line1, "Line1"}, 1030ec8b83dSEd Tanous {ElectricalContext::Line2, "Line2"}, 1040ec8b83dSEd Tanous {ElectricalContext::Line3, "Line3"}, 1050ec8b83dSEd Tanous {ElectricalContext::Neutral, "Neutral"}, 1060ec8b83dSEd Tanous {ElectricalContext::LineToLine, "LineToLine"}, 1070ec8b83dSEd Tanous {ElectricalContext::Line1ToLine2, "Line1ToLine2"}, 1080ec8b83dSEd Tanous {ElectricalContext::Line2ToLine3, "Line2ToLine3"}, 1090ec8b83dSEd Tanous {ElectricalContext::Line3ToLine1, "Line3ToLine1"}, 1100ec8b83dSEd Tanous {ElectricalContext::LineToNeutral, "LineToNeutral"}, 1110ec8b83dSEd Tanous {ElectricalContext::Line1ToNeutral, "Line1ToNeutral"}, 1120ec8b83dSEd Tanous {ElectricalContext::Line2ToNeutral, "Line2ToNeutral"}, 1130ec8b83dSEd Tanous {ElectricalContext::Line3ToNeutral, "Line3ToNeutral"}, 1140ec8b83dSEd Tanous {ElectricalContext::Line1ToNeutralAndL1L2, "Line1ToNeutralAndL1L2"}, 1150ec8b83dSEd Tanous {ElectricalContext::Line2ToNeutralAndL1L2, "Line2ToNeutralAndL1L2"}, 1160ec8b83dSEd Tanous {ElectricalContext::Line2ToNeutralAndL2L3, "Line2ToNeutralAndL2L3"}, 1170ec8b83dSEd Tanous {ElectricalContext::Line3ToNeutralAndL3L1, "Line3ToNeutralAndL3L1"}, 1180ec8b83dSEd Tanous {ElectricalContext::Total, "Total"}, 1190ec8b83dSEd Tanous }); 1200ec8b83dSEd Tanous 1210ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(ThresholdActivation, { 1220ec8b83dSEd Tanous {ThresholdActivation::Invalid, "Invalid"}, 1230ec8b83dSEd Tanous {ThresholdActivation::Increasing, "Increasing"}, 1240ec8b83dSEd Tanous {ThresholdActivation::Decreasing, "Decreasing"}, 1250ec8b83dSEd Tanous {ThresholdActivation::Either, "Either"}, 126f263e09cSEd Tanous {ThresholdActivation::Disabled, "Disabled"}, 1270ec8b83dSEd Tanous }); 1280ec8b83dSEd Tanous 1290ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(ReadingType, { 1300ec8b83dSEd Tanous {ReadingType::Invalid, "Invalid"}, 1310ec8b83dSEd Tanous {ReadingType::Temperature, "Temperature"}, 1320ec8b83dSEd Tanous {ReadingType::Humidity, "Humidity"}, 1330ec8b83dSEd Tanous {ReadingType::Power, "Power"}, 1340ec8b83dSEd Tanous {ReadingType::EnergykWh, "EnergykWh"}, 1350ec8b83dSEd Tanous {ReadingType::EnergyJoules, "EnergyJoules"}, 1360ec8b83dSEd Tanous {ReadingType::EnergyWh, "EnergyWh"}, 1370ec8b83dSEd Tanous {ReadingType::ChargeAh, "ChargeAh"}, 1380ec8b83dSEd Tanous {ReadingType::Voltage, "Voltage"}, 1390ec8b83dSEd Tanous {ReadingType::Current, "Current"}, 1400ec8b83dSEd Tanous {ReadingType::Frequency, "Frequency"}, 1410ec8b83dSEd Tanous {ReadingType::Pressure, "Pressure"}, 1420ec8b83dSEd Tanous {ReadingType::PressurekPa, "PressurekPa"}, 143f263e09cSEd Tanous {ReadingType::PressurePa, "PressurePa"}, 1440ec8b83dSEd Tanous {ReadingType::LiquidLevel, "LiquidLevel"}, 1450ec8b83dSEd Tanous {ReadingType::Rotational, "Rotational"}, 1460ec8b83dSEd Tanous {ReadingType::AirFlow, "AirFlow"}, 147f263e09cSEd Tanous {ReadingType::AirFlowCMM, "AirFlowCMM"}, 1480ec8b83dSEd Tanous {ReadingType::LiquidFlow, "LiquidFlow"}, 149f263e09cSEd Tanous {ReadingType::LiquidFlowLPM, "LiquidFlowLPM"}, 1500ec8b83dSEd Tanous {ReadingType::Barometric, "Barometric"}, 1510ec8b83dSEd Tanous {ReadingType::Altitude, "Altitude"}, 1520ec8b83dSEd Tanous {ReadingType::Percent, "Percent"}, 1530ec8b83dSEd Tanous {ReadingType::AbsoluteHumidity, "AbsoluteHumidity"}, 154f263e09cSEd Tanous {ReadingType::Heat, "Heat"}, 155*c6d7a45dSGunnar Mills {ReadingType::LinearPosition, "LinearPosition"}, 156*c6d7a45dSGunnar Mills {ReadingType::LinearVelocity, "LinearVelocity"}, 157*c6d7a45dSGunnar Mills {ReadingType::LinearAcceleration, "LinearAcceleration"}, 158*c6d7a45dSGunnar Mills {ReadingType::RotationalPosition, "RotationalPosition"}, 159*c6d7a45dSGunnar Mills {ReadingType::RotationalVelocity, "RotationalVelocity"}, 160*c6d7a45dSGunnar Mills {ReadingType::RotationalAcceleration, "RotationalAcceleration"}, 161*c6d7a45dSGunnar Mills {ReadingType::Valve, "Valve"}, 1620ec8b83dSEd Tanous }); 1630ec8b83dSEd Tanous 1640ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(ImplementationType, { 1650ec8b83dSEd Tanous {ImplementationType::Invalid, "Invalid"}, 1660ec8b83dSEd Tanous {ImplementationType::PhysicalSensor, "PhysicalSensor"}, 1670ec8b83dSEd Tanous {ImplementationType::Synthesized, "Synthesized"}, 1680ec8b83dSEd Tanous {ImplementationType::Reported, "Reported"}, 1690ec8b83dSEd Tanous }); 1700ec8b83dSEd Tanous 171f263e09cSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(ReadingBasisType, { 172f263e09cSEd Tanous {ReadingBasisType::Invalid, "Invalid"}, 173f263e09cSEd Tanous {ReadingBasisType::Zero, "Zero"}, 174f263e09cSEd Tanous {ReadingBasisType::Delta, "Delta"}, 175f263e09cSEd Tanous {ReadingBasisType::Headroom, "Headroom"}, 176f263e09cSEd Tanous }); 177f263e09cSEd Tanous 1780ec8b83dSEd Tanous } 1790ec8b83dSEd Tanous // clang-format on 180