blob: fd1269887a4b5460e81884be0e7f7b4fe763bc68 [file] [log] [blame]
Deepak Kodihalli76794492017-02-16 23:48:18 -06001#pragma once
2
SunnySrivastava1984f6d541e2020-02-04 12:50:40 -06003#include "const.hpp"
Deepak Kodihalli76794492017-02-16 23:48:18 -06004#include "types.hpp"
5
SunnySrivastava1984d076da82020-03-05 05:33:35 -06006#include <iostream>
7
8using namespace std;
Deepak Kodihalli76794492017-02-16 23:48:18 -06009namespace openpower
10{
11namespace vpd
12{
Santosh Puranikbd011b22020-01-23 04:05:25 -060013/** @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 */
18constexpr auto toHex(size_t c)
19{
20 constexpr auto map = "0123456789abcdef";
21 return map[c];
22}
Deepak Kodihalli76794492017-02-16 23:48:18 -060023
24namespace inventory
25{
26
27/** @brief Get inventory-manager's d-bus service
28 */
29auto getPIMService();
30
31/** @brief Call inventory-manager to add objects
32 *
33 * @param [in] objects - Map of inventory object paths
34 */
35void callPIM(ObjectMap&& objects);
36
37} // namespace inventory
38
SunnySrivastava1984f6d541e2020-02-04 12:50:40 -060039/**@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 */
43openpower::vpd::constants::LE2ByteData
44 readUInt16LE(Binary::const_iterator iterator);
45
SunnySrivastava1984d076da82020-03-05 05:33:35 -060046/** @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 */
50string encodeKeyword(const string& kw, const string& encoding);
Patrick Venturec83c4dc2018-11-01 16:29:18 -070051} // namespace vpd
52} // namespace openpower