1 // SPDX-License-Identifier: Apache-2.0 2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors 3 #pragma once 4 #include <nlohmann/json.hpp> 5 6 namespace sensor 7 { 8 // clang-format off 9 10 enum class VoltageType{ 11 Invalid, 12 AC, 13 DC, 14 }; 15 16 enum class ElectricalContext{ 17 Invalid, 18 Line1, 19 Line2, 20 Line3, 21 Neutral, 22 LineToLine, 23 Line1ToLine2, 24 Line2ToLine3, 25 Line3ToLine1, 26 LineToNeutral, 27 Line1ToNeutral, 28 Line2ToNeutral, 29 Line3ToNeutral, 30 Line1ToNeutralAndL1L2, 31 Line2ToNeutralAndL1L2, 32 Line2ToNeutralAndL2L3, 33 Line3ToNeutralAndL3L1, 34 Total, 35 }; 36 37 enum class ThresholdActivation{ 38 Invalid, 39 Increasing, 40 Decreasing, 41 Either, 42 Disabled, 43 }; 44 45 enum class ReadingType{ 46 Invalid, 47 Temperature, 48 Humidity, 49 Power, 50 EnergykWh, 51 EnergyJoules, 52 EnergyWh, 53 ChargeAh, 54 Voltage, 55 Current, 56 Frequency, 57 Pressure, 58 PressurekPa, 59 PressurePa, 60 LiquidLevel, 61 Rotational, 62 AirFlow, 63 AirFlowCMM, 64 LiquidFlow, 65 LiquidFlowLPM, 66 Barometric, 67 Altitude, 68 Percent, 69 AbsoluteHumidity, 70 Heat, 71 LinearPosition, 72 LinearVelocity, 73 LinearAcceleration, 74 RotationalPosition, 75 RotationalVelocity, 76 RotationalAcceleration, 77 Valve, 78 }; 79 80 enum class ImplementationType{ 81 Invalid, 82 PhysicalSensor, 83 Synthesized, 84 Reported, 85 }; 86 87 enum class ReadingBasisType{ 88 Invalid, 89 Zero, 90 Delta, 91 Headroom, 92 }; 93 94 NLOHMANN_JSON_SERIALIZE_ENUM(VoltageType, { 95 {VoltageType::Invalid, "Invalid"}, 96 {VoltageType::AC, "AC"}, 97 {VoltageType::DC, "DC"}, 98 }); 99 100 NLOHMANN_JSON_SERIALIZE_ENUM(ElectricalContext, { 101 {ElectricalContext::Invalid, "Invalid"}, 102 {ElectricalContext::Line1, "Line1"}, 103 {ElectricalContext::Line2, "Line2"}, 104 {ElectricalContext::Line3, "Line3"}, 105 {ElectricalContext::Neutral, "Neutral"}, 106 {ElectricalContext::LineToLine, "LineToLine"}, 107 {ElectricalContext::Line1ToLine2, "Line1ToLine2"}, 108 {ElectricalContext::Line2ToLine3, "Line2ToLine3"}, 109 {ElectricalContext::Line3ToLine1, "Line3ToLine1"}, 110 {ElectricalContext::LineToNeutral, "LineToNeutral"}, 111 {ElectricalContext::Line1ToNeutral, "Line1ToNeutral"}, 112 {ElectricalContext::Line2ToNeutral, "Line2ToNeutral"}, 113 {ElectricalContext::Line3ToNeutral, "Line3ToNeutral"}, 114 {ElectricalContext::Line1ToNeutralAndL1L2, "Line1ToNeutralAndL1L2"}, 115 {ElectricalContext::Line2ToNeutralAndL1L2, "Line2ToNeutralAndL1L2"}, 116 {ElectricalContext::Line2ToNeutralAndL2L3, "Line2ToNeutralAndL2L3"}, 117 {ElectricalContext::Line3ToNeutralAndL3L1, "Line3ToNeutralAndL3L1"}, 118 {ElectricalContext::Total, "Total"}, 119 }); 120 121 NLOHMANN_JSON_SERIALIZE_ENUM(ThresholdActivation, { 122 {ThresholdActivation::Invalid, "Invalid"}, 123 {ThresholdActivation::Increasing, "Increasing"}, 124 {ThresholdActivation::Decreasing, "Decreasing"}, 125 {ThresholdActivation::Either, "Either"}, 126 {ThresholdActivation::Disabled, "Disabled"}, 127 }); 128 129 NLOHMANN_JSON_SERIALIZE_ENUM(ReadingType, { 130 {ReadingType::Invalid, "Invalid"}, 131 {ReadingType::Temperature, "Temperature"}, 132 {ReadingType::Humidity, "Humidity"}, 133 {ReadingType::Power, "Power"}, 134 {ReadingType::EnergykWh, "EnergykWh"}, 135 {ReadingType::EnergyJoules, "EnergyJoules"}, 136 {ReadingType::EnergyWh, "EnergyWh"}, 137 {ReadingType::ChargeAh, "ChargeAh"}, 138 {ReadingType::Voltage, "Voltage"}, 139 {ReadingType::Current, "Current"}, 140 {ReadingType::Frequency, "Frequency"}, 141 {ReadingType::Pressure, "Pressure"}, 142 {ReadingType::PressurekPa, "PressurekPa"}, 143 {ReadingType::PressurePa, "PressurePa"}, 144 {ReadingType::LiquidLevel, "LiquidLevel"}, 145 {ReadingType::Rotational, "Rotational"}, 146 {ReadingType::AirFlow, "AirFlow"}, 147 {ReadingType::AirFlowCMM, "AirFlowCMM"}, 148 {ReadingType::LiquidFlow, "LiquidFlow"}, 149 {ReadingType::LiquidFlowLPM, "LiquidFlowLPM"}, 150 {ReadingType::Barometric, "Barometric"}, 151 {ReadingType::Altitude, "Altitude"}, 152 {ReadingType::Percent, "Percent"}, 153 {ReadingType::AbsoluteHumidity, "AbsoluteHumidity"}, 154 {ReadingType::Heat, "Heat"}, 155 {ReadingType::LinearPosition, "LinearPosition"}, 156 {ReadingType::LinearVelocity, "LinearVelocity"}, 157 {ReadingType::LinearAcceleration, "LinearAcceleration"}, 158 {ReadingType::RotationalPosition, "RotationalPosition"}, 159 {ReadingType::RotationalVelocity, "RotationalVelocity"}, 160 {ReadingType::RotationalAcceleration, "RotationalAcceleration"}, 161 {ReadingType::Valve, "Valve"}, 162 }); 163 164 NLOHMANN_JSON_SERIALIZE_ENUM(ImplementationType, { 165 {ImplementationType::Invalid, "Invalid"}, 166 {ImplementationType::PhysicalSensor, "PhysicalSensor"}, 167 {ImplementationType::Synthesized, "Synthesized"}, 168 {ImplementationType::Reported, "Reported"}, 169 }); 170 171 NLOHMANN_JSON_SERIALIZE_ENUM(ReadingBasisType, { 172 {ReadingBasisType::Invalid, "Invalid"}, 173 {ReadingBasisType::Zero, "Zero"}, 174 {ReadingBasisType::Delta, "Delta"}, 175 {ReadingBasisType::Headroom, "Headroom"}, 176 }); 177 178 } 179 // clang-format on 180