1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-08-05 13:23:48 +00:00

Add work on OSNMA receiver

This commit is contained in:
Carles Fernandez 2023-06-08 17:45:22 +02:00
parent 46442ee0fc
commit 9b560b6da2
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 35 additions and 23 deletions

View File

@ -511,26 +511,7 @@ 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());
uint8_t nma_status = (tmp_obj->hkroot[0] & 0xC0) >> 6;
this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj));
std::string nma_status_string;
if (nma_status == 0)
{
nma_status_string = std::string("(Reserved mode)");
}
else if (nma_status == 1)
{
nma_status_string = std::string("(Test mode)");
}
else if (nma_status == 2)
{
nma_status_string = std::string("(Operational mode)");
}
else
{
nma_status_string = std::string("(Do not use mode)");
}
std::cout << "Galileo OSNMA message " << nma_status_string << " received in channel " << d_channel << " from satellite " << d_satellite << std::endl;
} }
} }

View File

@ -20,6 +20,7 @@
#include "osnma_msg_receiver.h" #include "osnma_msg_receiver.h"
#include "Galileo_OSNMA.h" #include "Galileo_OSNMA.h"
#include "gnss_crypto.h" #include "gnss_crypto.h"
#include "gnss_satellite.h"
#include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #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
@ -85,13 +86,14 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg)
if (msg_type_hash_code == typeid(std::shared_ptr<OSNMA_msg>).hash_code()) if (msg_type_hash_code == typeid(std::shared_ptr<OSNMA_msg>).hash_code())
{ {
const auto nma_msg = wht::any_cast<std::shared_ptr<OSNMA_msg>>(pmt::any_ref(msg)); const auto nma_msg = wht::any_cast<std::shared_ptr<OSNMA_msg>>(pmt::any_ref(msg));
std::cout << "Galileo OSNMA: Subframe received at " const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN);
std::cout << "Galileo OSNMA: Subframe received starting at "
<< "WN=" << "WN="
<< nma_msg->WN_sf0 << nma_msg->WN_sf0
<< ", TOW=" << ", TOW="
<< nma_msg->TOW_sf0 << nma_msg->TOW_sf0
<< ", from SVID=" << ", from satellite "
<< nma_msg->PRN << sat
<< std::endl; << std::endl;
process_osnma_message(nma_msg); process_osnma_message(nma_msg);
} }
@ -336,8 +338,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector<uint8_t>& dsm_msg
std::cout << "Galileo OSNMA: KROOT with CID=" << static_cast<uint32_t>(d_osnma_data.d_nma_header.cid) std::cout << "Galileo OSNMA: KROOT with CID=" << static_cast<uint32_t>(d_osnma_data.d_nma_header.cid)
<< ", PKID=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.pkid) << ", PKID=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.pkid)
<< ", WN=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.wn_k) << ", WN=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.wn_k)
<< ", TOW=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.towh_k) << ", TOW=" << static_cast<uint32_t>(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600
<< " validated" << std::endl; << " validated" << std::endl;
std::cout << "Galileo OSNMA: NMAS is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", "
<< " Chain in force is " << static_cast<uint32_t>(d_osnma_data.d_nma_header.cid) << ", "
<< "CPSK is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl;
} }
// Validate signature // Validate signature
} }

View File

@ -202,3 +202,27 @@ uint8_t OSNMA_DSM_Reader::get_npktid(const std::vector<uint8_t>& dsm_msg) const
{ {
return (dsm_msg[129] & mask_dsm_npktid); return (dsm_msg[129] & mask_dsm_npktid);
} }
std::string OSNMA_DSM_Reader::get_nmas_status(uint8_t nmas) const
{
std::string status_;
const auto it = OSNMA_TABLE_1.find(nmas);
if (it != OSNMA_TABLE_1.cend())
{
status_ = it->second;
}
return status_;
}
std::string OSNMA_DSM_Reader::get_cpks_status(uint8_t cpks) const
{
std::string status_;
const auto it = OSNMA_TABLE_2.find(cpks);
if (it != OSNMA_TABLE_2.cend())
{
status_ = it->second;
}
return status_;
}

View File

@ -55,6 +55,8 @@ public:
uint16_t get_lk_bits(uint8_t ks) 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::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; std::string get_hash_function(uint8_t hf) const;
std::string get_nmas_status(uint8_t nmas) const;
std::string get_cpks_status(uint8_t cpks) const;
uint8_t get_mid(const std::vector<uint8_t>& dsm_msg) 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_npkt(const std::vector<uint8_t>& dsm_msg) const;