1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-30 22:56:22 +00:00

Fix internal communications

This commit is contained in:
Carles Fernandez 2023-05-23 14:11:20 +02:00
parent 9f2264a970
commit 6408d74288
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 18 additions and 11 deletions

View File

@ -52,6 +52,7 @@
#include "monitor_pvt.h"
#include "monitor_pvt_udp_sink.h"
#include "nmea_printer.h"
#include "osnma_data.h"
#include "pvt_conf.h"
#include "rinex_printer.h"
#include "rtcm_printer.h"
@ -1651,7 +1652,10 @@ void rtklib_pvt_gs::msg_handler_osnma(const pmt::pmt_t& msg)
try
{
const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code();
// Process NMA data
if (msg_type_hash_code == typeid(std::shared_ptr<OSNMA_data>).hash_code())
{
// Act according to NMA data
}
}
catch (const wht::bad_any_cast& e)
{

View File

@ -70,13 +70,14 @@ osnma_msg_receiver::osnma_msg_receiver() : gr::block("osnma_msg_receiver",
void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg)
{
gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_osnma function called by the scheduler
// requires mutex with msg_handler_osnma function called by the scheduler
gr::thread::scoped_lock lock(d_setlock);
try
{
const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code();
if (msg_type_hash_code == typeid(OSNMA_msg).hash_code())
if (msg_type_hash_code == typeid(std::shared_ptr<OSNMA_msg>).hash_code())
{
const auto nma_msg = wht::any_cast<OSNMA_msg>(pmt::any_ref(msg));
const auto nma_msg = wht::any_cast<std::shared_ptr<OSNMA_msg>>(pmt::any_ref(msg));
process_osnma_message(nma_msg);
}
else
@ -100,9 +101,9 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg)
}
void osnma_msg_receiver::process_osnma_message(const OSNMA_msg& osnma_msg)
void osnma_msg_receiver::process_osnma_message(std::shared_ptr<OSNMA_msg> osnma_msg)
{
auto hkroot_msg = osnma_msg.hkroot;
const auto hkroot_msg = osnma_msg->hkroot;
read_nma_header(hkroot_msg[0]);
read_dsm_header(hkroot_msg[1]);
}
@ -120,5 +121,5 @@ void osnma_msg_receiver::read_nma_header(uint8_t nma_header)
void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header)
{
d_osnma_data.d_dsm_header.dsm_id = (dsm_header & 0b11110000) >> 4;
d_osnma_data.d_dsm_header.dsm_block_id = dsm_header & 0b00001111;
d_osnma_data.d_dsm_header.dsm_block_id = dsm_header & 0b00001111; // BID
}

View File

@ -21,9 +21,10 @@
#include "galileo_inav_message.h" // for OSNMA_msg
#include "gnss_block_interface.h" // for gnss_shared_ptr
#include "osnma_data.h"
#include "osnma_data.h" // for OSNMA_data
#include <gnuradio/block.h> // for gr::block
#include <pmt/pmt.h> // for pmt::pmt_t
#include <memory> // for std::shared_ptr
/** \addtogroup Core
@ -53,9 +54,10 @@ private:
osnma_msg_receiver();
void msg_handler_osnma(const pmt::pmt_t& msg);
void process_osnma_message(const OSNMA_msg& osnma_msg);
void process_osnma_message(std::shared_ptr<OSNMA_msg> osnma_msg);
void read_nma_header(uint8_t nma_header);
void read_dsm_header(uint8_t dsm_header);
OSNMA_data d_osnma_data{};
bool d_new_data{false};
};