Jump to content

LibMISB/Examples/Library basic usage: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 63: Line 63:


=== Decode command ===
=== Decode command ===
{{review|The same here, show input (byte-stream) and output (JSON generated)|Enrique}}
 


To perform the decoding, the following command is executed. Where the '''--decode''' flag indicates that decoding is to be performed. The '''-i''' flag indicates the input file, where the metadata must be encoded. The '''-o''' flag indicates the output file, which contains the metadata decoded.  
To perform the decoding, the following command is executed. Where the '''--decode''' flag indicates that decoding is to be performed. The '''-i''' flag indicates the input file, where the metadata must be encoded. The '''-o''' flag indicates the output file, which contains the metadata decoded.  
The encoded bytes found inside the klv.bin file are (represented in hexadecimal form):
<syntaxhighlight lang=C>
6 14 43 52 2 11 1 1 14 1 3 1 1 0 0 0 44 2 8 0
4 89 249 174 32 34 168 3 9 77 73 83 83 73 79
78 48 49 4 6 65 70 45 49 48 49 5 2 113 194 15
2 194 33 65 1 17 1 2 164 125
</syntaxhighlight>


<syntaxhighlight lang=C>
<syntaxhighlight lang=C>
./misb-converter --decode -i klv.bin -o output.json
./misb-converter --decode -i klv.bin -o output.json
</syntaxhighlight>
Once the command is executed, it reports that a decoded file was generated. The content of the output.json file is
<syntaxhighlight lang=json>
{
  "key": "060E2B34020B01010E01030101000000",
  "items": [
    {
      "tag": "2",
      "value": "Oct. 24, 2008. 00:13:29.913"
    },
    {
      "tag": "3",
      "value": "MISSION01"
    },
    {
      "tag": "4",
      "value": "AF-101"
    },
    {
      "tag": "5",
      "value": "159.974365"
    },
    {
      "tag": "15",
      "value": "14190.719463"
    },
    {
      "tag": "65",
      "value": "17"
    }
  ]
}
</syntaxhighlight>
</syntaxhighlight>
267

edits

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