Lines Matching +full:energy +full:- +full:empty
8 #include <phosphor-logging/commit.hpp>
44 "Failed to create Entity interface for compact numeric sensor {PATH} error - {ERROR}",
48 entityIntf->entityType(entityType);
49 entityIntf->entityInstanceNumber(entityInstanceNum);
50 entityIntf->containerID(containerId);
141 sensorNameSpace = "/xyz/openbmc_project/sensors/energy/";
181 sensorId = pdr->sensor_id;
184 setSensorUnit(pdr->base_unit);
198 if (!tmp.empty())
218 "Failed to create association interface for numeric sensor {PATH} error - {ERROR}",
223 associationDefinitionsIntf->associations(
227 getSensorDataValue(pdr->sensor_data_size, pdr->max_readable);
229 getSensorDataValue(pdr->sensor_data_size, pdr->min_readable);
230 hysteresis = getSensorDataValue(pdr->sensor_data_size, pdr->hysteresis);
242 if (pdr->supported_thresholds.bits.bit0)
246 getRangeFieldValue(pdr->range_field_format, pdr->warning_high);
249 if (pdr->supported_thresholds.bits.bit3)
253 getRangeFieldValue(pdr->range_field_format, pdr->warning_low);
256 if (pdr->supported_thresholds.bits.bit1)
260 getRangeFieldValue(pdr->range_field_format, pdr->critical_high);
263 if (pdr->supported_thresholds.bits.bit4)
267 getRangeFieldValue(pdr->range_field_format, pdr->critical_low);
269 if (pdr->supported_thresholds.bits.bit2)
273 getRangeFieldValue(pdr->range_field_format, pdr->fatal_high);
275 if (pdr->supported_thresholds.bits.bit5)
278 fatalLow = getRangeFieldValue(pdr->range_field_format, pdr->fatal_low);
281 resolution = pdr->resolution;
282 offset = pdr->offset;
283 baseUnitModifier = pdr->unit_modifier;
291 if (std::isfinite(pdr->update_interval))
293 updateTime = pdr->update_interval * 1000000;
305 "Failed to create Value interface for numeric sensor {PATH} error - {ERROR}",
310 valueIntf->maxValue(unitModifier(conversionFormula(maxValue)));
311 valueIntf->minValue(unitModifier(conversionFormula(minValue)));
312 valueIntf->unit(sensorUnit);
323 "Failed to create Metric interface for numeric sensor {PATH} error - {ERROR}",
328 metricIntf->maxValue(unitModifier(conversionFormula(maxValue)));
329 metricIntf->minValue(unitModifier(conversionFormula(minValue)));
330 metricIntf->unit(metricUnit);
335 if (!createInventoryPath(associationPath, sensorName, pdr->entity_type,
336 pdr->entity_instance_num, pdr->container_id))
349 "Failed to create Availability interface for numeric sensor {PATH} error - {ERROR}",
353 availabilityIntf->available(true);
363 "Failed to create Operation status interface for numeric sensor {PATH} error - {ERROR}",
367 operationalStatusIntf->functional(!sensorDisabled);
379 "Failed to create Threshold warning interface for numeric sensor {PATH} error - {ERROR}",
384 thresholdWarningIntf->warningHigh(unitModifier(warningHigh));
385 thresholdWarningIntf->warningLow(unitModifier(warningLow));
398 "Failed to create Threshold critical interface for numeric sensor {PATH} error - {ERROR}",
403 thresholdCriticalIntf->criticalHigh(unitModifier(criticalHigh));
404 thresholdCriticalIntf->criticalLow(unitModifier(criticalLow));
417 "Failed to create HardShutdown threshold interface for numeric sensor {PATH} error - {ERROR}",
422 thresholdHardShutdownIntf->hardShutdownHigh(unitModifier(fatalHigh));
423 thresholdHardShutdownIntf->hardShutdownLow(unitModifier(fatalLow));
438 sensorId = pdr->sensor_id;
441 setSensorUnit(pdr->base_unit);
455 if (!tmp.empty())
475 "Failed to create Association interface for compact numeric sensor {PATH} error - {ERROR}",
479 associationDefinitionsIntf->associations(
494 if (pdr->range_field_support.bits.bit0)
497 warningHigh = pdr->warning_high;
499 if (pdr->range_field_support.bits.bit1)
502 warningLow = pdr->warning_low;
505 if (pdr->range_field_support.bits.bit2)
508 criticalHigh = pdr->critical_high;
511 if (pdr->range_field_support.bits.bit3)
514 criticalLow = pdr->critical_low;
516 if (pdr->range_field_support.bits.bit4)
519 fatalHigh = pdr->fatal_high;
521 if (pdr->range_field_support.bits.bit5)
524 fatalLow = pdr->fatal_low;
529 baseUnitModifier = pdr->unit_modifier;
548 "Failed to create Value interface for compact numeric sensor {PATH} error - {ERROR}",
553 valueIntf->maxValue(unitModifier(conversionFormula(maxValue)));
554 valueIntf->minValue(unitModifier(conversionFormula(minValue)));
555 valueIntf->unit(sensorUnit);
566 "Failed to create Metric interface for compact numeric sensor {PATH} error - {ERROR}",
571 metricIntf->maxValue(unitModifier(conversionFormula(maxValue)));
572 metricIntf->minValue(unitModifier(conversionFormula(minValue)));
573 metricIntf->unit(metricUnit);
578 if (!createInventoryPath(associationPath, sensorName, pdr->entity_type,
579 pdr->entity_instance, pdr->container_id))
592 "Failed to create Availability interface for compact numeric sensor {PATH} error - {ERROR}",
596 availabilityIntf->available(true);
606 "Failed to create Operational status interface for compact numeric sensor {PATH} error - {ERROR}",
610 operationalStatusIntf->functional(!sensorDisabled);
622 "Failed to create Warning threshold interface for compact numeric sensor {PATH} error - {ERROR}",
627 thresholdWarningIntf->warningHigh(unitModifier(warningHigh));
628 thresholdWarningIntf->warningLow(unitModifier(warningLow));
641 "Failed to create Critical threshold interface for compact numeric sensor {PATH} error - {ERROR}",
646 thresholdCriticalIntf->criticalHigh(unitModifier(criticalHigh));
647 thresholdCriticalIntf->criticalLow(unitModifier(criticalLow));
660 "Failed to create HardShutdown threshold interface for numeric sensor {PATH} error - {ERROR}",
665 thresholdHardShutdownIntf->hardShutdownHigh(unitModifier(fatalHigh));
666 thresholdHardShutdownIntf->hardShutdownLow(unitModifier(fatalLow));
700 "Failed to update sensor {NAME} D-Bus interface don't exist.",
704 availabilityIntf->available(available);
705 operationalStatusIntf->functional(functional);
709 curValue = valueIntf->value();
713 curValue = metricIntf->value();
724 valueIntf->value(newValue);
729 metricIntf->value(newValue);
740 valueIntf->value(std::numeric_limits<double>::quiet_NaN());
744 metricIntf->value(std::numeric_limits<double>::quiet_NaN());
756 "Failed to update sensor {NAME} D-Bus interfaces don't exist.",
760 operationalStatusIntf->functional(false);
763 valueIntf->value(std::numeric_limits<double>::quiet_NaN());
767 metricIntf->value(std::numeric_limits<double>::quiet_NaN());
780 if (value < (threshold - hyst))
817 thresholdWarningIntf->warningAlarmHigh(newAlarm);
820 thresholdWarningIntf->warningHighAlarmAsserted(value);
824 thresholdWarningIntf->warningHighAlarmDeasserted(value);
829 thresholdWarningIntf->warningAlarmLow(newAlarm);
832 thresholdWarningIntf->warningLowAlarmAsserted(value);
836 thresholdWarningIntf->warningLowAlarmDeasserted(value);
846 thresholdCriticalIntf->criticalAlarmHigh(newAlarm);
849 thresholdCriticalIntf->criticalHighAlarmAsserted(value);
853 thresholdCriticalIntf->criticalHighAlarmDeasserted(value);
858 thresholdCriticalIntf->criticalAlarmLow(newAlarm);
861 thresholdCriticalIntf->criticalLowAlarmAsserted(value);
865 thresholdCriticalIntf->criticalLowAlarmDeasserted(value);
875 thresholdHardShutdownIntf->hardShutdownAlarmHigh(newAlarm);
878 thresholdHardShutdownIntf->hardShutdownHighAlarmAsserted(value);
882 thresholdHardShutdownIntf->hardShutdownHighAlarmDeasserted(value);
887 thresholdHardShutdownIntf->hardShutdownAlarmLow(newAlarm);
890 thresholdHardShutdownIntf->hardShutdownLowAlarmAsserted(value);
894 thresholdHardShutdownIntf->hardShutdownLowAlarmDeasserted(value);
958 /* empty log entries are returned by commit() if the
960 if (!log->str.empty())
967 lg2::error("Error trying to resolve: {LOG} : {ERROR}", "LOG", log->str,
975 * @tparam[in] errorObj - The error object of the log we want to create.
976 * @param[in] sensorObjPath - The object path of the sensor.
977 * @param[in] value - The current value of the sensor.
978 * @param[in] sensorUnit - The units of the sensor.
979 * @param[in] threshold - The threshold value.
983 * a optional holding an empty string in the object path. This ensures
989 -> std::optional<sdbusplus::message::object_path>
1067 "Failed to update thresholds sensor {NAME} D-Bus interfaces don't exist.",
1073 value = valueIntf->value();
1077 value = metricIntf->value();
1105 "Failed to update thresholds sensor {NAME} D-Bus interfaces don't exist.",