| Matt Spinler | 403d1f5 | 2021-02-01 15:35:25 -0600 | [diff] [blame^] | 1 | /** | 
 | 2 |  * Copyright © 2021 IBM Corporation | 
 | 3 |  * | 
 | 4 |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
 | 5 |  * you may not use this file except in compliance with the License. | 
 | 6 |  * You may obtain a copy of the License at | 
 | 7 |  * | 
 | 8 |  *     http://www.apache.org/licenses/LICENSE-2.0 | 
 | 9 |  * | 
 | 10 |  * Unless required by applicable law or agreed to in writing, software | 
 | 11 |  * distributed under the License is distributed on an "AS IS" BASIS, | 
 | 12 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 | 13 |  * See the License for the specific language governing permissions and | 
 | 14 |  * limitations under the License. | 
 | 15 |  */ | 
 | 16 | #include "threshold_alarm_logger.hpp" | 
 | 17 |  | 
 | 18 | namespace sensor::monitor | 
 | 19 | { | 
 | 20 |  | 
 | 21 | const std::string warningInterface = | 
 | 22 |     "xyz.openbmc_project.Sensor.Threshold.Warning"; | 
 | 23 | const std::string criticalInterface = | 
 | 24 |     "xyz.openbmc_project.Sensor.Threshold.Critical"; | 
 | 25 | const std::string perfLossInterface = | 
 | 26 |     "xyz.openbmc_project.Sensor.Threshold.PerformanceLoss"; | 
 | 27 |  | 
 | 28 | ThresholdAlarmLogger::ThresholdAlarmLogger(sdbusplus::bus::bus& bus, | 
 | 29 |                                            sdeventplus::Event& event) : | 
 | 30 |     bus(bus), | 
 | 31 |     event(event), | 
 | 32 |     warningMatch(bus, | 
 | 33 |                  "type='signal',member='PropertiesChanged'," | 
 | 34 |                  "path_namespace='/xyz/openbmc_project/sensors'," | 
 | 35 |                  "arg0='" + | 
 | 36 |                      warningInterface + "'", | 
 | 37 |                  std::bind(&ThresholdAlarmLogger::propertiesChanged, this, | 
 | 38 |                            std::placeholders::_1)), | 
 | 39 |     criticalMatch(bus, | 
 | 40 |                   "type='signal',member='PropertiesChanged'," | 
 | 41 |                   "path_namespace='/xyz/openbmc_project/sensors'," | 
 | 42 |                   "arg0='" + | 
 | 43 |                       criticalInterface + "'", | 
 | 44 |                   std::bind(&ThresholdAlarmLogger::propertiesChanged, this, | 
 | 45 |                             std::placeholders::_1)), | 
 | 46 |     perfLossMatch(bus, | 
 | 47 |                   "type='signal',member='PropertiesChanged'," | 
 | 48 |                   "path_namespace='/xyz/openbmc_project/sensors'," | 
 | 49 |                   "arg0='" + | 
 | 50 |                       perfLossInterface + "'", | 
 | 51 |                   std::bind(&ThresholdAlarmLogger::propertiesChanged, this, | 
 | 52 |                             std::placeholders::_1)) | 
 | 53 | {} | 
 | 54 |  | 
 | 55 | void ThresholdAlarmLogger::propertiesChanged(sdbusplus::message::message& msg) | 
 | 56 | { | 
 | 57 |     // TODO | 
 | 58 | } | 
 | 59 |  | 
 | 60 | } // namespace sensor::monitor |