1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-18 21:23:02 +00:00

[TAS-226] [FEAT] Remove tags skipped ≥ 10 times

Take into account TOW to decide whether to skip a tag or not.
Still, I dont like the logic of iterating over and over the tags. Once a tag is verified once, it should be not checked unless next TOW subframe came (new Data or new Key available)

Adittionally: solved a small specification bug for ADKD=12, improved reporting (status of Tag is a string now)
This commit is contained in:
cesaaargm 2024-06-24 14:41:49 +02:00
parent 849a900adf
commit 2cf96bda87
3 changed files with 21 additions and 8 deletions

View File

@ -980,7 +980,10 @@ void osnma_msg_receiver::process_mack_message()
<< std::endl;
}
}
else {
else if(it.second.TOW > d_osnma_data.d_nav_data.TOW_sf0){
// case 1: adkd=12 and t.Tow + 300 < current TOW
// case 2: adkd=0/4 and t.Tow + 30 < current TOW
// case 3: any adkd and t.Tow > current TOW
it.second.skipped ++;
LOG(WARNING) << "Galileo OSNMA: Tag verification :: SKIPPED (x"<< it.second.skipped <<")for Tag Id= "
<< it.second.tag_id
@ -1063,7 +1066,7 @@ bool osnma_msg_receiver::verify_tag(Tag& tag)
if (tag.ADKD == 0 || tag.ADKD == 4)
applicable_key = d_tesla_keys[tag.TOW + 30];
else // ADKD 12
applicable_key = d_tesla_keys[tag.TOW + 300];
applicable_key = d_tesla_keys[tag.TOW + 330];
if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256
{
@ -1284,7 +1287,7 @@ void osnma_msg_receiver::remove_verified_tags()
<< ", PRNd="
<< static_cast<unsigned>(it->second.PRN_d)
<< ", status= "
<< it->second.status
<< d_helper->verification_status_str(it->second.status)
<< std::endl;
it = d_tags_awaiting_verify.erase(it);
}
@ -1303,7 +1306,7 @@ void osnma_msg_receiver::remove_verified_tags()
<< ", PRNd="
<< static_cast<unsigned>(it->second.PRN_d)
<< ", status= "
<< it->second.status
<< d_helper->verification_status_str(it->second.status)
<< std::endl;
it = d_tags_awaiting_verify.erase(it);
}
@ -1478,14 +1481,14 @@ bool osnma_msg_receiver::tag_has_key_available(Tag& t){
}
else if (t.ADKD == 12)
{
auto it = d_tesla_keys.find(t.TOW + 300);
auto it = d_tesla_keys.find(t.TOW + 330);
if (it != d_tesla_keys.end())
{
LOG(INFO)<< "Galileo OSNMA: hasKey = true " << std::endl;
return true;
}
}
LOG(INFO) << "Galileo OSNMA: hasKey = false " << std::endl;
LOG(INFO) << "Galileo OSNMA: hasKey = false ";
return false;
}
std::vector<uint8_t> osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_needed, std::vector<uint8_t> key, uint32_t GST_SFi, const uint8_t lk_bytes)

View File

@ -63,4 +63,14 @@ std::vector<uint8_t> Osnma_Helper::bytes(const std::string& binaryString) {
}
return bytes;
}
}
std::string Osnma_Helper::verification_status_str(int status)
{
switch (status) {
case 0: return "SUCCESS";
case 1: return "FAIL";
case 2: return "UNVERIFIED";
default: return "UNKNOWN";
}
}

View File

@ -29,7 +29,7 @@ public:
uint32_t compute_gst(uint32_t WN, uint32_t TOW) const;
std::vector<uint8_t> gst_to_uint8(uint32_t GST) const;
std::vector<uint8_t> bytes(const std::string& binaryString);
std::string verification_status_str(int status);
};
#endif // GNSS_SDR_OSNMA_HELPER_H