mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-31 23:33:03 +00:00
Merge branch 'ism' of github.com:carlesfernandez/gnss-sdr into ism
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
#include "galileo_ism.h"
|
||||
#include <boost/crc.hpp>
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
@@ -176,15 +175,12 @@ uint16_t Galileo_ISM::get_Tvalidity_hours() const
|
||||
}
|
||||
|
||||
|
||||
bool Galileo_ISM::check_ism_crc(const std::bitset<GALILEO_DATA_JK_BITS>& bits) const
|
||||
bool Galileo_ISM::check_ism_crc(const std::bitset<GALILEO_DATA_JK_BITS>& bits)
|
||||
{
|
||||
boost::dynamic_bitset<unsigned char> frame_bits(bits.to_string().substr(0, GALILEO_ISM_CRC_DATA_BITS));
|
||||
|
||||
std::vector<unsigned char> bytes;
|
||||
boost::to_block_range(frame_bits, std::back_inserter(bytes));
|
||||
std::reverse(bytes.begin(), bytes.end());
|
||||
|
||||
boost::crc_32_type crc32_ism;
|
||||
crc32_ism.process_bytes(bytes.data(), GALILEO_ISM_CRC_DATA_BYTES);
|
||||
const uint32_t crc_computed = crc32_ism.checksum();
|
||||
if (this->ism_crc == crc_computed)
|
||||
@@ -193,4 +189,12 @@ bool Galileo_ISM::check_ism_crc(const std::bitset<GALILEO_DATA_JK_BITS>& bits) c
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32_t Galileo_ISM::compute_crc(const std::vector<uint8_t>& data)
|
||||
{
|
||||
crc32_ism.process_bytes(data.data(), data.size());
|
||||
uint32_t result = crc32_ism.checksum();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,11 @@
|
||||
#define GNSS_SDR_GALILEO_ISM_H
|
||||
|
||||
#include "Galileo_INAV.h"
|
||||
#include <boost/crc.hpp>
|
||||
#include <bitset>
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Core
|
||||
* \{ */
|
||||
@@ -41,7 +43,7 @@ public:
|
||||
/*!
|
||||
* Default constructor
|
||||
*/
|
||||
Galileo_ISM() = default;
|
||||
Galileo_ISM() : crc32_ism(0x814141AB, 0, 0, false, false) {};
|
||||
|
||||
void set_ism_constellation_id(uint8_t const_id);
|
||||
void set_ism_service_level_id(uint8_t sl_id);
|
||||
@@ -57,7 +59,7 @@ public:
|
||||
void set_ism_Tvalidity(uint8_t tvalidity);
|
||||
void set_ism_crc(uint32_t crc);
|
||||
|
||||
bool check_ism_crc(const std::bitset<GALILEO_DATA_JK_BITS>& bits) const;
|
||||
bool check_ism_crc(const std::bitset<GALILEO_DATA_JK_BITS>& bits);
|
||||
|
||||
double get_pconst_value() const;
|
||||
double get_psat_value() const;
|
||||
@@ -67,8 +69,11 @@ public:
|
||||
uint16_t get_WN_ISM() const;
|
||||
uint16_t get_t0_ISM() const;
|
||||
uint16_t get_Tvalidity_hours() const;
|
||||
uint32_t compute_crc(const std::vector<uint8_t>& data);
|
||||
|
||||
private:
|
||||
boost::crc_basic<32> crc32_ism;
|
||||
|
||||
// ICD 2.1 Table 97
|
||||
std::unordered_map<uint8_t, double> ISM_PCONST_MAP = {
|
||||
{0, 1.0e-8},
|
||||
@@ -145,7 +150,6 @@ private:
|
||||
{14, 3.75},
|
||||
{15, 4.00}};
|
||||
|
||||
|
||||
// ICD 2.1 Table 101
|
||||
std::unordered_map<uint8_t, float> ISM_BNOM_MAP = {
|
||||
{0, 0.0},
|
||||
@@ -165,7 +169,6 @@ private:
|
||||
{14, 2.0},
|
||||
{15, 2.4}};
|
||||
|
||||
|
||||
// ICD 2.1 Table 102
|
||||
std::unordered_map<uint8_t, uint16_t> ISM_TVALIDITY_MAP = {
|
||||
{0, 1},
|
||||
|
||||
Reference in New Issue
Block a user