Jump to content

LibMISB/Examples/Library basic usage: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 22: Line 22:


To perform the encoding, the following command is executed. Where the '''--encode''' flag indicates that encoding is to be performed. The '''-i''' flag indicates the input file, where the metadata must be raw without encoding. On the other hand, the '''-o''' flag indicates the output file, which contains the encoded bytes in a binary file. The '''--verbose''' flag shows the KLV bytes encoded on the terminal.  
To perform the encoding, the following command is executed. Where the '''--encode''' flag indicates that encoding is to be performed. The '''-i''' flag indicates the input file, where the metadata must be raw without encoding. On the other hand, the '''-o''' flag indicates the output file, which contains the encoded bytes in a binary file. The '''--verbose''' flag shows the KLV bytes encoded on the terminal.  
The input JSON file is as follows:  
 
The input JSON file that is going to be used is as follows:  


<syntaxhighlight lang=json>
<syntaxhighlight lang=json>
Line 51: Line 52:
}
}


The command to encode:
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang=C>
<syntaxhighlight lang=C>
./misb-converter --verbose --encode -i misb_ST0601_sample.json -o klv.bin
./misb-converter --verbose --encode -i misb_ST0601_sample.json -o klv.bin
</syntaxhighlight>
Once the command is executed (with the --verbose flag), the KLV bytes are displayed in hexadecimal format. The klv.bin file contains the encoded bytes.
<syntaxhighlight lang=shell>
INFO    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>


267

edits

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