mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-12 11:10:33 +00:00
Clang Tidy fixes
This commit is contained in:
parent
eefa3b3aa7
commit
960e76e3a0
@ -1013,7 +1013,6 @@ void osnma_msg_receiver::process_mack_message()
|
||||
LOG(WARNING) << "Galileo OSNMA: MACK cannot be processed, "
|
||||
<< "no Kroot nor TESLA key available.";
|
||||
return; // early return, cannot proceed further without one of the two verified. this equals to having Kroot but no TESLa key yet.
|
||||
|
||||
}
|
||||
// verify tesla key and add it to the container of verified keys if successful
|
||||
if (d_tesla_keys.find(d_osnma_data.d_nav_data.get_tow_sf0()) == d_tesla_keys.end()) // check if already available => no need to verify
|
||||
@ -1921,13 +1920,13 @@ std::vector<MACK_tag_and_info> osnma_msg_receiver::verify_macseq_new(const MACK_
|
||||
}
|
||||
}
|
||||
|
||||
void osnma_msg_receiver::send_data_to_pvt(std::vector<OSNMA_NavData> data)
|
||||
void osnma_msg_receiver::send_data_to_pvt(const std::vector<OSNMA_NavData>& data)
|
||||
{
|
||||
if (!data.empty())
|
||||
{
|
||||
for (size_t i = 0; i < data.size(); i++)
|
||||
for (auto & i : data)
|
||||
{
|
||||
const auto tmp_obj = std::make_shared<OSNMA_NavData>(data[i]);
|
||||
const auto tmp_obj = std::make_shared<OSNMA_NavData>(i);
|
||||
this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ private:
|
||||
void remove_verified_tags();
|
||||
void control_tags_awaiting_verify_size();
|
||||
void display_data();
|
||||
void send_data_to_pvt(std::vector<OSNMA_NavData>);
|
||||
void send_data_to_pvt(const std::vector<OSNMA_NavData>& data);
|
||||
|
||||
bool verify_tesla_key(std::vector<uint8_t>& key, uint32_t TOW);
|
||||
bool verify_tag(Tag& tag) const;
|
||||
|
@ -897,8 +897,9 @@ void Gnss_Crypto::set_public_key(const std::vector<uint8_t>& publicKey)
|
||||
param_bld = OSSL_PARAM_BLD_new();
|
||||
if (param_bld != nullptr &&
|
||||
OSSL_PARAM_BLD_push_utf8_string(param_bld, "group", (publicKey.size() == 33) ? "prime256v1" : "secp521r1", 0) &&
|
||||
OSSL_PARAM_BLD_push_octet_string(param_bld, "pub", publicKey.data(), publicKey.size()))
|
||||
OSSL_PARAM_BLD_push_octet_string(param_bld, "pub", publicKey.data(), publicKey.size())) {
|
||||
params = OSSL_PARAM_BLD_to_param(param_bld);
|
||||
}
|
||||
|
||||
ctx = EVP_PKEY_CTX_new_from_name(nullptr, "EC", nullptr);
|
||||
if (ctx == nullptr || params == nullptr || EVP_PKEY_fromdata_init(ctx) <= 0 || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_PUBLIC_KEY, params) <= 0)
|
||||
@ -1192,7 +1193,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath)
|
||||
|
||||
// store the key type - needed for the Kroot in case no DSM-PKR available
|
||||
// TODO - only way I have found to find the curve type
|
||||
auto ec_key = EVP_PKEY_get0_EC_KEY(pubkey);
|
||||
const auto *const ec_key = EVP_PKEY_get0_EC_KEY(pubkey);
|
||||
const EC_GROUP *group = EC_KEY_get0_group(ec_key);
|
||||
int nid = EC_GROUP_get_curve_name(group);
|
||||
if (nid == NID_X9_62_prime256v1) {
|
||||
|
@ -19,7 +19,7 @@
|
||||
uint32_t Tag::id_counter = 0;
|
||||
uint32_t OSNMA_NavData::id_counter = 0;
|
||||
|
||||
bool OSNMA_NavData::add_nav_data(std::string nav_data)
|
||||
bool OSNMA_NavData::add_nav_data(const std::string& nav_data)
|
||||
{
|
||||
if (nav_data.size() == 549)
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ class OSNMA_NavData
|
||||
public:
|
||||
OSNMA_NavData(): nav_data_id(id_counter++){}
|
||||
bool have_this_bits(std::string nav_data);
|
||||
bool add_nav_data(std::string nav_data);
|
||||
bool add_nav_data(const std::string& nav_data);
|
||||
void update_last_received_timestamp(uint32_t TOW);
|
||||
const uint32_t nav_data_id;
|
||||
uint32_t verified_bits{0};
|
||||
|
@ -39,7 +39,6 @@ public:
|
||||
std::vector<uint8_t> convert_from_hex_string(const std::string& hex_string) const; // TODO remove similar function in gnss_crypto
|
||||
|
||||
std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0, 0, 0, 0, 0};
|
||||
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_OSNMA_HELPER_H
|
||||
|
@ -29,7 +29,7 @@
|
||||
* @param PRNd The satellite ID.
|
||||
* @param TOW The TOW of the received data.
|
||||
*/
|
||||
void OSNMA_nav_data_Manager::add_navigation_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW)
|
||||
void OSNMA_nav_data_Manager::add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW)
|
||||
{
|
||||
if (not have_nav_data(nav_bits, PRNd, TOW))
|
||||
{
|
||||
@ -52,18 +52,18 @@ void OSNMA_nav_data_Manager::update_nav_data(const std::multimap<uint32_t, Tag>&
|
||||
if (have_PRNd_nav_data(tag.second.PRN_d))
|
||||
{
|
||||
std::map<uint32_t, OSNMA_NavData> tow_map = _satellite_nav_data.find(tag.second.PRN_d)->second;
|
||||
for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset
|
||||
for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset
|
||||
{
|
||||
std::string nav_data;
|
||||
if (tag.second.ADKD == 0 || tag.second.ADKD == 12){
|
||||
nav_data = tow_it->second.get_ephemeris_data();
|
||||
nav_data = tow_it.second.get_ephemeris_data();
|
||||
}
|
||||
else if (tag.second.ADKD == 4){
|
||||
nav_data = tow_it->second.get_utc_data();
|
||||
nav_data = tow_it.second.get_utc_data();
|
||||
}
|
||||
// find associated OSNMA_NavData
|
||||
if (tag.second.nav_data == nav_data){
|
||||
_satellite_nav_data[tag.second.PRN_d][tow_it->first].verified_bits += tag_size;
|
||||
_satellite_nav_data[tag.second.PRN_d][tow_it.first].verified_bits += tag_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,7 +99,7 @@ bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t
|
||||
if (it != _satellite_nav_data.cend())
|
||||
{
|
||||
const auto it2 = it->second.find(TOW);
|
||||
if (it2 != it->second.cend() && it->second[TOW].get_ephemeris_data() != "")
|
||||
if (it2 != it->second.cend() && !it->second[TOW].get_ephemeris_data().empty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -111,7 +111,7 @@ bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t
|
||||
if (it != _satellite_nav_data.cend())
|
||||
{
|
||||
const auto it2 = it->second.find(TOW);
|
||||
if (it2 != it->second.cend() && it->second[TOW].get_utc_data() != "")
|
||||
if (it2 != it->second.cend() && !it->second[TOW].get_utc_data().empty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -133,21 +133,21 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag)
|
||||
|
||||
// satellite was found, check if TOW exists in inner map
|
||||
std::map<uint32_t, OSNMA_NavData> tow_map = prn_it->second;
|
||||
for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset
|
||||
for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset
|
||||
{
|
||||
// Check if current key (TOW) fulfills condition
|
||||
if ((tag.TOW - 30 * tag.cop) <= tow_it->first && tow_it->first <= tag.TOW - 30)
|
||||
if ((tag.TOW - 30 * tag.cop) <= tow_it.first && tow_it.first <= tag.TOW - 30)
|
||||
{
|
||||
if (tag.ADKD == 0 || tag.ADKD == 12)
|
||||
{
|
||||
if (tow_it->second.get_ephemeris_data() != ""){
|
||||
return tow_it->second.get_ephemeris_data();
|
||||
if (!tow_it.second.get_ephemeris_data().empty()){
|
||||
return tow_it.second.get_ephemeris_data();
|
||||
}
|
||||
}
|
||||
else if(tag.ADKD == 4)
|
||||
{
|
||||
if (tow_it->second.get_utc_data() != ""){
|
||||
return tow_it->second.get_utc_data();
|
||||
if (!tow_it.second.get_utc_data().empty()){
|
||||
return tow_it.second.get_utc_data();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -161,7 +161,7 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag)
|
||||
* @param PRNd
|
||||
* @return
|
||||
*/
|
||||
bool OSNMA_nav_data_Manager::have_nav_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW)
|
||||
bool OSNMA_nav_data_Manager::have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW)
|
||||
{
|
||||
if (_satellite_nav_data.find(PRNd) != _satellite_nav_data.end()){
|
||||
for (auto& data_timestamp : _satellite_nav_data[PRNd])
|
||||
@ -195,20 +195,20 @@ bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const
|
||||
}
|
||||
// satellite was found, check if TOW exists in inner map
|
||||
std::map<uint32_t, OSNMA_NavData> tow_map = prn_it->second;
|
||||
for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset
|
||||
for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset
|
||||
{
|
||||
// Check if current key (TOW) fulfills condition
|
||||
if (t.TOW - 30 * t.cop <= tow_it->first && tow_it->first <= t.TOW - 30)
|
||||
if (t.TOW - 30 * t.cop <= tow_it.first && tow_it.first <= t.TOW - 30)
|
||||
{
|
||||
if (t.ADKD == 0 || t.ADKD == 12)
|
||||
{
|
||||
if (tow_it->second.get_ephemeris_data() != ""){
|
||||
if (!tow_it.second.get_ephemeris_data().empty()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (t.ADKD == 4)
|
||||
{
|
||||
if (tow_it->second.get_utc_data() != ""){
|
||||
if (!tow_it.second.get_utc_data().empty()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -220,19 +220,20 @@ void OSNMA_nav_data_Manager::print_status()
|
||||
{
|
||||
for (const auto& satellite : _satellite_nav_data){
|
||||
LOG(INFO) << "Galileo OSNMA: NavData status :: SVID=" << satellite.first;
|
||||
auto& tow_data = satellite.second;
|
||||
for (const auto& nav_data : tow_data)
|
||||
LOG(INFO) << "Galileo OSNMA: IOD_nav=0b" << std::uppercase
|
||||
<< std::bitset<10>(nav_data.second.IOD_nav)
|
||||
<< ", TOW_start="
|
||||
<< nav_data.second.get_tow_sf0()
|
||||
<< ", TOW_last="
|
||||
<< nav_data.second.last_received_TOW
|
||||
<< ", l_t="
|
||||
<< nav_data.second.verified_bits
|
||||
<< ", PRNd="
|
||||
<< nav_data.second.PRNd
|
||||
<< ", verified="
|
||||
<< nav_data.second.verified;
|
||||
const auto& tow_data = satellite.second;
|
||||
for (const auto& nav_data : tow_data) {
|
||||
LOG(INFO) << "Galileo OSNMA: IOD_nav=0b" << std::uppercase
|
||||
<< std::bitset<10>(nav_data.second.IOD_nav)
|
||||
<< ", TOW_start="
|
||||
<< nav_data.second.get_tow_sf0()
|
||||
<< ", TOW_last="
|
||||
<< nav_data.second.last_received_TOW
|
||||
<< ", l_t="
|
||||
<< nav_data.second.verified_bits
|
||||
<< ", PRNd="
|
||||
<< nav_data.second.PRNd
|
||||
<< ", verified="
|
||||
<< nav_data.second.verified;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,10 +32,10 @@
|
||||
class OSNMA_nav_data_Manager{
|
||||
public:
|
||||
OSNMA_nav_data_Manager() = default;
|
||||
bool have_nav_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW);
|
||||
bool have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW);
|
||||
bool have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD);
|
||||
bool have_nav_data(const Tag& t) const;
|
||||
void add_navigation_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list
|
||||
void add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list
|
||||
std::string get_navigation_data(const Tag& t);
|
||||
|
||||
void update_nav_data(const std::multimap<uint32_t, Tag>& tags_verified, const uint8_t tag_size);
|
||||
|
Loading…
Reference in New Issue
Block a user