198b704e1SJames Feist /* 298b704e1SJames Feist // Copyright (c) 2019 Intel Corporation 398b704e1SJames Feist // 498b704e1SJames Feist // Licensed under the Apache License, Version 2.0 (the "License"); 598b704e1SJames Feist // you may not use this file except in compliance with the License. 698b704e1SJames Feist // You may obtain a copy of the License at 798b704e1SJames Feist // 898b704e1SJames Feist // http://www.apache.org/licenses/LICENSE-2.0 998b704e1SJames Feist // 1098b704e1SJames Feist // Unless required by applicable law or agreed to in writing, software 1198b704e1SJames Feist // distributed under the License is distributed on an "AS IS" BASIS, 1298b704e1SJames Feist // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1398b704e1SJames Feist // See the License for the specific language governing permissions and 1498b704e1SJames Feist // limitations under the License. 1598b704e1SJames Feist */ 1698b704e1SJames Feist 1798b704e1SJames Feist #pragma once 1898b704e1SJames Feist 1998b704e1SJames Feist #include <sdbusplus/bus.hpp> 2098b704e1SJames Feist #include <sdbusplus/bus/match.hpp> 21a83a3eccSPatrick Venture 2298b704e1SJames Feist #include <set> 2398b704e1SJames Feist 24a076487aSPatrick Venture namespace pid_control 25a076487aSPatrick Venture { 2698b704e1SJames Feist /* 2798b704e1SJames Feist * DbusPassiveRedundancy monitors the fan redundancy interface via dbus match 2898b704e1SJames Feist * for changes. When the "Status" property changes to Failed, all sensors in 2998b704e1SJames Feist * the interface's "Collection" property are added to the failed member. This 3098b704e1SJames Feist * set can then be queried by a sensor to see if they are part of a failed 3198b704e1SJames Feist * redundancy collection. When this happens, they get marked as failed. 3298b704e1SJames Feist */ 3398b704e1SJames Feist 3498b704e1SJames Feist class DbusPassiveRedundancy 3598b704e1SJames Feist { 3698b704e1SJames Feist public: 37*b228bc30SPatrick Williams explicit DbusPassiveRedundancy(sdbusplus::bus_t& bus); 3898b704e1SJames Feist const std::set<std::string>& getFailed(void); 3998b704e1SJames Feist 4098b704e1SJames Feist private: 4198b704e1SJames Feist void populateFailures(void); 4298b704e1SJames Feist 43*b228bc30SPatrick Williams sdbusplus::bus::match_t match; 4498b704e1SJames Feist std::set<std::string> failed; 45*b228bc30SPatrick Williams sdbusplus::bus_t& passiveBus; 4698b704e1SJames Feist }; 47a076487aSPatrick Venture 48a076487aSPatrick Venture } // namespace pid_control 49