blob: 4a8b8782647774e9453740d3179de087998128db [file] [log] [blame]
Alexander Hansend6a95742025-01-06 15:06:25 +01001#pragma once
2
3#include <expected>
4#include <libpldm/base.h>
5#include <libpldm/pldm_types.h>
6
7#include <string>
8
9namespace pldm
10{
11namespace utils
12{
13 /** @brief Convert the buffer to std::string
14 *
15 * In case the string encoding is not ASCII, an error string is returned.
16 *
17 * @param[in] pldm_string_type - DSP0267, Table 20
18 * @param[in] var - pointer to data and length of the data
19 *
20 * @return[expected] std::string equivalent of variable field
21 * @return[unexpected] error message string
22 */
23 std::expected<std::string, std::string>
24 toString(uint8_t pldm_string_type, const struct variable_field &var);
25
26} // namespace utils
27} // namespace pldm