10c4b1574SMatthew Barth /** 241a3408dSMatthew Barth * Copyright © 2021 IBM Corporation 30c4b1574SMatthew Barth * 40c4b1574SMatthew Barth * Licensed under the Apache License, Version 2.0 (the "License"); 50c4b1574SMatthew Barth * you may not use this file except in compliance with the License. 60c4b1574SMatthew Barth * You may obtain a copy of the License at 70c4b1574SMatthew Barth * 80c4b1574SMatthew Barth * http://www.apache.org/licenses/LICENSE-2.0 90c4b1574SMatthew Barth * 100c4b1574SMatthew Barth * Unless required by applicable law or agreed to in writing, software 110c4b1574SMatthew Barth * distributed under the License is distributed on an "AS IS" BASIS, 120c4b1574SMatthew Barth * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 130c4b1574SMatthew Barth * See the License for the specific language governing permissions and 140c4b1574SMatthew Barth * limitations under the License. 150c4b1574SMatthew Barth */ 160c4b1574SMatthew Barth #pragma once 170c4b1574SMatthew Barth 18*12cb125aSMatthew Barth #include "../zone.hpp" 190c4b1574SMatthew Barth #include "action.hpp" 20*12cb125aSMatthew Barth #include "group.hpp" 210c4b1574SMatthew Barth 220c4b1574SMatthew Barth #include <nlohmann/json.hpp> 230c4b1574SMatthew Barth 240c4b1574SMatthew Barth namespace phosphor::fan::control::json 250c4b1574SMatthew Barth { 260c4b1574SMatthew Barth 270c4b1574SMatthew Barth using json = nlohmann::json; 280c4b1574SMatthew Barth 290c4b1574SMatthew Barth /** 300c4b1574SMatthew Barth * @class DefaultFloor - Action to default the fan floor speed 310c4b1574SMatthew Barth * 320c4b1574SMatthew Barth * Sets the fan floor to the defined default fan floor speed when a 330c4b1574SMatthew Barth * service associated to a given group has terminated. Once all services 340c4b1574SMatthew Barth * are functional and providing the sensors, the fan floor is allowed 350c4b1574SMatthew Barth * to be set normally again. 360c4b1574SMatthew Barth */ 370c4b1574SMatthew Barth class DefaultFloor : public ActionBase, public ActionRegister<DefaultFloor> 380c4b1574SMatthew Barth { 390c4b1574SMatthew Barth public: 400c4b1574SMatthew Barth /* Name of this action */ 410c4b1574SMatthew Barth static constexpr auto name = "default_floor_on_missing_owner"; 420c4b1574SMatthew Barth 430c4b1574SMatthew Barth DefaultFloor() = delete; 440c4b1574SMatthew Barth DefaultFloor(const DefaultFloor&) = delete; 450c4b1574SMatthew Barth DefaultFloor(DefaultFloor&&) = delete; 460c4b1574SMatthew Barth DefaultFloor& operator=(const DefaultFloor&) = delete; 470c4b1574SMatthew Barth DefaultFloor& operator=(DefaultFloor&&) = delete; 480c4b1574SMatthew Barth ~DefaultFloor() = default; 490c4b1574SMatthew Barth 5041a3408dSMatthew Barth /** 5141a3408dSMatthew Barth * @brief Default the fan floor speed 5241a3408dSMatthew Barth * 5341a3408dSMatthew Barth * No JSON configuration parameters required 5441a3408dSMatthew Barth */ 550c4b1574SMatthew Barth explicit DefaultFloor(const json&); 560c4b1574SMatthew Barth 5741a3408dSMatthew Barth /** 5841a3408dSMatthew Barth * @brief Run the action 5941a3408dSMatthew Barth * 6041a3408dSMatthew Barth * Updates the services of the group, then determines if any of the 6141a3408dSMatthew Barth * services hosting the members of the group are not owned on dbus 6241a3408dSMatthew Barth * resulting in the zone's floor being set/held at the default floor. 6341a3408dSMatthew Barth * 6441a3408dSMatthew Barth * @param[in] zone - Zone to run the action on 6541a3408dSMatthew Barth * @param[in] group - Group of dbus objects the action runs against 6641a3408dSMatthew Barth */ 6741a3408dSMatthew Barth void run(Zone& zone, const Group& group) override; 680c4b1574SMatthew Barth }; 690c4b1574SMatthew Barth 700c4b1574SMatthew Barth } // namespace phosphor::fan::control::json 71