libcluon
0.0.148
|
#include <EnvelopeConverter.hpp>
Public Member Functions | |
EnvelopeConverter ()=default | |
int32_t | setMessageSpecification (const std::string &ms) noexcept |
std::string | getJSONFromProtoEncodedEnvelope (const std::string &protoEncodedEnvelope) noexcept |
std::string | getJSONFromEnvelope (cluon::data::Envelope &envelope) noexcept |
std::string | getProtoEncodedEnvelopeFromJSONWithoutTimeStamps (const std::string &json, int32_t messageIdentifier, uint32_t senderStamp) noexcept |
std::string | getProtoEncodedEnvelopeFromJSON (const std::string &json, int32_t messageIdentifier, uint32_t senderStamp) noexcept |
This class provides various conversion functions to and from Envelope data structures.
|
default |
|
noexcept |
This method transforms the given Envelope to JSON.
envelope | Envelope. |
References cluon::GenericMessage::accept(), cluon::GenericMessage::createFrom(), cluon::FromProtoVisitor::decodeFrom(), and retVal.
|
noexcept |
This method transforms the given Proto-encoded Envelope to JSON. The Proto-encoded envelope might be preceded with a 5-bytes OD4-header (optional).
protoEncodedEnvelope | Proto-encoded Envelope. |
References cluon::FromProtoVisitor::decodeFrom(), cluon::extractEnvelope(), and retVal.
|
noexcept |
This method transforms a given JSON representation into a Proto-encoded Envelope including the prepended OD4-header and setting cluon::time::now() as sampleTimeStamp.
json | representation according to the given message specification. |
messageIdentifier | The given JSON representation shall be interpreted as the specified message. |
senderStamp | to be used in the Envelope. |
References cluon::GenericMessage::accept(), cluon::GenericMessage::createFrom(), cluon::FromJSONVisitor::decodeFrom(), cluon::ToProtoVisitor::encodedData(), cluon::time::now(), retVal, and cluon::serializeEnvelope().
|
noexcept |
This method transforms a given JSON representation into a Proto-encoded Envelope including the prepended OD4-header.
json | representation according to the given message specification. |
messageIdentifier | The given JSON representation shall be interpreted as the specified message. |
senderStamp | to be used in the Envelope. |
|
noexcept |
This method sets the message specification to be used for interpreting a given Proto-encoded Envelope.
ms | Message specification following the ODVD format. |
References mm, cluon::MessageParser::parse(), and retVal.