Jump to content

LibMISB/LibMISB Introduction/ Functionalities supported: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 29: Line 29:
'''Use case''':
'''Use case''':
<syntaxhighlight lang=C>
<syntaxhighlight lang=C>
  misb::Misb misb;
   misb.SetDebuggerLever(MISB_DEBUG);
   misb.SetDebuggerLever(MISB_DEBUG);
</syntaxhighlight>
</syntaxhighlight>
Line 48: Line 49:
</syntaxhighlight>
</syntaxhighlight>


Note: some tags are mandatories depending on the standard.  
'''Note''': some tags are mandatories depending on the standard.  


The method header is:  
The method header is:  
Line 66: Line 67:
'''Use case''':
'''Use case''':
<syntaxhighlight lang=C>
<syntaxhighlight lang=C>
  misb::Misb misb;
   misb.SetFormatter(misb::formatter::JSON_FORMAT);
   misb.SetFormatter(misb::formatter::JSON_FORMAT);
</syntaxhighlight>
</syntaxhighlight>
Line 78: Line 80:


==== Encode ====
==== Encode ====
Performs the encoding of the metadata that was parsed by the Formatter. Encoding will depend on the MISB standard key found in the input file.  
Performs the encoding of the metadata that was parsed by the Formatter. Encoding will depend on the MISB standard key found in the input file.
The method header is:  
The method header is:  
<syntaxhighlight lang=C>
<syntaxhighlight lang=C>
Line 90: Line 93:
   */
   */
   std::vector<unsigned char> Encode(std::string data);
   std::vector<unsigned char> Encode(std::string data);
</syntaxhighlight>
'''Note''': The formatter must be set, otherwise the encode method will send an error.
'''Use case''':
<syntaxhighlight lang=C>
  misb::Misb misb;
  std::vector<unsigned char> packet_encoded = misb.Encode(data);
</syntaxhighlight>
</syntaxhighlight>
==== Decode ====
==== Decode ====
Performs decoding of the metadata found in a KLV byte packet. The decoding will depend on the MISB standard key found in the packet. Once decoded, it will return the data according to the configured format type.
Performs decoding of the metadata found in a KLV byte packet. The decoding will depend on the MISB standard key found in the packet. Once decoded, it will return the data according to the configured format type.
The method header is:
<syntaxhighlight lang=C>
/**
  * @brief  Receive packet encoded metadata that will convert to the formatter
  * format in MISB
  *
  * @param packet Vector with encoded metadata
  * @return std::string Return string with metadata decoded
  */
  std::string Decode(std::vector<unsigned char> packet);
</syntaxhighlight>
'''Note''': The formatter must be set, otherwise the decode method will send an error.
'''Use case''':
<syntaxhighlight lang=C>
  misb::Misb misb;
  std::string data_decoded = misb.Decode(packet);
</syntaxhighlight>






<noinclude>{{LibMISB/Foot|LibMISB_Introduction/What_does_the_library_do|Getting_Started}}</noinclude>
<noinclude>{{LibMISB/Foot|LibMISB_Introduction/What_does_the_library_do|Getting_Started}}</noinclude>
267

edits

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