Matt Spinler | 23818bb | 2018-05-23 11:00:15 -0500 | [diff] [blame^] | 1 | /** Copyright © 2018 IBM Corporation |
| 2 | * |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | #include "callout.hpp" |
| 16 | |
| 17 | namespace ibm |
| 18 | { |
| 19 | namespace logging |
| 20 | { |
| 21 | |
| 22 | Callout::Callout(sdbusplus::bus::bus& bus, const std::string& objectPath, |
| 23 | size_t id, uint64_t timestamp) : |
| 24 | CalloutObject(bus, objectPath.c_str(), true), |
| 25 | entryID(id), timestamp(timestamp) |
| 26 | { |
| 27 | } |
| 28 | |
| 29 | Callout::Callout(sdbusplus::bus::bus& bus, const std::string& objectPath, |
| 30 | const std::string& inventoryPath, size_t id, |
| 31 | uint64_t timestamp, const DbusPropertyMap& properties) : |
| 32 | CalloutObject(bus, objectPath.c_str(), true), |
| 33 | entryID(id), timestamp(timestamp) |
| 34 | { |
| 35 | path(inventoryPath); |
| 36 | |
| 37 | auto it = properties.find("BuildDate"); |
| 38 | if (it != properties.end()) |
| 39 | { |
| 40 | buildDate(it->second.get<std::string>()); |
| 41 | } |
| 42 | |
| 43 | it = properties.find("Manufacturer"); |
| 44 | if (it != properties.end()) |
| 45 | { |
| 46 | manufacturer(it->second.get<std::string>()); |
| 47 | } |
| 48 | |
| 49 | it = properties.find("Model"); |
| 50 | if (it != properties.end()) |
| 51 | { |
| 52 | model(it->second.get<std::string>()); |
| 53 | } |
| 54 | |
| 55 | it = properties.find("PartNumber"); |
| 56 | if (it != properties.end()) |
| 57 | { |
| 58 | partNumber(it->second.get<std::string>()); |
| 59 | } |
| 60 | |
| 61 | it = properties.find("SerialNumber"); |
| 62 | if (it != properties.end()) |
| 63 | { |
| 64 | serialNumber(it->second.get<std::string>()); |
| 65 | } |
| 66 | |
| 67 | emit_object_added(); |
| 68 | } |
| 69 | } |
| 70 | } |