Deepak Kodihalli | 7679449 | 2017-02-16 23:48:18 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
SunnySrivastava1984 | f6d541e | 2020-02-04 12:50:40 -0600 | [diff] [blame] | 3 | #include "const.hpp" |
Deepak Kodihalli | 7679449 | 2017-02-16 23:48:18 -0600 | [diff] [blame] | 4 | #include "types.hpp" |
| 5 | |
SunnySrivastava1984 | d076da8 | 2020-03-05 05:33:35 -0600 | [diff] [blame] | 6 | #include <iostream> |
| 7 | |
| 8 | using namespace std; |
Deepak Kodihalli | 7679449 | 2017-02-16 23:48:18 -0600 | [diff] [blame] | 9 | namespace openpower |
| 10 | { |
| 11 | namespace vpd |
| 12 | { |
Santosh Puranik | bd011b2 | 2020-01-23 04:05:25 -0600 | [diff] [blame] | 13 | /** @brief Return the hex representation of the incoming byte |
| 14 | * |
| 15 | * @param [in] c - The input byte |
| 16 | * @returns The hex representation of the byte as a character. |
| 17 | */ |
| 18 | constexpr auto toHex(size_t c) |
| 19 | { |
| 20 | constexpr auto map = "0123456789abcdef"; |
| 21 | return map[c]; |
| 22 | } |
Deepak Kodihalli | 7679449 | 2017-02-16 23:48:18 -0600 | [diff] [blame] | 23 | |
| 24 | namespace inventory |
| 25 | { |
| 26 | |
| 27 | /** @brief Get inventory-manager's d-bus service |
| 28 | */ |
| 29 | auto getPIMService(); |
| 30 | |
| 31 | /** @brief Call inventory-manager to add objects |
| 32 | * |
| 33 | * @param [in] objects - Map of inventory object paths |
| 34 | */ |
| 35 | void callPIM(ObjectMap&& objects); |
| 36 | |
| 37 | } // namespace inventory |
| 38 | |
SunnySrivastava1984 | f6d541e | 2020-02-04 12:50:40 -0600 | [diff] [blame] | 39 | /**@brief This API reads 2 Bytes of data and swap the read data |
| 40 | * @param[in] iterator- Pointer pointing to the data to be read |
| 41 | * @return returns 2 Byte data read at the given pointer |
| 42 | */ |
| 43 | openpower::vpd::constants::LE2ByteData |
| 44 | readUInt16LE(Binary::const_iterator iterator); |
| 45 | |
SunnySrivastava1984 | d076da8 | 2020-03-05 05:33:35 -0600 | [diff] [blame] | 46 | /** @brief Encodes a keyword for D-Bus. |
| 47 | * @param[in] kw - kwd data in string format |
| 48 | * @param[in] encoding - required for kwd data |
| 49 | */ |
| 50 | string encodeKeyword(const string& kw, const string& encoding); |
SunnySrivastava1984 | 4330654 | 2020-04-01 02:50:20 -0500 | [diff] [blame] | 51 | |
| 52 | /** @brief Reads a property from the inventory manager given object path, |
| 53 | * intreface and property. |
| 54 | * @param[in] obj - object path |
| 55 | * @param[in] inf - interface |
| 56 | * @param[in] prop - property whose value is fetched |
| 57 | * @return [out] - value of the property |
| 58 | */ |
| 59 | string readBusProperty(const string& obj, const string& inf, |
| 60 | const string& prop); |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 61 | } // namespace vpd |
| 62 | } // namespace openpower |