180ad94fcSkasunath #pragma once 280ad94fcSkasunath 3*0aa36d82Skasunath #include "bej_common.h" 480ad94fcSkasunath #include "bej_decoder_core.h" 580ad94fcSkasunath 680ad94fcSkasunath #include <span> 780ad94fcSkasunath #include <string> 880ad94fcSkasunath #include <vector> 980ad94fcSkasunath 1080ad94fcSkasunath namespace libbej 1180ad94fcSkasunath { 1280ad94fcSkasunath 1380ad94fcSkasunath /** 1480ad94fcSkasunath * @brief Class for decoding RDE BEJ to a JSON output. 1580ad94fcSkasunath */ 1680ad94fcSkasunath class BejDecoderJson 1780ad94fcSkasunath { 1880ad94fcSkasunath 1980ad94fcSkasunath public: 2080ad94fcSkasunath /** 2180ad94fcSkasunath * @brief Decode the encoded PLDM block. 2280ad94fcSkasunath * 2380ad94fcSkasunath * @param[in] dictionaries - dictionaries needed for decoding. 2480ad94fcSkasunath * @param[in] encodedPldmBlock - encoded PLDM block. 2580ad94fcSkasunath * @return 0 if successful. 2680ad94fcSkasunath */ 2780ad94fcSkasunath int decode(const BejDictionaries& dictionaries, 2880ad94fcSkasunath const std::span<const uint8_t> encodedPldmBlock); 2980ad94fcSkasunath 3080ad94fcSkasunath /** 3180ad94fcSkasunath * @brief Get the JSON output related to the latest call to decode. 3280ad94fcSkasunath * 3380ad94fcSkasunath * @return std::string containing a JSON. If the decoding was 3480ad94fcSkasunath * unsuccessful, this might contain partial data (invalid JSON). 3580ad94fcSkasunath */ 3680ad94fcSkasunath std::string getOutput(); 3780ad94fcSkasunath 3880ad94fcSkasunath private: 3980ad94fcSkasunath bool isPrevAnnotated; 4080ad94fcSkasunath std::string output; 4180ad94fcSkasunath std::vector<BejStackProperty> stack; 4280ad94fcSkasunath }; 4380ad94fcSkasunath 4480ad94fcSkasunath } // namespace libbej 45