Lines Matching +full:energy +full:- +full:empty

1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors
3 // SPDX-FileCopyrightText: Copyright 2018 Intel Corporation
26 #include <asm-generic/errno.h>
62 // clang-format off
82 "/xyz/openbmc_project/sensors/energy", in getSensorPaths()
104 // clang-format on
173 if (asyncResp->res.result() == in ~SensorsAsyncResp()
179 asyncResp->res.jsonValue = nlohmann::json::object(); in ~SensorsAsyncResp()
185 if (asyncResp->res.result() == boost::beast::http::status::ok) in ~SensorsAsyncResp()
192 dataComplete(asyncResp->res.result(), map); in ~SensorsAsyncResp()
218 const std::string* name = nameIt->get_ptr<const std::string*>(); in addMetadata()
223 const std::string* id = idIt->get_ptr<const std::string*>(); in addMetadata()
228 metadata->emplace_back(SensorData{*name, *id, dbusPath}); in addMetadata()
285 messages::internalError(sensorsAsyncResp->asyncResp->res); in getObjectsWithConnection()
298 BMCWEB_LOG_DEBUG("sensorNames list count: {}", sensorNames->size()); in getObjectsWithConnection()
309 if (sensorNames->contains(object.first)) in getObjectsWithConnection()
373 if (allSensors->empty()) in reduceSensorList()
375 // Nothing to do, the activeSensors object is also empty in reduceSensorList()
385 activeSensors->emplace(sensor); in reduceSensorList()
450 messages::internalError(asyncResp->res); in getChassis()
458 if (chassisName.empty()) in getChassis()
471 messages::resourceNotFound(asyncResp->res, "Chassis", in getChassis()
475 populateChassisNode(asyncResp->res.jsonValue, chassisSubNode); in getChassis()
477 asyncResp->res.jsonValue["@odata.id"] = boost::urls::format( in getChassis()
492 messages::internalError(asyncResp->res); in getChassis()
499 reduceSensorList(asyncResp->res, chassisSubNode, in getChassis()
503 culledSensorList->size()); in getChassis()
519 * @param inventoryItem D-Bus inventory item associated with the sensor. Will
557 if (objDict.empty()) in populateFanRedundancy()
562 const std::string& owner = objDict.begin()->first; in populateFanRedundancy()
577 sensorsAsyncResp->chassisId) != in populateFanRedundancy()
612 sensorsAsyncResp->asyncResp->res); in populateFanRedundancy()
622 sensorsAsyncResp->asyncResp->res); in populateFanRedundancy()
629 if (name.empty()) in populateFanRedundancy()
633 sensorsAsyncResp->asyncResp->res); in populateFanRedundancy()
640 if (status->ends_with("Full")) in populateFanRedundancy()
644 else if (status->ends_with("Degraded")) in populateFanRedundancy()
654 sensorsAsyncResp->asyncResp->res in populateFanRedundancy()
661 if (itemName.empty()) in populateFanRedundancy()
687 sensorsAsyncResp->asyncResp->res); in populateFanRedundancy()
693 collection->empty() in populateFanRedundancy()
695 : collection->size() - *allowedFailures; in populateFanRedundancy()
697 sensorsAsyncResp->asyncResp->res in populateFanRedundancy()
703 sensorsAsyncResp->chassisId, in populateFanRedundancy()
704 sensorsAsyncResp->chassisSubNode); in populateFanRedundancy()
730 nlohmann::json& response = sensorsAsyncResp->asyncResp->res.jsonValue; in sortJSONResponse()
732 if (sensorsAsyncResp->chassisSubNode == sensors::powerNodeStr) in sortJSONResponse()
744 entry->get_ptr<nlohmann::json::array_t*>(); in sortJSONResponse()
765 std::string* value = odata->get_ptr<std::string*>(); in sortJSONResponse()
770 const std::string* name = nameIt->get_ptr<const std::string*>(); in sortJSONResponse()
778 sensorsAsyncResp->updateUri(*name, *value); in sortJSONResponse()
785 * @param inventoryItems D-Bus inventory items associated with sensors.
786 * @param invItemObjPath D-Bus object path of inventory item.
805 * @param inventoryItems D-Bus inventory items associated with sensors.
806 * @param sensorObjPath D-Bus object path of sensor.
825 * @param inventoryItems D-Bus inventory items associated with sensors.
826 * @param ledObjPath D-Bus object path of led.
852 * @param inventoryItems D-Bus inventory items associated with sensors.
853 * @param invItemObjPath D-Bus object path of inventory item.
854 * @param sensorObjPath D-Bus object path of sensor
867 inventoryItems->emplace_back(invItemObjPath); in addInventoryItem()
868 inventoryItem = &(inventoryItems->back()); in addInventoryItem()
872 inventoryItem->sensors.emplace(sensorObjPath); in addInventoryItem()
876 * @brief Stores D-Bus data in the specified inventory item.
878 * Finds D-Bus data in the specified map of interfaces. Stores the data in the
885 * @param interfacesDict Map containing D-Bus interfaces and their properties
980 * @brief Gets D-Bus data for inventory items associated with sensors.
982 * Uses the specified connections (services) to obtain D-Bus data for inventory
1002 * @param inventoryItems D-Bus inventory items associated with sensors.
1019 if (invConnectionsIndex >= invConnections->size()) in getInventoryItemsData()
1027 auto it = invConnections->begin(); in getInventoryItemsData()
1029 if (it != invConnections->end()) in getInventoryItemsData()
1046 messages::internalError(sensorsAsyncResp->asyncResp->res); in getInventoryItemsData()
1081 * @brief Gets connections that provide D-Bus data for inventory items.
1083 * Gets the D-Bus connections (services) that provide data for the inventory
1095 * @param inventoryItems D-Bus inventory items associated with sensors.
1124 messages::internalError(sensorsAsyncResp->asyncResp->res); in getInventoryItemsConnections()
1150 invConnections->insert(invConnection); in getInventoryItemsConnections()
1202 messages::internalError(sensorsAsyncResp->asyncResp->res); in getInventoryItemAssociations()
1241 !endpoints->empty()) in getInventoryItemAssociations()
1245 endpoints->front(); in getInventoryItemAssociations()
1288 !endpoints->empty()) in getInventoryItemAssociations()
1293 endpoints->front(); in getInventoryItemAssociations()
1314 * @brief Gets D-Bus data for inventory item leds associated with sensors.
1316 * Uses the specified connections (services) to obtain D-Bus data for inventory
1336 * @param inventoryItems D-Bus inventory items associated with sensors.
1352 if (ledConnectionsIndex >= ledConnections->size()) in getInventoryLedData()
1360 auto it = ledConnections->begin(); in getInventoryLedData()
1362 if (it != ledConnections->end()) in getInventoryLedData()
1377 messages::internalError(sensorsAsyncResp->asyncResp->res); in getInventoryLedData()
1390 inventoryItem->ledState = sensor_utils::LedState::ON; in getInventoryLedData()
1394 inventoryItem->ledState = sensor_utils::LedState::BLINK; in getInventoryLedData()
1398 inventoryItem->ledState = sensor_utils::LedState::OFF; in getInventoryLedData()
1402 inventoryItem->ledState = in getInventoryLedData()
1427 * Gets the D-Bus connections (services) that provide LED data for the LEDs
1443 * @param inventoryItems D-Bus inventory items associated with sensors.
1469 messages::internalError(sensorsAsyncResp->asyncResp->res); in getInventoryLeds()
1493 object.second.begin()->first; in getInventoryLeds()
1495 BMCWEB_LOG_DEBUG("Added mapping {} -> {}", ledPath, in getInventoryLeds()
1508 * @brief Gets D-Bus data for Power Supply Attributes such as EfficiencyPercent
1511 * obtain D-Bus data for Power Supply Attributes. Stores the resulting data in
1526 * @param inventoryItems D-Bus inventory items associated with sensors.
1540 if (psAttributesConnections.empty()) in getPowerSupplyAttributesData()
1563 messages::internalError(sensorsAsyncResp->asyncResp->res); in getPowerSupplyAttributesData()
1595 * Gets the D-Bus connection (service) that provides Power Supply Attributes
1601 * response. DeratingFactor on D-Bus is mapped to EfficiencyPercent on Redfish.
1612 * @param inventoryItems D-Bus inventory items associated with sensors.
1624 if (sensorsAsyncResp->chassisSubNode != sensors::powerNodeStr) in getPowerSupplyAttributes()
1645 messages::internalError(sensorsAsyncResp->asyncResp->res); in getPowerSupplyAttributes()
1650 if (subtree.empty()) in getPowerSupplyAttributes()
1662 if (subtree[0].first.empty() || subtree[0].second.empty()) in getPowerSupplyAttributes()
1670 const std::string& connection = subtree[0].second.begin()->first; in getPowerSupplyAttributes()
1672 if (connection.empty()) in getPowerSupplyAttributes()
1680 BMCWEB_LOG_DEBUG("Added mapping {} -> {}", psAttributesPath, in getPowerSupplyAttributes()
1695 * Then gets D-Bus data for the inventory items, such as presence and VPD.
1808 const std::string* name = nameIt->get_ptr<std::string*>(); in getPowerSupply()
1869 * The InventoryItem vector contains D-Bus inventory items associated with the
1899 messages::internalError(sensorsAsyncResp->asyncResp->res); in getSensorData()
1903 sensorsAsyncResp->chassisSubNode); in getSensorData()
1924 // These indexes aren't intuitive, as split puts an empty in getSensorData()
1930 if (!sensorNames->contains(objPath)) in getSensorData()
1941 sensorsAsyncResp->chassisSubNode; in getSensorData()
1946 !sensorsAsyncResp->efficientExpand) in getSensorData()
1952 sensorsAsyncResp->asyncResp->res in getSensorData()
1955 sensorsAsyncResp->chassisId, in getSensorData()
1956 sensorsAsyncResp->chassisSubNode, sensorId); in getSensorData()
1958 &(sensorsAsyncResp->asyncResp->res.jsonValue); in getSensorData()
1963 if (sensorsAsyncResp->efficientExpand) in getSensorData()
1988 (inventoryItem->isPowerSupply)) in getSensorData()
2007 sensorsAsyncResp->asyncResp->res in getSensorData()
2011 if (tempArray.empty()) in getSensorData()
2019 sensorsAsyncResp->chassisId, in getSensorData()
2020 sensorsAsyncResp->chassisSubNode); in getSensorData()
2035 sensorsAsyncResp->chassisId)); in getSensorData()
2047 sensorsAsyncResp->chassisId, in getSensorData()
2048 sensorsAsyncResp->chassisSubNode, sensorId); in getSensorData()
2057 sensorsAsyncResp->chassisId, in getSensorData()
2058 sensorsAsyncResp->chassisSubNode); in getSensorData()
2077 sensorsAsyncResp->addMetadata(*sensorJson, path); in getSensorData()
2085 sensorsAsyncResp->efficientExpand) in getSensorData()
2087 sensorsAsyncResp->asyncResp->res in getSensorData()
2089 sensorsAsyncResp->asyncResp->res in getSensorData()
2151 if (sensorsAsyncResp->chassisSubNode != sensors::sensorsNodeStr) in getChassisData()
2153 sensorsAsyncResp->asyncResp->res.jsonValue["Redundancy"] = in getChassisData()
2157 getChassis(sensorsAsyncResp->asyncResp, sensorsAsyncResp->chassisId, in getChassisData()
2158 sensorsAsyncResp->chassisSubNode, sensorsAsyncResp->types, in getChassisData()
2180 if (thisSensorName.empty()) in findSensorNameUsingSensorPath()
2206 sensorAsyncResp->chassisSubNode); in setSensorsOverride()
2229 item, sensorAsyncResp->asyncResp->res, // in setSensorsOverride()
2259 messages::resourceNotFound(sensorAsyncResp->asyncResp->res, in setSensorsOverride()
2278 sensorAsyncResp->asyncResp->res, in setSensorsOverride()
2279 sensorAsyncResp->chassisSubNode == sensors::thermalNodeStr in setSensorsOverride()
2289 if (sensorName.empty()) in setSensorsOverride()
2291 messages::internalError(sensorAsyncResp->asyncResp->res); in setSensorsOverride()
2302 messages::internalError(sensorAsyncResp->asyncResp->res); in setSensorsOverride()
2305 setDbusProperty(sensorAsyncResp->asyncResp, in setSensorsOverride()
2308 iterator->second.first); in setSensorsOverride()
2316 getChassis(sensorAsyncResp->asyncResp, sensorAsyncResp->chassisId, in setSensorsOverride()
2317 sensorAsyncResp->chassisSubNode, sensorAsyncResp->types, in setSensorsOverride()
2322 * @brief Retrieves mapping of Redfish URIs to sensor value property to D-Bus
2326 * node. It then builds metadata about Redfish<->D-Bus correlations and provides
2358 asyncResp, chassis, pathIt->second, node, std::move(callback)); in retrieveUriToDbusMap()
2372 nlohmann::json& entriesArray = asyncResp->res.jsonValue["Members"]; in getChassisCallback()
2379 if (sensorName.empty()) in getChassisCallback()
2382 messages::internalError(asyncResp->res); in getChassisCallback()
2395 asyncResp->res.jsonValue["Members@odata.count"] = entriesArray.size(); in getChassisCallback()
2442 messages::internalError(asyncResp->res); in getSensorFromDbus()
2457 messages::internalError(asyncResp->res); in getSensorFromDbus()
2466 valuesDict, asyncResp->res.jsonValue, nullptr); in getSensorFromDbus()
2481 if (nameType.first.empty() || nameType.second.empty()) in handleSensorGet()
2483 messages::resourceNotFound(asyncResp->res, sensorId, "Sensor"); in handleSensorGet()
2487 asyncResp->res.jsonValue["@odata.id"] = boost::urls::format( in handleSensorGet()
2507 messages::resourceNotFound(asyncResp->res, sensorId, "Sensor"); in handleSensorGet()
2512 messages::internalError(asyncResp->res); in handleSensorGet()