kopia lustrzana https://github.com/proto17/dji_droneid
Added bit_vec_to_string and fixed write() bug
rodzic
c7e7587c24
commit
736ccbe8b1
|
@ -53,6 +53,8 @@ namespace gr {
|
|||
static std::vector<uint32_t> get_data_carrier_indices(uint32_t fft_size);
|
||||
static std::vector<std::complex<float>> extract_data_carriers(const std::vector<std::complex<float>> & symbol, uint32_t fft_size);
|
||||
|
||||
static std::string bit_vec_to_string(const std::vector<int8_t> & bit_vec);
|
||||
|
||||
static void print_bits(const std::vector<int8_t> & bits);
|
||||
misc_utils();
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace gr {
|
|||
if (!handle) {
|
||||
throw std::runtime_error("Failed to open output file");
|
||||
}
|
||||
fwrite(elements, sizeof(element_size), element_count, handle);
|
||||
fwrite(elements, element_size, element_count, handle);
|
||||
fclose(handle);
|
||||
}
|
||||
|
||||
|
@ -150,6 +150,17 @@ namespace gr {
|
|||
std::cout << buff.str();
|
||||
std::flush(std::cout);
|
||||
}
|
||||
|
||||
std::string misc_utils::bit_vec_to_string(const std::vector<int8_t> &bit_vec) {
|
||||
std::ostringstream buff;
|
||||
|
||||
char lut[2] = {'0', '1'};
|
||||
for (const auto & bit : bit_vec) {
|
||||
buff << lut[bit];
|
||||
}
|
||||
|
||||
return buff.str();
|
||||
}
|
||||
} /* namespace droneid */
|
||||
} /* namespace gr */
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue