345
edits
(→Encode) |
(→Decode) |
||
Line 211: | Line 211: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
In the case that the decoding was performed using the Metadata class and the formatter was not set, decoding can be performed with the following method: | |||
<syntaxhighlight lang="c"> | |||
/** | |||
* @brief Receive KLV bytes packet that will convert to metadata object | |||
* | |||
* @param packet Packet that contain whole metadata encoded in KLV | |||
* | |||
* @param metadata Metadata object that will store the data decoded | |||
* @return int If everything its ok will return 0, if not will return 1 | |||
*/ | |||
int Decode(std::vector<unsigned char> &packet, Metadata &metadata); | |||
</syntaxhighlight> | |||
'''Use case''': | |||
<syntaxhighlight lang="c"> | |||
libmisb::LibMisb libmisb; | |||
libmisb::codec::Codec codec; | |||
int decoding_result = codec.Decode(packet, decoded_metadata); | |||
</syntaxhighlight> | |||
<noinclude>{{LibMISB/Foot|LibMISB_Introduction/What_does_the_library_do|Supported_Standards/MISB_0601.17}}</noinclude> | <noinclude>{{LibMISB/Foot|LibMISB_Introduction/What_does_the_library_do|Supported_Standards/MISB_0601.17}}</noinclude> |
edits