Data Type Adapter
The Data Type Adapter is the first processing block inside a Signal Conditioner when the later is using a Signal_Conditioner
implementation.
The role of a Data Type Adapter block is to perform a conversion of the data type in the sample stream.
This is the first processing block after the Signal Source, and each kind of source can deliver data in different formats.

If the Signal Source is delivering samples at a given intermediate frequency, the native data types can be:

Real samples:
byte
,short
,float
(8, 16 and 32 bits, respectively). 
Intervealed (I&Q) samples:
ibyte
,ishort
,gr_complex
(8+8, 16+16 and 32+32 bits, respectively).


If the Signal Source is delivering samples at baseband, the native data types can be:

Intervealed (I&Q) samples:
ibyte
,ishort
,gr_complex
(8+8, 16+16 and 32+32 bits, respectively). 
Complex samples:
cbyte
,cshort
,gr_complex
(8+8, 16+16 and 32+32 bits, respectively).

This block provide several implementations of data type conversions. Next table summarizes their characteristics:
Type name in GNSSSDR conf files  Definition  Sample stream 

byte 
Signed integer, 8bit two’s complement number ranging from to . C++ type name: int8_t 

short 
Signed integer, 16bit two’s complement number ranging from to . C++ type name: int16_t 

float 
Defines numbers with fractional parts, can represent values ranging from approx. to with a precision of 7 digits (32 bits). C++ type name: float 

ibyte 
Interleaved (I&Q) stream of samples of type byte . C++ type name: int8_t 

ishort 
Interleaved (I&Q) samples of type short . C++ type name: int16_t 

cbyte 
Complex samples, with real and imaginary parts of type byte . C++ type name: lv_8sc_t 

cshort 
Complex samples, with real and imaginary parts of type short . C++ type name: lv_16sc_t 

gr_complex 
Complex samples, with real and imaginary parts of type float . C++ type name: std::complex<float> 
For more details about sample data types and their usage in GNSSSDR, please check out our tutorial on data types.
Implementation: Byte_To_Short
This implementation takes samples of type byte
(8 bits, real samples)
at its input and writes samples of type short
(16 bits, real samples)
at its output.
It accepts the following parameters:
Parameter  Description  Required 

implementation 
Byte_To_Short 
Mandatory 
Signal Conditioner implementation: Byte_To_Short
.
Example:
;######### DATA_TYPE_ADAPTER CONFIG ############
DataTypeAdapter.implementation=Byte_To_Short
Implementation: Ibyte_To_Cbyte
This implementation takes samples of type ibyte
(interleaved I&Q
samples, 8 bits each) at its input and writes samples of type cbyte
(complex samples with real and imaginary components of 8 bits each) at
its output. This reduces the sample rate by two.
It accepts the following parameters:
Parameter  Description  Required 

implementation 
Ibyte_To_Cbyte 
Mandatory 
Signal Conditioner implementation: Ibyte_To_Cbyte
.
Example:
;######### DATA_TYPE_ADAPTER CONFIG ############
DataTypeAdapter.implementation=Ibyte_To_Cbyte
Implementation: Ibyte_To_Complex
This implementation takes samples of type ibyte
(interleaved I&Q
samples, 8 bits each) at its input and writes samples of type
gr_complex
(complex samples with real and imaginary components of 32
bits each) at its output. This reduces the sample rate by two.
It accepts the following parameters:
Parameter  Description  Required 

implementation 
Ibyte_To_Complex 
Mandatory 
Signal Conditioner implementation: Ibyte_To_Complex
.
Example:
;######### DATA_TYPE_ADAPTER CONFIG ############
DataTypeAdapter.implementation=Ibyte_To_Complex
Implementation: Ishort_To_Cshort
This implementation takes samples of type ishort
(interleaved I&Q
samples, 16 bits each) at its input and writes samples of type cshort
(complex samples with real and imaginary components of 16 bits each) at
its output. This reduces the sample rate by two.
It accepts the following parameters:
Parameter  Description  Required 

implementation 
Ishort_To_Cshort 
Mandatory 
Signal Conditioner implementation: Ishort_To_Cshort
.
Example:
;######### DATA_TYPE_ADAPTER CONFIG ############
DataTypeAdapter.implementation=Ishort_To_Cshort
Implementation: Ishort_To_Complex
This implementation takes samples of type ishort
(interleaved I&Q
samples, 16 bits each) at its input and writes samples of type
gr_complex
(complex samples with real and imaginary components of 32
bits each) at its output. This reduces the sample rate by two.
It accepts the following parameters:
Parameter  Description  Required 

implementation 
Ishort_To_Complex 
Mandatory 
Signal Conditioner implementation: Ishort_To_Complex
.
Example:
;######### DATA_TYPE_ADAPTER CONFIG ############
DataTypeAdapter.implementation=Ishort_To_Complex
Implementation: Pass_Through
This implementation copies samples from its input to its output.
It accepts the following parameters:
Parameter  Description  Required 

implementation 
Pass_Through 
Mandatory 
item_type 
[gr_complex , cshort , cbyte ]: Format of data samples. It defaults to gr_complex . 
Optional 
Data Type Adapter implementation: Pass_Through
.
Examples:
;######### DATA_TYPE_ADAPTER CONFIG ############
DataTypeAdapter.implementation=Pass_Through
;######### DATA_TYPE_ADAPTER CONFIG ############
DataTypeAdapter.implementation=Pass_Through
DataTypeAdapter.item_type=cshort
Leave a Comment