Jump to content

LibMISB/LibMISB Introduction/ Functionalities supported: Difference between revisions

mNo edit summary
Line 142: Line 142:
   libmisb.SetFormatter(json_formatter);
   libmisb.SetFormatter(json_formatter);
   std::vector<unsigned char> packet_encoded = libmisb.Encode(data);
   std::vector<unsigned char> packet_encoded = libmisb.Encode(data);
</syntaxhighlight>
Additionally, it is possible to perform the encoding of the data using the Metadata class directly without requiring an input file.
In this case, the class header and method header are the following:
<syntaxhighlight lang="c">
/**
  * @brief This class store the metadata that will be coding and decoding
  *
  */
class Metadata
</syntaxhighlight>
<syntaxhighlight lang="c">
/**
  * @brief Receive string metadata that will convert to KLV
  * bytes in MISB
  *
  * @param metadata reference to metadata object that will be encoded
  * @param packet Vector that will be filled with the KLV bytes in MISB
  * @return int Return 0 if the encoding was successful, otherwise 1
  */
int Encode(Metadata& data, std::vector<unsigned char>& packet);
</syntaxhighlight>
'''Use case''':
<syntaxhighlight lang="c">
  libmisb::LibMisb libmisb;
  libmisb::Metadata metadata;
  std::vector<unsigned char> packet;
  int result_encode = libmisb.Encode(metadata, packet);
</syntaxhighlight>
</syntaxhighlight>


345

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.