more printouts for rejected TC packets #505

Merged
mohr merged 5 commits from eive/fsfw:mueller/packet-check-printout into development 2021-10-18 14:44:40 +02:00
Showing only changes of commit 2180c47f4f - Show all commits

View File

@ -29,12 +29,31 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() {
tcStatus = checker.checkPacket(currentPacket);
if(tcStatus != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1
std::string keyword;
mohr marked this conversation as resolved Outdated
Outdated
Review

As we try to not use allocating classes in the framework during runtime, I do not see a reason not to use a char Pointer here.

As we try to not use allocating classes in the framework during runtime, I do not see a reason not to use a `char` Pointer here.

We should provide a custom allocator in the future so that users can use classes like std::vector and std::string without issues in the future. Another solution would be to use etl::vector and etl::string which do not allocate dynamically. cmake allows good dependency management for this. But this is a topic for another issue.

I'll change the code to use a preallocated array.

We should provide a custom allocator in the future so that users can use classes like `std::vector` and `std::string` without issues in the future. Another solution would be to use `etl::vector` and `etl::string` which do not allocate dynamically. cmake allows good dependency management for this. But this is a topic for another issue. I'll change the code to use a preallocated array.
Outdated
Review

If you change the init value to "unnamed error" from nullptr, I'll be really happy :)

Fully aggree re allocators and etl, I tend towards etl, as we already started implementing something like it in /containers. But you are right, this is a topic for anopther issue.

If you change the init value to `"unnamed error"` from `nullptr`, I'll be really happy :) Fully aggree re allocators and etl, I tend towards etl, as we already started implementing something like it in `/containers`. But you are right, this is a topic for anopther issue.

done

done
if(tcStatus == TcPacketCheck::INCORRECT_CHECKSUM) {
keyword = "checksum";
}
else if(tcStatus == TcPacketCheck::INCORRECT_PRIMARY_HEADER) {
keyword = "incorrect primary header";
}
else if(tcStatus == TcPacketCheck::ILLEGAL_APID) {
keyword = "illegal APID";
}
else if(tcStatus == TcPacketCheck::INCORRECT_SECONDARY_HEADER) {
keyword = "incorrect secondary header";
}
else if(tcStatus == TcPacketCheck::INCOMPLETE_PACKET) {
keyword = "incomplete packet";
}
else {
keyword = "unnamed error";
}
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "PUSDistributor::handlePacket: Packet format invalid, code " <<
static_cast<int>(tcStatus) << std::endl;
sif::warning << "PUSDistributor::handlePacket: Packet format invalid, "
<< keyword << " error" << std::endl;
#else
sif::printDebug("PUSDistributor::handlePacket: Packet format invalid, code %d\n",
static_cast<int>(tcStatus));
sif::printWarning("PUSDistributor::handlePacket: Packet format invalid, "
"%s error\n", keyword);
#endif
#endif
}