Example code for TLV encoding and decoding.
uint8_t tlv_value_0[] = {0x01, 0x02, 0x03, 0x04, 0x05};
uint8_t tlv_value_1[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
uint32_t tlv_count = 2;
encode_tlv[0].
tag = 0x1234;
encode_tlv[0].
length =
sizeof(tlv_value_0);
encode_tlv[0].
value = tlv_value_0;
encode_tlv[1].
tag = 0x1234;
encode_tlv[1].
length =
sizeof(tlv_value_1);
encode_tlv[1].
value = tlv_value_1;
{
{
}
}
provides the function implementation for TLV(tag length value) DGI encoder and decoder.
ifx_status_t ifx_tlv_dgi_decode(const ifx_blob_t *encoded_bytes, uint32_t *tlv_data_count, ifx_tlv_t *tlv_data)
Decodes the byte array into array of TLV type data. This method decodes DGI TLV formatted data,...
ifx_status_t ifx_tlv_dgi_encode(const ifx_tlv_t *tlv_data, uint32_t tlv_data_count, ifx_blob_t *encoded_bytes)
Encodes the array of TLV type data into byte array. This method encodes in DGI TLV format,...
Data storage for TLV(tag, length & value) fields TLV value field can be NULL.