Space Packet Parser CRC Check #41

Merged
meierj merged 3 commits from meier/space-packet-crc-check into main 2024-11-15 10:21:29 +01:00
45 changed files with 96 additions and 87 deletions
Showing only changes of commit a95ca7d4eb - Show all commits

View File

@ -17,7 +17,8 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner, uint32_t
if (hkOwner == nullptr) { if (hkOwner == nullptr) {
// Configuration error. // Configuration error.
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "LocalPoolDataSetBase::LocalPoolDataSetBase: Owner " << "invalid!" << std::endl; sif::error << "LocalPoolDataSetBase::LocalPoolDataSetBase: Owner "
<< "invalid!" << std::endl;
#else #else
sif::printError( sif::printError(
"LocalPoolDataSetBase::LocalPoolDataSetBase: Owner " "LocalPoolDataSetBase::LocalPoolDataSetBase: Owner "
@ -186,8 +187,8 @@ ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t **buffer, size
SerializeAdapter::serialize(&currentPoolId, buffer, size, maxSize, streamEndianness); SerializeAdapter::serialize(&currentPoolId, buffer, size, maxSize, streamEndianness);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "LocalPoolDataSetBase::serializeLocalPoolIds: " << "Serialization error!" sif::warning << "LocalPoolDataSetBase::serializeLocalPoolIds: "
<< std::endl; << "Serialization error!" << std::endl;
#else #else
sif::printWarning( sif::printWarning(
"LocalPoolDataSetBase::serializeLocalPoolIds: " "LocalPoolDataSetBase::serializeLocalPoolIds: "

View File

@ -17,8 +17,8 @@ LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkO
} }
if (hkOwner == nullptr) { if (hkOwner == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "LocalPoolVar<T>::LocalPoolVar: The supplied pool " << "owner is a invalid!" sif::error << "LocalPoolVar<T>::LocalPoolVar: The supplied pool "
<< std::endl; << "owner is a invalid!" << std::endl;
#endif #endif
return; return;
} }

View File

@ -243,8 +243,8 @@ bool DeviceHandlerFailureIsolation::isFdirInActionOrAreWeFaulty(EventMessage* ev
if (owner == nullptr) { if (owner == nullptr) {
// Configuration error. // Configuration error.
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "DeviceHandlerFailureIsolation::" << "isFdirInActionOrAreWeFaulty: Owner not set!" sif::error << "DeviceHandlerFailureIsolation::"
<< std::endl; << "isFdirInActionOrAreWeFaulty: Owner not set!" << std::endl;
#endif #endif
return false; return false;
} }

View File

@ -62,7 +62,8 @@ ReturnValue_t FailureIsolationBase::initialize() {
ObjectManager::instance()->get<ConfirmsFailuresIF>(faultTreeParent); ObjectManager::instance()->get<ConfirmsFailuresIF>(faultTreeParent);
if (parentIF == nullptr) { if (parentIF == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "FailureIsolationBase::intialize: Parent object " << "invalid" << std::endl; sif::error << "FailureIsolationBase::intialize: Parent object "
<< "invalid" << std::endl;
sif::error << "Make sure it implements ConfirmsFailuresIF" << std::endl; sif::error << "Make sure it implements ConfirmsFailuresIF" << std::endl;
#else #else
sif::printError("FailureIsolationBase::intialize: Parent object invalid\n"); sif::printError("FailureIsolationBase::intialize: Parent object invalid\n");

View File

@ -321,8 +321,8 @@ ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
// Possible configuration error, too much data or/and data coming in too fast, // Possible configuration error, too much data or/and data coming in too fast,
// requiring larger buffers // requiring larger buffers
sif::warning << "TcpTmTcServer::handleServerOperation: Ring buffer reached " << "fill count" sif::warning << "TcpTmTcServer::handleServerOperation: Ring buffer reached "
<< std::endl; << "fill count" << std::endl;
#else #else
sif::printWarning( sif::printWarning(
"TcpTmTcServer::handleServerOperation: Ring buffer reached " "TcpTmTcServer::handleServerOperation: Ring buffer reached "

View File

@ -49,8 +49,8 @@ ReturnValue_t Service20ParameterManagement::checkAndAcquireTargetID(object_id_t*
if (SerializeAdapter::deSerialize(objectIdToSet, &tcData, &tcDataLen, if (SerializeAdapter::deSerialize(objectIdToSet, &tcData, &tcDataLen,
SerializeIF::Endianness::BIG) != returnvalue::OK) { SerializeIF::Endianness::BIG) != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Service20ParameterManagement::checkAndAcquireTargetID: " << "Invalid data." sif::error << "Service20ParameterManagement::checkAndAcquireTargetID: "
<< std::endl; << "Invalid data." << std::endl;
#else #else
sif::printError( sif::printError(
"Service20ParameterManagement::" "Service20ParameterManagement::"

View File

@ -196,8 +196,8 @@ ReturnValue_t Service3Housekeeping::handleReply(const CommandMessage* reply,
default: default:
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Service3Housekeeping::handleReply: Invalid reply with " << "reply command " sif::warning << "Service3Housekeeping::handleReply: Invalid reply with "
<< command << std::endl; << "reply command " << command << std::endl;
#else #else
sif::printWarning( sif::printWarning(
"Service3Housekeeping::handleReply: Invalid reply with " "Service3Housekeeping::handleReply: Invalid reply with "

View File

@ -12,7 +12,8 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig,
spillsToHigherPools(spillsToHigherPools) { spillsToHigherPools(spillsToHigherPools) {
if (NUMBER_OF_SUBPOOLS == 0) { if (NUMBER_OF_SUBPOOLS == 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "LocalPool::LocalPool: Passed pool configuration is " << " invalid!" << std::endl; sif::error << "LocalPool::LocalPool: Passed pool configuration is "
<< " invalid!" << std::endl;
#endif #endif
} }
max_subpools_t index = 0; max_subpools_t index = 0;

View File

@ -38,9 +38,10 @@ ReturnValue_t Subsystem::checkSequence(HybridIterator<ModeListEntry> iter,
if (!existsModeTable(iter->getTableId())) { if (!existsModeTable(iter->getTableId())) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
using namespace std; using namespace std;
sif::warning << "Subsystem::checkSequence: " << "Object " << setfill('0') << hex << "0x" sif::warning << "Subsystem::checkSequence: "
<< setw(8) << getObjectId() << setw(0) << ": Mode table for mode ID " << "0x" << "Object " << setfill('0') << hex << "0x" << setw(8) << getObjectId()
<< setw(8) << iter->getTableId() << " does not exist" << dec << endl; << setw(0) << ": Mode table for mode ID "
<< "0x" << setw(8) << iter->getTableId() << " does not exist" << dec << endl;
#endif #endif
return TABLE_DOES_NOT_EXIST; return TABLE_DOES_NOT_EXIST;
} else { } else {

View File

@ -101,7 +101,8 @@ ReturnValue_t FixedSlotSequence::checkSequence() const {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
// Continue for now but print error output. // Continue for now but print error output.
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "FixedSlotSequence::checkSequence:" << " Custom check failed!" << std::endl; sif::error << "FixedSlotSequence::checkSequence:"
<< " Custom check failed!" << std::endl;
#endif #endif
} }
} }

View File

@ -1,15 +1,13 @@
#include <fsfw/globalfunctions/CRC.h>
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/tmtcservices/SpacePacketParser.h> #include <fsfw/tmtcservices/SpacePacketParser.h>
#include <fsfw/globalfunctions/CRC.h>
#include <algorithm> #include <algorithm>
SpacePacketParser::SpacePacketParser(std::vector<uint16_t> validPacketIds) SpacePacketParser::SpacePacketParser(std::vector<uint16_t> validPacketIds)
: validPacketIds(validPacketIds) {} : validPacketIds(validPacketIds) {}
void SpacePacketParser::enableCrcCheck() { void SpacePacketParser::enableCrcCheck() { checkCrc = true; }
checkCrc = true;
}
ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t** buffer, const size_t maxSize, ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t** buffer, const size_t maxSize,
FoundPacketInfo& packetInfo) { FoundPacketInfo& packetInfo) {

View File

@ -34,7 +34,8 @@ ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored(unsigned int maxNumberOfPa
} else { } else {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "TmTcBridge::setMaxNumberOfPacketsStored: Number of " sif::warning << "TmTcBridge::setMaxNumberOfPacketsStored: Number of "
<< "packets stored exceeds limits. " << "Keeping default value." << std::endl; << "packets stored exceeds limits. "
<< "Keeping default value." << std::endl;
#endif #endif
return returnvalue::FAILED; return returnvalue::FAILED;
} }
@ -78,13 +79,15 @@ ReturnValue_t TmTcBridge::performOperation(uint8_t operationCode) {
result = handleTc(); result = handleTc();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "TmTcBridge::performOperation: " << "Error handling TCs" << std::endl; sif::debug << "TmTcBridge::performOperation: "
<< "Error handling TCs" << std::endl;
#endif #endif
} }
result = handleTm(); result = handleTm();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "TmTcBridge::performOperation: " << "Error handling TMs" << std::endl; sif::debug << "TmTcBridge::performOperation: "
<< "Error handling TMs" << std::endl;
#endif #endif
} }
return result; return result;

View File

@ -418,8 +418,8 @@ ReturnValue_t LinuxLibgpioIF::checkForConflictsById(gpioId_t gpioIdToCheck,
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO " sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO "
"definition with ID " "definition with ID "
<< gpioIdToCheck << " detected. " << "Duplicate will be removed from map to add" << gpioIdToCheck << " detected. "
<< std::endl; << "Duplicate will be removed from map to add" << std::endl;
#else #else
sif::printWarning( sif::printWarning(
"LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition " "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition "

View File

@ -49,7 +49,8 @@ ReturnValue_t I2cComIF::initializeInterface(CookieIF* cookie) {
if (not statusPair.second) { if (not statusPair.second) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "I2cComIF::initializeInterface: Failed to insert device with address " sif::error << "I2cComIF::initializeInterface: Failed to insert device with address "
<< i2cAddress << "to I2C device " << "map" << std::endl; << i2cAddress << "to I2C device "
<< "map" << std::endl;
#endif #endif
return returnvalue::FAILED; return returnvalue::FAILED;
} }
@ -90,8 +91,8 @@ ReturnValue_t I2cComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
auto i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); auto i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress);
if (i2cDeviceMapIter == i2cDeviceMap.end()) { if (i2cDeviceMapIter == i2cDeviceMap.end()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "I2cComIF::sendMessage: i2cAddress of Cookie not " << "registered in i2cDeviceMap" sif::error << "I2cComIF::sendMessage: i2cAddress of Cookie not "
<< std::endl; << "registered in i2cDeviceMap" << std::endl;
#endif #endif
return returnvalue::FAILED; return returnvalue::FAILED;
} }

View File

@ -197,8 +197,9 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie* spiCookie, const
if (result == MutexIF::MUTEX_TIMEOUT) { if (result == MutexIF::MUTEX_TIMEOUT) {
sif::error << "SpiComIF::sendMessage: Lock timeout" << std::endl; sif::error << "SpiComIF::sendMessage: Lock timeout" << std::endl;
} else { } else {
sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code " << "0x" << std::hex sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code "
<< std::setfill('0') << std::setw(4) << result << std::dec << std::endl; << "0x" << std::hex << std::setfill('0') << std::setw(4) << result << std::dec
<< std::endl;
} }
#else #else
sif::printError("SpiComIF::sendMessage: Failed to lock mutex with code %d\n", result); sif::printError("SpiComIF::sendMessage: Failed to lock mutex with code %d\n", result);
@ -306,8 +307,9 @@ ReturnValue_t SpiComIF::performHalfDuplexReception(SpiCookie* spiCookie) {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code " << "0x" << std::hex sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code "
<< std::setfill('0') << std::setw(4) << result << std::dec << std::endl; << "0x" << std::hex << std::setfill('0') << std::setw(4) << result << std::dec
<< std::endl;
#else #else
sif::printError("SpiComIF::sendMessage: Failed to lock mutex with code %d\n", result); sif::printError("SpiComIF::sendMessage: Failed to lock mutex with code %d\n", result);
#endif #endif