mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-10-30 22:56:22 +00:00
Add osnma_dsm_reader
This commit is contained in:
parent
fec1468ec4
commit
1595c5f363
@ -511,8 +511,8 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
|
|||||||
if (d_band == '1' && d_inav_nav.have_new_nma() == true)
|
if (d_band == '1' && d_inav_nav.have_new_nma() == true)
|
||||||
{
|
{
|
||||||
const std::shared_ptr<OSNMA_msg> tmp_obj = std::make_shared<OSNMA_msg>(d_inav_nav.get_osnma_msg());
|
const std::shared_ptr<OSNMA_msg> tmp_obj = std::make_shared<OSNMA_msg>(d_inav_nav.get_osnma_msg());
|
||||||
this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj));
|
|
||||||
uint8_t nma_status = (tmp_obj->hkroot[0] & 0xC0) >> 6;
|
uint8_t nma_status = (tmp_obj->hkroot[0] & 0xC0) >> 6;
|
||||||
|
this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj));
|
||||||
std::string nma_status_string;
|
std::string nma_status_string;
|
||||||
if (nma_status == 0)
|
if (nma_status == 0)
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "osnma_msg_receiver.h"
|
#include "osnma_msg_receiver.h"
|
||||||
#include "Galileo_OSNMA.h"
|
#include "Galileo_OSNMA.h"
|
||||||
#include "gnss_sdr_make_unique.h" // for std::make_unique in C++11
|
#include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader
|
||||||
#include <glog/logging.h> // for DLOG
|
#include <glog/logging.h> // for DLOG
|
||||||
#include <gnuradio/io_signature.h> // for gr::io_signature::make
|
#include <gnuradio/io_signature.h> // for gr::io_signature::make
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
@ -67,6 +67,7 @@ osnma_msg_receiver::osnma_msg_receiver() : gr::block("osnma_msg_receiver",
|
|||||||
gr::io_signature::make(0, 0, 0),
|
gr::io_signature::make(0, 0, 0),
|
||||||
gr::io_signature::make(0, 0, 0))
|
gr::io_signature::make(0, 0, 0))
|
||||||
{
|
{
|
||||||
|
d_dsm_reader = std::make_unique<OSNMA_DSM_Reader>();
|
||||||
// register OSNMA input message port from telemetry blocks
|
// register OSNMA input message port from telemetry blocks
|
||||||
this->message_port_register_in(pmt::mp("OSNMA_from_TLM"));
|
this->message_port_register_in(pmt::mp("OSNMA_from_TLM"));
|
||||||
// register OSNMA output message port to PVT block
|
// register OSNMA output message port to PVT block
|
||||||
@ -130,17 +131,17 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr<OSNMA_msg>&
|
|||||||
|
|
||||||
void osnma_msg_receiver::read_nma_header(uint8_t nma_header)
|
void osnma_msg_receiver::read_nma_header(uint8_t nma_header)
|
||||||
{
|
{
|
||||||
d_osnma_data.d_nma_header.nmas = get_nmas(nma_header);
|
d_osnma_data.d_nma_header.nmas = d_dsm_reader->get_nmas(nma_header);
|
||||||
d_osnma_data.d_nma_header.cid = get_cid(nma_header);
|
d_osnma_data.d_nma_header.cid = d_dsm_reader->get_cid(nma_header);
|
||||||
d_osnma_data.d_nma_header.cpks = get_cpks(nma_header);
|
d_osnma_data.d_nma_header.cpks = d_dsm_reader->get_cpks(nma_header);
|
||||||
d_osnma_data.d_nma_header.reserved = get_nma_header_reserved(nma_header);
|
d_osnma_data.d_nma_header.reserved = d_dsm_reader->get_nma_header_reserved(nma_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header)
|
void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header)
|
||||||
{
|
{
|
||||||
d_osnma_data.d_dsm_header.dsm_id = get_dsm_id(dsm_header);
|
d_osnma_data.d_dsm_header.dsm_id = d_dsm_reader->get_dsm_id(dsm_header);
|
||||||
d_osnma_data.d_dsm_header.dsm_block_id = get_dsm_block_id(dsm_header); // BID
|
d_osnma_data.d_dsm_header.dsm_block_id = d_dsm_reader->get_dsm_block_id(dsm_header); // BID
|
||||||
LOG(WARNING) << "OSNMA: DSM_ID=" << static_cast<uint32_t>(d_osnma_data.d_dsm_header.dsm_id);
|
LOG(WARNING) << "OSNMA: DSM_ID=" << static_cast<uint32_t>(d_osnma_data.d_dsm_header.dsm_id);
|
||||||
LOG(WARNING) << "OSNMA: DSM_BID=" << static_cast<uint32_t>(d_osnma_data.d_dsm_header.dsm_block_id);
|
LOG(WARNING) << "OSNMA: DSM_BID=" << static_cast<uint32_t>(d_osnma_data.d_dsm_header.dsm_block_id);
|
||||||
}
|
}
|
||||||
@ -158,7 +159,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr<OSNMA_msg>& osnma_
|
|||||||
if (d_osnma_data.d_dsm_header.dsm_block_id == 0)
|
if (d_osnma_data.d_dsm_header.dsm_block_id == 0)
|
||||||
{
|
{
|
||||||
// Get number of blocks in message
|
// Get number of blocks in message
|
||||||
uint8_t nb = get_number_blocks_index(d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][0]);
|
uint8_t nb = d_dsm_reader->get_number_blocks_index(d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][0]);
|
||||||
uint16_t number_of_blocks = 0;
|
uint16_t number_of_blocks = 0;
|
||||||
if (d_osnma_data.d_dsm_header.dsm_id < 12)
|
if (d_osnma_data.d_dsm_header.dsm_id < 12)
|
||||||
{
|
{
|
||||||
@ -217,19 +218,19 @@ void osnma_msg_receiver::process_dsm_message(const std::vector<uint8_t>& dsm_msg
|
|||||||
{
|
{
|
||||||
LOG(WARNING) << "OSNMA: DSM-KROOT message received.";
|
LOG(WARNING) << "OSNMA: DSM-KROOT message received.";
|
||||||
// DSM-KROOT message
|
// DSM-KROOT message
|
||||||
d_osnma_data.d_dsm_kroot_message.nb_dk = get_number_blocks_index(dsm_msg[0]);
|
d_osnma_data.d_dsm_kroot_message.nb_dk = d_dsm_reader->get_number_blocks_index(dsm_msg[0]);
|
||||||
d_osnma_data.d_dsm_kroot_message.pkid = get_pkid(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.pkid = d_dsm_reader->get_pkid(dsm_msg);
|
||||||
d_osnma_data.d_dsm_kroot_message.cidkr = get_cidkr(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.cidkr = d_dsm_reader->get_cidkr(dsm_msg);
|
||||||
d_osnma_data.d_dsm_kroot_message.reserved1 = get_dsm_reserved1(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.reserved1 = d_dsm_reader->get_dsm_reserved1(dsm_msg);
|
||||||
d_osnma_data.d_dsm_kroot_message.hf = get_hf(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.hf = d_dsm_reader->get_hf(dsm_msg);
|
||||||
d_osnma_data.d_dsm_kroot_message.mf = get_mf(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.mf = d_dsm_reader->get_mf(dsm_msg);
|
||||||
d_osnma_data.d_dsm_kroot_message.ks = get_ks(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.ks = d_dsm_reader->get_ks(dsm_msg);
|
||||||
d_osnma_data.d_dsm_kroot_message.ts = get_ts(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.ts = d_dsm_reader->get_ts(dsm_msg);
|
||||||
d_osnma_data.d_dsm_kroot_message.maclt = get_maclt(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.maclt = d_dsm_reader->get_maclt(dsm_msg);
|
||||||
d_osnma_data.d_dsm_kroot_message.reserved = get_dsm_reserved(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.reserved = d_dsm_reader->get_dsm_reserved(dsm_msg);
|
||||||
d_osnma_data.d_dsm_kroot_message.wn_k = get_wn_k(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.wn_k = d_dsm_reader->get_wn_k(dsm_msg);
|
||||||
d_osnma_data.d_dsm_kroot_message.towh_k = get_towh_k(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.towh_k = d_dsm_reader->get_towh_k(dsm_msg);
|
||||||
d_osnma_data.d_dsm_kroot_message.alpha = get_alpha(dsm_msg);
|
d_osnma_data.d_dsm_kroot_message.alpha = d_dsm_reader->get_alpha(dsm_msg);
|
||||||
|
|
||||||
LOG(WARNING) << "nb_dk=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.nb_dk);
|
LOG(WARNING) << "nb_dk=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.nb_dk);
|
||||||
LOG(WARNING) << "pkid=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.pkid);
|
LOG(WARNING) << "pkid=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.pkid);
|
||||||
@ -245,12 +246,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector<uint8_t>& dsm_msg
|
|||||||
LOG(WARNING) << "towh_k=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.towh_k);
|
LOG(WARNING) << "towh_k=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.towh_k);
|
||||||
LOG(WARNING) << "alpha=" << d_osnma_data.d_dsm_kroot_message.alpha;
|
LOG(WARNING) << "alpha=" << d_osnma_data.d_dsm_kroot_message.alpha;
|
||||||
|
|
||||||
uint16_t bytes_lk = get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8;
|
uint16_t bytes_lk = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8;
|
||||||
d_osnma_data.d_dsm_kroot_message.kroot = get_kroot(dsm_msg, bytes_lk);
|
d_osnma_data.d_dsm_kroot_message.kroot = d_dsm_reader->get_kroot(dsm_msg, bytes_lk);
|
||||||
LOG(WARNING) << "lk_bits=" << static_cast<uint32_t>(get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks));
|
LOG(WARNING) << "lk_bits=" << static_cast<uint32_t>(d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks));
|
||||||
LOG(WARNING) << "lk_bytes=" << static_cast<uint32_t>(bytes_lk);
|
LOG(WARNING) << "lk_bytes=" << static_cast<uint32_t>(bytes_lk);
|
||||||
|
|
||||||
std::string hash_function = get_hash_function(d_osnma_data.d_dsm_kroot_message.hf);
|
std::string hash_function = d_dsm_reader->get_hash_function(d_osnma_data.d_dsm_kroot_message.hf);
|
||||||
|
|
||||||
uint16_t l_ds_bits = 0;
|
uint16_t l_ds_bits = 0;
|
||||||
const auto it4 = OSNMA_TABLE_15.find(hash_function);
|
const auto it4 = OSNMA_TABLE_15.find(hash_function);
|
||||||
@ -266,7 +267,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector<uint8_t>& dsm_msg
|
|||||||
{
|
{
|
||||||
d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + bytes_lk + k];
|
d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + bytes_lk + k];
|
||||||
}
|
}
|
||||||
uint16_t l_dk_bits = get_l_dk_bits(d_osnma_data.d_dsm_kroot_message.nb_dk);
|
uint16_t l_dk_bits = d_dsm_reader->get_l_dk_bits(d_osnma_data.d_dsm_kroot_message.nb_dk);
|
||||||
uint16_t l_dk_bytes = l_dk_bits / 8;
|
uint16_t l_dk_bytes = l_dk_bits / 8;
|
||||||
LOG(WARNING) << "dk_bits=" << static_cast<uint32_t>(l_dk_bits);
|
LOG(WARNING) << "dk_bits=" << static_cast<uint32_t>(l_dk_bits);
|
||||||
LOG(WARNING) << "dk_bytes=" << static_cast<uint32_t>(l_dk_bytes);
|
LOG(WARNING) << "dk_bytes=" << static_cast<uint32_t>(l_dk_bytes);
|
||||||
@ -300,7 +301,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector<uint8_t>& dsm_msg
|
|||||||
}
|
}
|
||||||
for (uint16_t k = 0; k < l_ds_bytes; k++)
|
for (uint16_t k = 0; k < l_ds_bytes; k++)
|
||||||
{
|
{
|
||||||
MSG.push_back(dsm_msg[13 + bytes_lk + k]);
|
MSG.push_back(d_osnma_data.d_dsm_kroot_message.ds[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint8_t> hash = computeSHA256(MSG);
|
std::vector<uint8_t> hash = computeSHA256(MSG);
|
||||||
@ -334,14 +335,14 @@ void osnma_msg_receiver::process_dsm_message(const std::vector<uint8_t>& dsm_msg
|
|||||||
{
|
{
|
||||||
LOG(WARNING) << "OSNMA: DSM-PKR message received.";
|
LOG(WARNING) << "OSNMA: DSM-PKR message received.";
|
||||||
// DSM-PKR message
|
// DSM-PKR message
|
||||||
d_osnma_data.d_dsm_pkr_message.nb_dp = get_number_blocks_index(dsm_msg[0]);
|
d_osnma_data.d_dsm_pkr_message.nb_dp = d_dsm_reader->get_number_blocks_index(dsm_msg[0]);
|
||||||
d_osnma_data.d_dsm_pkr_message.mid = get_mid(dsm_msg);
|
d_osnma_data.d_dsm_pkr_message.mid = d_dsm_reader->get_mid(dsm_msg);
|
||||||
for (int k = 0; k > 128; k++)
|
for (int k = 0; k > 128; k++)
|
||||||
{
|
{
|
||||||
d_osnma_data.d_dsm_pkr_message.itn[k] = dsm_msg[k + 1];
|
d_osnma_data.d_dsm_pkr_message.itn[k] = dsm_msg[k + 1];
|
||||||
}
|
}
|
||||||
d_osnma_data.d_dsm_pkr_message.npkt = get_npkt(dsm_msg);
|
d_osnma_data.d_dsm_pkr_message.npkt = d_dsm_reader->get_npkt(dsm_msg);
|
||||||
d_osnma_data.d_dsm_pkr_message.npktid = get_npktid(dsm_msg);
|
d_osnma_data.d_dsm_pkr_message.npktid = d_dsm_reader->get_npktid(dsm_msg);
|
||||||
|
|
||||||
uint32_t l_npk = 0;
|
uint32_t l_npk = 0;
|
||||||
const auto it = OSNMA_TABLE_5.find(d_osnma_data.d_dsm_pkr_message.npkt);
|
const auto it = OSNMA_TABLE_5.find(d_osnma_data.d_dsm_pkr_message.npkt);
|
||||||
@ -396,9 +397,8 @@ void osnma_msg_receiver::process_dsm_message(const std::vector<uint8_t>& dsm_msg
|
|||||||
void osnma_msg_receiver::read_mack_block(const std::shared_ptr<OSNMA_msg>& osnma_msg)
|
void osnma_msg_receiver::read_mack_block(const std::shared_ptr<OSNMA_msg>& osnma_msg)
|
||||||
{
|
{
|
||||||
uint32_t index = 0;
|
uint32_t index = 0;
|
||||||
for (size_t i = 0; i < osnma_msg->mack.size(); i++)
|
for (uint32_t value : osnma_msg->mack)
|
||||||
{
|
{
|
||||||
uint32_t value = osnma_msg->mack[i];
|
|
||||||
d_mack_message[index] = static_cast<uint8_t>((value & 0xFF000000) >> 6);
|
d_mack_message[index] = static_cast<uint8_t>((value & 0xFF000000) >> 6);
|
||||||
d_mack_message[index + 1] = static_cast<uint8_t>((value & 0x00FF0000) >> 4);
|
d_mack_message[index + 1] = static_cast<uint8_t>((value & 0x00FF0000) >> 4);
|
||||||
d_mack_message[index + 2] = static_cast<uint8_t>((value & 0x0000FF00) >> 2);
|
d_mack_message[index + 2] = static_cast<uint8_t>((value & 0x0000FF00) >> 2);
|
||||||
@ -453,21 +453,21 @@ std::vector<uint8_t> osnma_msg_receiver::computeSHA256(const std::vector<uint8_t
|
|||||||
EVP_MD_CTX* mdCtx = EVP_MD_CTX_new();
|
EVP_MD_CTX* mdCtx = EVP_MD_CTX_new();
|
||||||
if (!EVP_DigestInit_ex(mdCtx, EVP_sha256(), OPENSSL_ENGINE))
|
if (!EVP_DigestInit_ex(mdCtx, EVP_sha256(), OPENSSL_ENGINE))
|
||||||
{
|
{
|
||||||
// printf("Message digest initialization failed.\n");
|
LOG(WARNING) << "OSNMA SHA-256: Message digest initialization failed.";
|
||||||
// EVP_MD_CTX_free(mdCtx);
|
EVP_MD_CTX_free(mdCtx);
|
||||||
// exit(EXIT_FAILURE);
|
return output;
|
||||||
}
|
}
|
||||||
if (!EVP_DigestUpdate(mdCtx, input.data(), input.size()))
|
if (!EVP_DigestUpdate(mdCtx, input.data(), input.size()))
|
||||||
{
|
{
|
||||||
// printf("Message digest update failed.\n");
|
LOG(WARNING) << "OSNMA SHA-256: Message digest update failed.";
|
||||||
// EVP_MD_CTX_free(mdCtx);
|
EVP_MD_CTX_free(mdCtx);
|
||||||
// exit(EXIT_FAILURE);
|
return output;
|
||||||
}
|
}
|
||||||
if (!EVP_DigestFinal_ex(mdCtx, output.data(), &mdLen))
|
if (!EVP_DigestFinal_ex(mdCtx, output.data(), &mdLen))
|
||||||
{
|
{
|
||||||
printf("Message digest finalization failed.\n");
|
LOG(WARNING) << "OSNMA SHA-256: Message digest finalization failed.";
|
||||||
EVP_MD_CTX_free(mdCtx);
|
EVP_MD_CTX_free(mdCtx);
|
||||||
exit(EXIT_FAILURE);
|
return output;
|
||||||
}
|
}
|
||||||
EVP_MD_CTX_free(mdCtx);
|
EVP_MD_CTX_free(mdCtx);
|
||||||
// md = mdVal;
|
// md = mdVal;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "galileo_inav_message.h" // for OSNMA_msg
|
#include "galileo_inav_message.h" // for OSNMA_msg
|
||||||
#include "gnss_block_interface.h" // for gnss_shared_ptr
|
#include "gnss_block_interface.h" // for gnss_shared_ptr
|
||||||
|
#include "gnss_sdr_make_unique.h" // for std::make:unique in C++11
|
||||||
#include "osnma_data.h" // for OSNMA_data
|
#include "osnma_data.h" // for OSNMA_data
|
||||||
#include <gnuradio/block.h> // for gr::block
|
#include <gnuradio/block.h> // for gr::block
|
||||||
#include <pmt/pmt.h> // for pmt::pmt_t
|
#include <pmt/pmt.h> // for pmt::pmt_t
|
||||||
@ -33,6 +34,7 @@
|
|||||||
/** \addtogroup Core_Receiver_Library
|
/** \addtogroup Core_Receiver_Library
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
|
class OSNMA_DSM_Reader;
|
||||||
class osnma_msg_receiver;
|
class osnma_msg_receiver;
|
||||||
|
|
||||||
using osnma_msg_receiver_sptr = gnss_shared_ptr<osnma_msg_receiver>;
|
using osnma_msg_receiver_sptr = gnss_shared_ptr<osnma_msg_receiver>;
|
||||||
@ -69,6 +71,8 @@ private:
|
|||||||
|
|
||||||
std::vector<uint8_t> computeSHA256(const std::vector<uint8_t>& input);
|
std::vector<uint8_t> computeSHA256(const std::vector<uint8_t>& input);
|
||||||
|
|
||||||
|
std::unique_ptr<OSNMA_DSM_Reader> d_dsm_reader;
|
||||||
|
|
||||||
std::array<std::array<uint8_t, 256>, 16> d_dsm_message{};
|
std::array<std::array<uint8_t, 256>, 16> d_dsm_message{};
|
||||||
std::array<std::array<uint8_t, 16>, 16> d_dsm_id_received{};
|
std::array<std::array<uint8_t, 16>, 16> d_dsm_id_received{};
|
||||||
std::array<uint16_t, 16> d_number_of_blocks{};
|
std::array<uint16_t, 16> d_number_of_blocks{};
|
||||||
|
@ -27,8 +27,9 @@ set(SYSTEM_PARAMETERS_SOURCES
|
|||||||
glonass_gnav_ephemeris.cc
|
glonass_gnav_ephemeris.cc
|
||||||
glonass_gnav_utc_model.cc
|
glonass_gnav_utc_model.cc
|
||||||
glonass_gnav_navigation_message.cc
|
glonass_gnav_navigation_message.cc
|
||||||
osnma_data.cc
|
|
||||||
reed_solomon.cc
|
reed_solomon.cc
|
||||||
|
osnma_data.cc
|
||||||
|
osnma_dsm_reader.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SYSTEM_PARAMETERS_HEADERS
|
set(SYSTEM_PARAMETERS_HEADERS
|
||||||
@ -92,6 +93,7 @@ set(SYSTEM_PARAMETERS_HEADERS
|
|||||||
galileo_has_page.h
|
galileo_has_page.h
|
||||||
Galileo_OSNMA.h
|
Galileo_OSNMA.h
|
||||||
osnma_data.h
|
osnma_data.h
|
||||||
|
osnma_dsm_reader.h
|
||||||
)
|
)
|
||||||
|
|
||||||
list(SORT SYSTEM_PARAMETERS_HEADERS)
|
list(SORT SYSTEM_PARAMETERS_HEADERS)
|
||||||
|
@ -149,209 +149,6 @@ const std::unordered_map<std::string, uint16_t> OSNMA_TABLE_15 = {
|
|||||||
{std::string("SHA-256"), 512},
|
{std::string("SHA-256"), 512},
|
||||||
{std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits}
|
{std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits}
|
||||||
|
|
||||||
#if __cplusplus == 201103L
|
|
||||||
constexpr std::uint8_t mask_nmas{0xC0};
|
|
||||||
constexpr std::uint8_t mask_cid{0x30};
|
|
||||||
constexpr std::uint8_t mask_cpks{0x07};
|
|
||||||
constexpr std::uint8_t mask_nma_header_reserved{0x01};
|
|
||||||
constexpr std::uint8_t mask_dsm_id{0xF0};
|
|
||||||
constexpr std::uint8_t mask_dsm_block_id{0x0F};
|
|
||||||
constexpr std::uint8_t mask_dsm_number_blocks{0xF0};
|
|
||||||
constexpr std::uint8_t mask_dsm_pkid{0x0F};
|
|
||||||
constexpr std::uint8_t mask_dsm_cidkr{0xC0};
|
|
||||||
constexpr std::uint8_t mask_dsm_reserved1{0x30};
|
|
||||||
constexpr std::uint8_t mask_dsm_hf{0x0C};
|
|
||||||
constexpr std::uint8_t mask_dsm_mf{0x03};
|
|
||||||
constexpr std::uint8_t mask_dsm_ks{0xF0};
|
|
||||||
constexpr std::uint8_t mask_dsm_ts{0x0F};
|
|
||||||
constexpr std::uint8_t mask_dsm_reserved{0xF0};
|
|
||||||
constexpr std::uint8_t mask_dsm_wk_k_msbyte{0x0F};
|
|
||||||
constexpr std::uint8_t mask_dsm_mid{0x0F};
|
|
||||||
constexpr std::uint8_t mask_dsm_npkt{0xF0};
|
|
||||||
constexpr std::uint8_t mask_dsm_npktid{0x0F};
|
|
||||||
#else
|
|
||||||
constexpr std::uint8_t mask_nmas{0b1100'0000};
|
|
||||||
constexpr std::uint8_t mask_cid{0b0011'0000};
|
|
||||||
constexpr std::uint8_t mask_cpks{0b0000'1110};
|
|
||||||
constexpr std::uint8_t mask_nma_header_reserved{0b0000'0001};
|
|
||||||
constexpr std::uint8_t mask_dsm_id{0b1111'0000};
|
|
||||||
constexpr std::uint8_t mask_dsm_block_id{0b0000'1111};
|
|
||||||
constexpr std::uint8_t mask_dsm_number_blocks{0b1111'0000};
|
|
||||||
constexpr std::uint8_t mask_dsm_pkid{0b0000'1111};
|
|
||||||
constexpr std::uint8_t mask_dsm_cidkr{0b1100'0000};
|
|
||||||
constexpr std::uint8_t mask_dsm_reserved1{0b0011'0000};
|
|
||||||
constexpr std::uint8_t mask_dsm_hf{0b0000'1100};
|
|
||||||
constexpr std::uint8_t mask_dsm_mf{0b0000'0011};
|
|
||||||
constexpr std::uint8_t mask_dsm_ks{0b1111'0000};
|
|
||||||
constexpr std::uint8_t mask_dsm_ts{0b0000'1111};
|
|
||||||
constexpr std::uint8_t mask_dsm_reserved{0b1111'0000};
|
|
||||||
constexpr std::uint8_t mask_dsm_wk_k_msbyte{0b0000'1111};
|
|
||||||
constexpr std::uint8_t mask_dsm_mid{0b0000'1111};
|
|
||||||
constexpr std::uint8_t mask_dsm_npkt{0b1111'0000};
|
|
||||||
constexpr std::uint8_t mask_dsm_npktid{0b0000'1111};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// // hf = (dsm_msg[1] & 0b00001100) >> 2;
|
|
||||||
uint8_t get_nmas(uint8_t nma_header)
|
|
||||||
{
|
|
||||||
return (nma_header & mask_nmas) >> 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_cid(uint8_t nma_header)
|
|
||||||
{
|
|
||||||
return (nma_header & mask_cid) >> 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_cpks(uint8_t nma_header)
|
|
||||||
{
|
|
||||||
return (nma_header & mask_cpks) >> 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool get_nma_header_reserved(uint8_t nma_header)
|
|
||||||
{
|
|
||||||
return ((nma_header & mask_nma_header_reserved) ? true : false);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_dsm_id(uint8_t dsm_header)
|
|
||||||
{
|
|
||||||
return (dsm_header & mask_dsm_id) >> 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_dsm_block_id(uint8_t dsm_header)
|
|
||||||
{
|
|
||||||
return dsm_header & mask_dsm_block_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_number_blocks_index(uint8_t dsm_msg_0)
|
|
||||||
{
|
|
||||||
return (dsm_msg_0 & mask_dsm_number_blocks) >> 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_pkid(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return (dsm_msg[0] & mask_dsm_pkid);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_cidkr(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return (dsm_msg[1] & mask_dsm_cidkr) >> 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_dsm_reserved1(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return (dsm_msg[1] & mask_dsm_reserved1) >> 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_hf(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return (dsm_msg[1] & mask_dsm_hf) >> 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_mf(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return (dsm_msg[1] & mask_dsm_mf);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_ks(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return (dsm_msg[2] & mask_dsm_ks) >> 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_ts(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return (dsm_msg[2] & mask_dsm_ts);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_maclt(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return dsm_msg[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_dsm_reserved(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return (dsm_msg[4] & mask_dsm_reserved) >> 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t get_wn_k(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return (static_cast<uint16_t>((dsm_msg[4] & mask_dsm_wk_k_msbyte) << 8) + static_cast<uint16_t>(dsm_msg[5]));
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_towh_k(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return dsm_msg[6];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t get_alpha(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
uint64_t alpha = (static_cast<uint64_t>(dsm_msg[8]) << 32) +
|
|
||||||
(static_cast<uint64_t>(dsm_msg[9]) << 24) +
|
|
||||||
(static_cast<uint64_t>(dsm_msg[10]) << 16) +
|
|
||||||
(static_cast<uint64_t>(dsm_msg[11]) << 8) +
|
|
||||||
static_cast<uint64_t>(dsm_msg[12]);
|
|
||||||
return alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t get_l_dk_bits(uint8_t nb_dk)
|
|
||||||
{
|
|
||||||
const auto it = OSNMA_TABLE_7.find(nb_dk);
|
|
||||||
if (it != OSNMA_TABLE_7.cend())
|
|
||||||
{
|
|
||||||
return it->second.second;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t get_lk_bits(uint8_t ks)
|
|
||||||
{
|
|
||||||
const auto it = OSNMA_TABLE_10.find(ks);
|
|
||||||
if (it != OSNMA_TABLE_10.cend())
|
|
||||||
{
|
|
||||||
return it->second;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<uint8_t> get_kroot(const std::vector<uint8_t>& dsm_msg, uint16_t bytes_lk)
|
|
||||||
{
|
|
||||||
std::vector<uint8_t> kroot = std::vector<uint8_t>(bytes_lk, 0);
|
|
||||||
if (dsm_msg.size() > static_cast<uint64_t>(13 + bytes_lk))
|
|
||||||
{
|
|
||||||
for (uint16_t k = 0; k < bytes_lk; k++)
|
|
||||||
{
|
|
||||||
kroot[k] = dsm_msg[13 + k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return kroot;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string get_hash_function(uint8_t hf)
|
|
||||||
{
|
|
||||||
std::string hash_;
|
|
||||||
const auto it = OSNMA_TABLE_8.find(hf);
|
|
||||||
if (it != OSNMA_TABLE_8.cend())
|
|
||||||
{
|
|
||||||
hash_ = it->second;
|
|
||||||
}
|
|
||||||
return hash_;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_mid(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return (dsm_msg[0] & mask_dsm_mid);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_npkt(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return ((dsm_msg[129] & mask_dsm_npkt) >> 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t get_npktid(const std::vector<uint8_t>& dsm_msg)
|
|
||||||
{
|
|
||||||
return (dsm_msg[129] & mask_dsm_npktid);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
/** \} */
|
/** \} */
|
||||||
#endif // GNSS_SDR_GALILEO_OSNMA_H
|
#endif // GNSS_SDR_GALILEO_OSNMA_H
|
204
src/core/system_parameters/osnma_dsm_reader.cc
Normal file
204
src/core/system_parameters/osnma_dsm_reader.cc
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
/*!
|
||||||
|
* \file osnma_dsm_reader.cc
|
||||||
|
* \brief Class for reading OSNMA DSM messages
|
||||||
|
* \author Carles Fernandez-Prades, 2023 cfernandez(at)cttc.es
|
||||||
|
*
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors)
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "osnma_dsm_reader.h"
|
||||||
|
#include "Galileo_OSNMA.h"
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_nmas(uint8_t nma_header) const
|
||||||
|
{
|
||||||
|
return (nma_header & mask_nmas) >> 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_cid(uint8_t nma_header) const
|
||||||
|
{
|
||||||
|
return (nma_header & mask_cid) >> 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_cpks(uint8_t nma_header) const
|
||||||
|
{
|
||||||
|
return (nma_header & mask_cpks) >> 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool OSNMA_DSM_Reader::get_nma_header_reserved(uint8_t nma_header) const
|
||||||
|
{
|
||||||
|
return ((nma_header & mask_nma_header_reserved) ? true : false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_dsm_id(uint8_t dsm_header) const
|
||||||
|
{
|
||||||
|
return (dsm_header & mask_dsm_id) >> 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_dsm_block_id(uint8_t dsm_header) const
|
||||||
|
{
|
||||||
|
return dsm_header & mask_dsm_block_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_number_blocks_index(uint8_t dsm_msg_0) const
|
||||||
|
{
|
||||||
|
return (dsm_msg_0 & mask_dsm_number_blocks) >> 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_pkid(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return (dsm_msg[0] & mask_dsm_pkid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_cidkr(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return (dsm_msg[1] & mask_dsm_cidkr) >> 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_dsm_reserved1(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return (dsm_msg[1] & mask_dsm_reserved1) >> 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_hf(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return (dsm_msg[1] & mask_dsm_hf) >> 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_mf(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return (dsm_msg[1] & mask_dsm_mf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_ks(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return (dsm_msg[2] & mask_dsm_ks) >> 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_ts(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return (dsm_msg[2] & mask_dsm_ts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_maclt(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return dsm_msg[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_dsm_reserved(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return (dsm_msg[4] & mask_dsm_reserved) >> 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t OSNMA_DSM_Reader::get_wn_k(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return (static_cast<uint16_t>((dsm_msg[4] & mask_dsm_wk_k_msbyte) << 8) + static_cast<uint16_t>(dsm_msg[5]));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_towh_k(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return dsm_msg[6];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint64_t OSNMA_DSM_Reader::get_alpha(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
uint64_t alpha = (static_cast<uint64_t>(dsm_msg[8]) << 40) +
|
||||||
|
(static_cast<uint64_t>(dsm_msg[9]) << 32) +
|
||||||
|
(static_cast<uint64_t>(dsm_msg[10]) << 24) +
|
||||||
|
(static_cast<uint64_t>(dsm_msg[11]) << 16) +
|
||||||
|
(static_cast<uint64_t>(dsm_msg[12]) << 8) +
|
||||||
|
(static_cast<uint64_t>(dsm_msg[13]));
|
||||||
|
return alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t OSNMA_DSM_Reader::get_l_dk_bits(uint8_t nb_dk) const
|
||||||
|
{
|
||||||
|
const auto it = OSNMA_TABLE_7.find(nb_dk);
|
||||||
|
if (it != OSNMA_TABLE_7.cend())
|
||||||
|
{
|
||||||
|
return it->second.second;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t OSNMA_DSM_Reader::get_lk_bits(uint8_t ks) const
|
||||||
|
{
|
||||||
|
const auto it = OSNMA_TABLE_10.find(ks);
|
||||||
|
if (it != OSNMA_TABLE_10.cend())
|
||||||
|
{
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<uint8_t> OSNMA_DSM_Reader::get_kroot(const std::vector<uint8_t>& dsm_msg, uint16_t bytes_lk) const
|
||||||
|
{
|
||||||
|
std::vector<uint8_t> kroot = std::vector<uint8_t>(bytes_lk, 0);
|
||||||
|
if (dsm_msg.size() > static_cast<uint64_t>(13 + bytes_lk))
|
||||||
|
{
|
||||||
|
for (uint16_t k = 0; k < bytes_lk; k++)
|
||||||
|
{
|
||||||
|
kroot[k] = dsm_msg[13 + k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return kroot;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string OSNMA_DSM_Reader::get_hash_function(uint8_t hf) const
|
||||||
|
{
|
||||||
|
std::string hash_;
|
||||||
|
const auto it = OSNMA_TABLE_8.find(hf);
|
||||||
|
if (it != OSNMA_TABLE_8.cend())
|
||||||
|
{
|
||||||
|
hash_ = it->second;
|
||||||
|
}
|
||||||
|
return hash_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_mid(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return (dsm_msg[0] & mask_dsm_mid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_npkt(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return ((dsm_msg[129] & mask_dsm_npkt) >> 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t OSNMA_DSM_Reader::get_npktid(const std::vector<uint8_t>& dsm_msg) const
|
||||||
|
{
|
||||||
|
return (dsm_msg[129] & mask_dsm_npktid);
|
||||||
|
}
|
109
src/core/system_parameters/osnma_dsm_reader.h
Normal file
109
src/core/system_parameters/osnma_dsm_reader.h
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/*!
|
||||||
|
* \file osnma_dsm_reader.h
|
||||||
|
* \brief Class for reading OSNMA DSM messages
|
||||||
|
* \author Carles Fernandez-Prades, 2023 cfernandez(at)cttc.es
|
||||||
|
*
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors)
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_OSNMA_DSM_READER_H
|
||||||
|
#define GNSS_SDR_OSNMA_DSM_READER_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
/** \addtogroup Core
|
||||||
|
* \{ */
|
||||||
|
/** \addtogroup System_Parameters
|
||||||
|
* \{ */
|
||||||
|
|
||||||
|
class OSNMA_DSM_Reader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OSNMA_DSM_Reader() = default;
|
||||||
|
uint8_t get_nmas(uint8_t nma_header) const;
|
||||||
|
uint8_t get_cid(uint8_t nma_header) const;
|
||||||
|
uint8_t get_cpks(uint8_t nma_header) const;
|
||||||
|
bool get_nma_header_reserved(uint8_t nma_header) const;
|
||||||
|
|
||||||
|
uint8_t get_dsm_id(uint8_t dsm_header) const;
|
||||||
|
uint8_t get_dsm_block_id(uint8_t dsm_header) const;
|
||||||
|
|
||||||
|
uint8_t get_number_blocks_index(uint8_t dsm_msg_0) const;
|
||||||
|
uint8_t get_pkid(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint8_t get_cidkr(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint8_t get_dsm_reserved1(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint8_t get_hf(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint8_t get_mf(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint8_t get_ks(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint8_t get_ts(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint8_t get_maclt(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint8_t get_dsm_reserved(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint16_t get_wn_k(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint8_t get_towh_k(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint64_t get_alpha(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint16_t get_l_dk_bits(uint8_t nb_dk) const;
|
||||||
|
uint16_t get_lk_bits(uint8_t ks) const;
|
||||||
|
std::vector<uint8_t> get_kroot(const std::vector<uint8_t>& dsm_msg, uint16_t bytes_lk) const;
|
||||||
|
std::string get_hash_function(uint8_t hf) const;
|
||||||
|
|
||||||
|
uint8_t get_mid(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint8_t get_npkt(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
uint8_t get_npktid(const std::vector<uint8_t>& dsm_msg) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
#if __cplusplus == 201103L
|
||||||
|
static constexpr std::uint8_t mask_nmas{0xC0};
|
||||||
|
static constexpr std::uint8_t mask_cid{0x30};
|
||||||
|
static constexpr std::uint8_t mask_cpks{0x07};
|
||||||
|
static constexpr std::uint8_t mask_nma_header_reserved{0x01};
|
||||||
|
static constexpr std::uint8_t mask_dsm_id{0xF0};
|
||||||
|
static constexpr std::uint8_t mask_dsm_block_id{0x0F};
|
||||||
|
static constexpr std::uint8_t mask_dsm_number_blocks{0xF0};
|
||||||
|
static constexpr std::uint8_t mask_dsm_pkid{0x0F};
|
||||||
|
static constexpr std::uint8_t mask_dsm_cidkr{0xC0};
|
||||||
|
static constexpr std::uint8_t mask_dsm_reserved1{0x30};
|
||||||
|
static constexpr std::uint8_t mask_dsm_hf{0x0C};
|
||||||
|
static constexpr std::uint8_t mask_dsm_mf{0x03};
|
||||||
|
static constexpr std::uint8_t mask_dsm_ks{0xF0};
|
||||||
|
static constexpr std::uint8_t mask_dsm_ts{0x0F};
|
||||||
|
static constexpr std::uint8_t mask_dsm_reserved{0xF0};
|
||||||
|
static constexpr std::uint8_t mask_dsm_wk_k_msbyte{0x0F};
|
||||||
|
static constexpr std::uint8_t mask_dsm_mid{0x0F};
|
||||||
|
static constexpr std::uint8_t mask_dsm_npkt{0xF0};
|
||||||
|
static constexpr std::uint8_t mask_dsm_npktid{0x0F};
|
||||||
|
#else
|
||||||
|
static constexpr std::uint8_t mask_nmas{0b1100'0000};
|
||||||
|
static constexpr std::uint8_t mask_cid{0b0011'0000};
|
||||||
|
static constexpr std::uint8_t mask_cpks{0b0000'1110};
|
||||||
|
static constexpr std::uint8_t mask_nma_header_reserved{0b0000'0001};
|
||||||
|
static constexpr std::uint8_t mask_dsm_id{0b1111'0000};
|
||||||
|
static constexpr std::uint8_t mask_dsm_block_id{0b0000'1111};
|
||||||
|
static constexpr std::uint8_t mask_dsm_number_blocks{0b1111'0000};
|
||||||
|
static constexpr std::uint8_t mask_dsm_pkid{0b0000'1111};
|
||||||
|
static constexpr std::uint8_t mask_dsm_cidkr{0b1100'0000};
|
||||||
|
static constexpr std::uint8_t mask_dsm_reserved1{0b0011'0000};
|
||||||
|
static constexpr std::uint8_t mask_dsm_hf{0b0000'1100};
|
||||||
|
static constexpr std::uint8_t mask_dsm_mf{0b0000'0011};
|
||||||
|
static constexpr std::uint8_t mask_dsm_ks{0b1111'0000};
|
||||||
|
static constexpr std::uint8_t mask_dsm_ts{0b0000'1111};
|
||||||
|
static constexpr std::uint8_t mask_dsm_reserved{0b1111'0000};
|
||||||
|
static constexpr std::uint8_t mask_dsm_wk_k_msbyte{0b0000'1111};
|
||||||
|
static constexpr std::uint8_t mask_dsm_mid{0b0000'1111};
|
||||||
|
static constexpr std::uint8_t mask_dsm_npkt{0b1111'0000};
|
||||||
|
static constexpr std::uint8_t mask_dsm_npktid{0b0000'1111};
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
/** \} */
|
||||||
|
#endif // GNSS_SDR_OSNMA_DSM_READER_H
|
Loading…
Reference in New Issue
Block a user