1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-30 08:53:15 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into tow_crossover

This commit is contained in:
Javier Arribas 2019-05-13 12:28:44 +02:00
commit 78311a6dd6
2 changed files with 134 additions and 135 deletions

View File

@ -76,7 +76,7 @@ public:
monitor_.set_cov_zz(monitor.cov_zz);
monitor_.set_cov_xy(monitor.cov_xy);
monitor_.set_cov_yz(monitor.cov_yz);
monitor_.set_cov_yz(monitor.cov_yz);
monitor_.set_cov_zx(monitor.cov_zx);
monitor_.set_latitude(monitor.latitude);
monitor_.set_longitude(monitor.longitude);
monitor_.set_height(monitor.height);

View File

@ -198,6 +198,8 @@ void labsat23_source::decode_samples_one_channel(int16_t input_short, gr_complex
//out[i] += gr_complex(0.5, 0.5);
}
break;
default:
break;
}
}
@ -225,7 +227,6 @@ int labsat23_source::general_work(int noutput_items,
{
preamble_ok = false;
}
//std::cout << "H[" << i << "]:" << (int)memblock[byte_counter] << std::endl;
byte_counter++;
}
@ -266,17 +267,14 @@ int labsat23_source::general_work(int noutput_items,
header_bytes += memblock[byte_counter] | (memblock[byte_counter + 1] << 8) | (memblock[byte_counter + 2] << 16) | (memblock[byte_counter + 3] << 24);
byte_counter += 4;
//std::cout << "header_bytes=" << header_bytes << std::endl;
// read first section
// section ID (little-endian)
uint8_t section_id = static_cast<int>(memblock[byte_counter]) + static_cast<int>(memblock[byte_counter + 1]) * 256;
//std::cout << "Section ID: " << (int)section_id << std::endl;
byte_counter += 2;
//uint8_t section_lenght_bytes = 0;
//section_lenght_bytes += memblock[byte_counter] | (memblock[byte_counter + 1] << 8) | (memblock[byte_counter + 2] << 16) | (memblock[byte_counter + 3] << 24);
//std::cout << "section_lenght_bytes=" << (int)section_lenght_bytes << std::endl;
byte_counter += 4;
if (section_id == 2)
@ -285,10 +283,10 @@ int labsat23_source::general_work(int noutput_items,
switch (d_ref_clock)
{
case 0:
std::cout << "Labsat reference clock: internal OXCO" << std::endl;
std::cout << "Labsat reference clock: internal OCXO" << std::endl;
break;
case 1:
std::cout << "Labsat reference clock: internal TXCO" << std::endl;
std::cout << "Labsat reference clock: internal TCXO" << std::endl;
break;
case 2:
std::cout << "Labsat reference clock: external 10 MHz" << std::endl;
@ -319,19 +317,19 @@ int labsat23_source::general_work(int noutput_items,
switch (d_channel_selector)
{
case 0:
std::cout << "Available channels: Channel A + B, 1 bit quantisation" << std::endl;
std::cout << "Available channels: Channel A + B, 1 bit quantisation (I & Q)" << std::endl;
break;
case 1:
std::cout << "Available channels: Channel A, 1 bit quantisation" << std::endl;
std::cout << "Available channels: Channel A, 1 bit quantisation (I & Q)" << std::endl;
break;
case 2:
std::cout << "Available channels: Channel B, 1 bit quantisation" << std::endl;
std::cout << "Available channels: Channel B, 1 bit quantisation (I & Q)" << std::endl;
break;
case 3:
std::cout << "Available channels: Channel A, 2 bit quantisation" << std::endl;
std::cout << "Available channels: Channel A, 2 bit quantisation (I & Q)" << std::endl;
break;
case 4:
std::cout << "Available channels: Channel B, 2 bit quantisation" << std::endl;
std::cout << "Available channels: Channel B, 2 bit quantisation (I & Q)" << std::endl;
break;
default:
std::cout << "Unknown channel selection ID " << static_cast<int>(d_channel_selector) << std::endl;
@ -355,6 +353,8 @@ int labsat23_source::general_work(int noutput_items,
auto quantization = static_cast<uint8_t>(memblock[byte_counter]);
switch (quantization)
{
case 0:
break;
case 1:
std::cout << "1 bit per sample" << std::endl;
break;
@ -393,6 +393,9 @@ int labsat23_source::general_work(int noutput_items,
case 2:
std::cout << "Labsat Channel B is BDS" << std::endl;
break;
case 255:
// No channel B
break;
default:
std::cout << "Unknown channel B constellation ID " << static_cast<int>(channel_b_constellation) << std::endl;
}
@ -415,133 +418,129 @@ int labsat23_source::general_work(int noutput_items,
switch (d_bits_per_sample)
{
case 2:
{
switch (d_channel_selector)
{
case 0:
// dual channel 2 bits per complex sample
//todo: implement dual channel reader
break;
default:
// single channel 2 bits per complex sample (1 bit I + 1 bit Q, 8 samples per int16)
int n_int16_to_read = noutput_items / 8;
if (n_int16_to_read > 0)
{
int16_t memblock[n_int16_to_read];
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
n_int16_to_read = binary_input_file->gcount() / 2; //from bytes to int16
if (n_int16_to_read > 0)
{
int output_pointer = 0;
for (int i = 0; i < n_int16_to_read; i++)
{
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
output_pointer += 8;
}
return output_pointer;
}
switch (d_channel_selector)
{
case 0:
// dual channel 2 bits per complex sample
//todo: implement dual channel reader
break;
default:
// single channel 2 bits per complex sample (1 bit I + 1 bit Q, 8 samples per int16)
int n_int16_to_read = noutput_items / 8;
if (n_int16_to_read > 0)
{
int16_t memblock[n_int16_to_read];
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
n_int16_to_read = binary_input_file->gcount() / 2; //from bytes to int16
if (n_int16_to_read > 0)
{
int output_pointer = 0;
for (int i = 0; i < n_int16_to_read; i++)
{
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
output_pointer += 8;
}
return output_pointer;
}
// trigger the read of the next file in the sequence
if (d_labsat_version == 3)
{
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
}
d_current_file_number++;
binary_input_file->close();
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file->is_open())
{
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
}
else
{
if (d_labsat_version == 3)
{
std::cout << "Last file reached, LabSat source stop" << std::endl;
}
else
{
std::cout << "End of file reached, LabSat source stop" << std::endl;
}
auto *cmf = new ControlMessageFactory();
d_queue->handle(cmf->GetQueueMessage(200, 0));
delete cmf;
return -1;
}
}
else
{
return 0;
}
};
break;
}
// trigger the read of the next file in the sequence
d_current_file_number++;
if (d_labsat_version == 3)
{
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
}
binary_input_file->close();
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file->is_open())
{
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
return 0;
}
else
{
if (d_labsat_version == 3)
{
std::cout << "Last file reached, LabSat source stop" << std::endl;
}
else
{
std::cout << "End of file reached, LabSat source stop" << std::endl;
}
auto *cmf = new ControlMessageFactory();
d_queue->handle(cmf->GetQueueMessage(200, 0));
delete cmf;
return -1;
}
}
else
{
return 0;
}
}
break;
case 4:
{
switch (d_channel_selector)
{
case 0:
// dual channel
//todo: implement dual channel reader
break;
default:
// single channel 4 bits per complex sample (2 bit I + 2 bit Q, 4 samples per int16)
int n_int16_to_read = noutput_items / 4;
if (n_int16_to_read > 0)
{
int16_t memblock[n_int16_to_read];
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
n_int16_to_read = binary_input_file->gcount() / 2; //from bytes to int16
if (n_int16_to_read > 0)
{
int output_pointer = 0;
for (int i = 0; i < n_int16_to_read; i++)
{
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
output_pointer += 4;
}
return output_pointer;
}
switch (d_channel_selector)
{
case 0:
// dual channel
//todo: implement dual channel reader
break;
default:
// single channel 4 bits per complex sample (2 bit I + 2 bit Q, 4 samples per int16)
int n_int16_to_read = noutput_items / 4;
if (n_int16_to_read > 0)
{
int16_t memblock[n_int16_to_read];
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
n_int16_to_read = binary_input_file->gcount() / 2; // from bytes to int16
if (n_int16_to_read > 0)
{
int output_pointer = 0;
for (int i = 0; i < n_int16_to_read; i++)
{
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
output_pointer += 4;
}
return output_pointer;
}
// trigger the read of the next file in the sequence
if (d_labsat_version == 3)
{
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
}
d_current_file_number++;
binary_input_file->close();
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file->is_open())
{
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
}
else
{
if (d_labsat_version == 3)
{
std::cout << "Last file reached, LabSat source stop" << std::endl;
}
else
{
std::cout << "End of file reached, LabSat source stop" << std::endl;
}
auto *cmf = new ControlMessageFactory();
d_queue->handle(cmf->GetQueueMessage(200, 0));
delete cmf;
return -1;
}
}
else
{
return 0;
}
}
break;
}
// trigger the read of the next file in the sequence
d_current_file_number++;
if (d_labsat_version == 3)
{
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
}
binary_input_file->close();
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file->is_open())
{
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
return 0;
}
else
{
if (d_labsat_version == 3)
{
std::cout << "Last file reached, LabSat source stop" << std::endl;
}
else
{
std::cout << "End of file reached, LabSat source stop" << std::endl;
}
auto *cmf = new ControlMessageFactory();
d_queue->handle(cmf->GetQueueMessage(200, 0));
delete cmf;
return -1;
}
}
else
{
return 0;
}
}
break;
default:
{
return -1;
}
return -1;
}
std::cout << "Warning!!" << std::endl;