diff --git a/src/fsfw/cfdp/pdu/HeaderReader.cpp b/src/fsfw/cfdp/pdu/HeaderReader.cpp index 4e1bcafd..26af0c70 100644 --- a/src/fsfw/cfdp/pdu/HeaderReader.cpp +++ b/src/fsfw/cfdp/pdu/HeaderReader.cpp @@ -11,12 +11,12 @@ PduHeaderReader::PduHeaderReader(const uint8_t *pduBuf, size_t maxSize) { } ReturnValue_t PduHeaderReader::parseData() { - if (pointers.rawPtr == nullptr) { - return returnvalue::FAILED; - } if (maxSize < 7) { return SerializeIF::STREAM_TOO_SHORT; } + if (pointers.rawPtr == nullptr) { + return returnvalue::FAILED; + } pointers.fixedHeader = reinterpret_cast(const_cast(pointers.rawPtr)); sourceIdRaw = &pointers.fixedHeader->variableFieldsStart; diff --git a/src/fsfw/cfdp/tlv/FilestoreTlvBase.h b/src/fsfw/cfdp/tlv/FilestoreTlvBase.h index 51dc7e29..a5974087 100644 --- a/src/fsfw/cfdp/tlv/FilestoreTlvBase.h +++ b/src/fsfw/cfdp/tlv/FilestoreTlvBase.h @@ -66,9 +66,9 @@ static constexpr uint8_t FSR_DENY_DIR_NOT_ALLOWED = 0b0010; class FilestoreTlvBase : public TlvIF { public: - explicit FilestoreTlvBase(cfdp::StringLv& firstFileName) : firstFileName(firstFileName) {}; + explicit FilestoreTlvBase(cfdp::StringLv& firstFileName) : firstFileName(firstFileName){}; FilestoreTlvBase(FilestoreActionCode actionCode, cfdp::StringLv& firstFileName) - : actionCode(actionCode), firstFileName(firstFileName) {}; + : actionCode(actionCode), firstFileName(firstFileName){}; ReturnValue_t commonSerialize(uint8_t** buffer, size_t* size, size_t maxSize, Endianness streamEndianness, bool isResponse = false, diff --git a/src/fsfw/cfdp/tlv/TlvIF.h b/src/fsfw/cfdp/tlv/TlvIF.h index 6d14156f..317d970a 100644 --- a/src/fsfw/cfdp/tlv/TlvIF.h +++ b/src/fsfw/cfdp/tlv/TlvIF.h @@ -5,7 +5,7 @@ class TlvIF : public SerializeIF { public: - virtual ~TlvIF() {}; + virtual ~TlvIF(){}; virtual uint8_t getLengthField() const = 0; virtual cfdp::TlvType getType() const = 0; diff --git a/src/fsfw/coordinates/Jgm3Model.h b/src/fsfw/coordinates/Jgm3Model.h index d9a4d665..e0be20a3 100644 --- a/src/fsfw/coordinates/Jgm3Model.h +++ b/src/fsfw/coordinates/Jgm3Model.h @@ -29,7 +29,7 @@ class Jgm3Model { lastExecutionTime.tv_sec = 0; lastExecutionTime.tv_usec = 0; } - virtual ~Jgm3Model() {}; + virtual ~Jgm3Model(){}; // double acsNavOrbit(double posECF[3],double velECF[3],timeval gpsTime); @@ -70,10 +70,10 @@ class Jgm3Model { W[n][m] = W[n][m] - (((n + m - 1) / (double)(n - m)) * (pow(Earth::MEAN_RADIUS, 2) / pow(r, 2)) * W[n - 2][m]); } // End of if(n!=(m+1)) - } // End of if(n==m){ - } // End of if(n==0 and m==0) - } // End of for(uint8_t n=0;n<(DEGREE+1);n++) - } // End of for(uint8_t m=0;m<(ORDER+1);m++) + } // End of if(n==m){ + } // End of if(n==0 and m==0) + } // End of for(uint8_t n=0;n<(DEGREE+1);n++) + } // End of for(uint8_t m=0;m<(ORDER+1);m++) // overwrite accel if not properly initialized accel[0] = 0; @@ -106,7 +106,7 @@ class Jgm3Model { accel[1] += partAccel[1]; accel[2] += partAccel[2]; } // End of for(uint8_t n=0;n::LocalPoolVar: The supplied pool " << "owner is a invalid!" - << std::endl; + sif::error << "LocalPoolVar::LocalPoolVar: The supplied pool " + << "owner is a invalid!" << std::endl; #endif return; } diff --git a/src/fsfw/datapoollocal/LocalPoolVariable.h b/src/fsfw/datapoollocal/LocalPoolVariable.h index dc67095c..76b36503 100644 --- a/src/fsfw/datapoollocal/LocalPoolVariable.h +++ b/src/fsfw/datapoollocal/LocalPoolVariable.h @@ -76,7 +76,7 @@ class LocalPoolVariable : public LocalPoolObjectBase { LocalPoolVariable(gp_id_t globalPoolId, DataSetIF* dataSet = nullptr, pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE); - virtual ~LocalPoolVariable() {}; + virtual ~LocalPoolVariable(){}; /** * @brief This is the local copy of the data pool entry. diff --git a/src/fsfw/datapoollocal/LocalPoolVector.h b/src/fsfw/datapoollocal/LocalPoolVector.h index ff5943aa..d340f2de 100644 --- a/src/fsfw/datapoollocal/LocalPoolVector.h +++ b/src/fsfw/datapoollocal/LocalPoolVector.h @@ -88,7 +88,7 @@ class LocalPoolVector : public LocalPoolObjectBase { * @details If commit() was not called, the local value is * discarded and not written back to the data pool. */ - ~LocalPoolVector() {}; + ~LocalPoolVector(){}; /** * @brief The operation returns the number of array entries * in this variable. diff --git a/src/fsfw/datapoollocal/MarkChangedIF.h b/src/fsfw/datapoollocal/MarkChangedIF.h index 54c2c7f3..21667dda 100644 --- a/src/fsfw/datapoollocal/MarkChangedIF.h +++ b/src/fsfw/datapoollocal/MarkChangedIF.h @@ -6,7 +6,7 @@ */ class MarkChangedIF { public: - virtual ~MarkChangedIF() {}; + virtual ~MarkChangedIF(){}; virtual bool hasChanged() const = 0; virtual void setChanged(bool changed) = 0; diff --git a/src/fsfw/devicehandlers/CookieIF.h b/src/fsfw/devicehandlers/CookieIF.h index c70b27be..aca5d942 100644 --- a/src/fsfw/devicehandlers/CookieIF.h +++ b/src/fsfw/devicehandlers/CookieIF.h @@ -28,7 +28,7 @@ using address_t = uint32_t; */ class CookieIF { public: - virtual ~CookieIF() {}; + virtual ~CookieIF(){}; }; #endif /* FSFW_DEVICEHANDLER_COOKIE_H_ */ diff --git a/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp b/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp index bdb879df..aa897769 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp @@ -243,8 +243,8 @@ bool DeviceHandlerFailureIsolation::isFdirInActionOrAreWeFaulty(EventMessage* ev if (owner == nullptr) { // Configuration error. #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "DeviceHandlerFailureIsolation::" << "isFdirInActionOrAreWeFaulty: Owner not set!" - << std::endl; + sif::error << "DeviceHandlerFailureIsolation::" + << "isFdirInActionOrAreWeFaulty: Owner not set!" << std::endl; #endif return false; } diff --git a/src/fsfw/fdir/FailureIsolationBase.cpp b/src/fsfw/fdir/FailureIsolationBase.cpp index 5082cf08..cbf2cc06 100644 --- a/src/fsfw/fdir/FailureIsolationBase.cpp +++ b/src/fsfw/fdir/FailureIsolationBase.cpp @@ -62,7 +62,8 @@ ReturnValue_t FailureIsolationBase::initialize() { ObjectManager::instance()->get(faultTreeParent); if (parentIF == nullptr) { #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; #else sif::printError("FailureIsolationBase::intialize: Parent object invalid\n"); diff --git a/src/fsfw/housekeeping/HousekeepingSnapshot.h b/src/fsfw/housekeeping/HousekeepingSnapshot.h index 7e31c464..9807795d 100644 --- a/src/fsfw/housekeeping/HousekeepingSnapshot.h +++ b/src/fsfw/housekeeping/HousekeepingSnapshot.h @@ -23,7 +23,7 @@ class HousekeepingSnapshot : public SerializeIF { HousekeepingSnapshot(CCSDSTime::CDS_short* cdsShort, LocalPoolDataSetBase* dataSetPtr) : timeStamp(reinterpret_cast(cdsShort)), timeStampSize(sizeof(CCSDSTime::CDS_short)), - updateData(dataSetPtr) {}; + updateData(dataSetPtr){}; /** * Update packet constructor for datasets. @@ -32,7 +32,7 @@ class HousekeepingSnapshot : public SerializeIF { * @param dataSetPtr Pointer to the dataset instance to deserialize the data into */ HousekeepingSnapshot(uint8_t* timeStamp, size_t timeStampSize, LocalPoolDataSetBase* dataSetPtr) - : timeStamp(timeStamp), timeStampSize(timeStampSize), updateData(dataSetPtr) {}; + : timeStamp(timeStamp), timeStampSize(timeStampSize), updateData(dataSetPtr){}; /** * Update packet constructor for pool variables. @@ -43,7 +43,7 @@ class HousekeepingSnapshot : public SerializeIF { HousekeepingSnapshot(CCSDSTime::CDS_short* cdsShort, LocalPoolObjectBase* dataSetPtr) : timeStamp(reinterpret_cast(cdsShort)), timeStampSize(sizeof(CCSDSTime::CDS_short)), - updateData(dataSetPtr) {}; + updateData(dataSetPtr){}; /** * Update packet constructor for pool variables. @@ -52,7 +52,7 @@ class HousekeepingSnapshot : public SerializeIF { * @param dataSetPtr */ HousekeepingSnapshot(uint8_t* timeStamp, size_t timeStampSize, LocalPoolObjectBase* dataSetPtr) - : timeStamp(timeStamp), timeStampSize(timeStampSize), updateData(dataSetPtr) {}; + : timeStamp(timeStamp), timeStampSize(timeStampSize), updateData(dataSetPtr){}; ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, Endianness streamEndianness) const { diff --git a/src/fsfw/ipc/CommandMessageIF.h b/src/fsfw/ipc/CommandMessageIF.h index 7a8cbb22..e714ca70 100644 --- a/src/fsfw/ipc/CommandMessageIF.h +++ b/src/fsfw/ipc/CommandMessageIF.h @@ -37,7 +37,7 @@ class CommandMessageIF { //! Parameter 1 should contain the error code static const Command_t REPLY_REJECTED = MAKE_COMMAND_ID(2); - virtual ~CommandMessageIF() {}; + virtual ~CommandMessageIF(){}; /** * A command message shall have a uint16_t command ID field. diff --git a/src/fsfw/ipc/definitions.h b/src/fsfw/ipc/definitions.h index df4e575f..150502bb 100644 --- a/src/fsfw/ipc/definitions.h +++ b/src/fsfw/ipc/definitions.h @@ -5,7 +5,7 @@ #include struct MqArgs { - MqArgs() {}; + MqArgs(){}; MqArgs(object_id_t objectId, void* args = nullptr) : objectId(objectId), args(args) {} object_id_t objectId = objects::NO_OBJECT; void* args = nullptr; diff --git a/src/fsfw/objectmanager/ObjectManagerIF.h b/src/fsfw/objectmanager/ObjectManagerIF.h index 162584c0..81ddd95a 100644 --- a/src/fsfw/objectmanager/ObjectManagerIF.h +++ b/src/fsfw/objectmanager/ObjectManagerIF.h @@ -40,7 +40,7 @@ class ObjectManagerIF { /** * @brief This is the empty virtual destructor as requested by C++ interfaces. */ - virtual ~ObjectManagerIF(void) {}; + virtual ~ObjectManagerIF(void){}; /** * @brief With this call, new objects are inserted to the list. * @details The implementation shall return an error code in case the diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index b724aa9a..42417f84 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -321,8 +321,8 @@ ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) { #if FSFW_CPP_OSTREAM_ENABLED == 1 // Possible configuration error, too much data or/and data coming in too fast, // requiring larger buffers - sif::warning << "TcpTmTcServer::handleServerOperation: Ring buffer reached " << "fill count" - << std::endl; + sif::warning << "TcpTmTcServer::handleServerOperation: Ring buffer reached " + << "fill count" << std::endl; #else sif::printWarning( "TcpTmTcServer::handleServerOperation: Ring buffer reached " diff --git a/src/fsfw/pus/Service20ParameterManagement.cpp b/src/fsfw/pus/Service20ParameterManagement.cpp index fc9bfbfd..87bd5a13 100644 --- a/src/fsfw/pus/Service20ParameterManagement.cpp +++ b/src/fsfw/pus/Service20ParameterManagement.cpp @@ -49,8 +49,8 @@ ReturnValue_t Service20ParameterManagement::checkAndAcquireTargetID(object_id_t* if (SerializeAdapter::deSerialize(objectIdToSet, &tcData, &tcDataLen, SerializeIF::Endianness::BIG) != returnvalue::OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Service20ParameterManagement::checkAndAcquireTargetID: " << "Invalid data." - << std::endl; + sif::error << "Service20ParameterManagement::checkAndAcquireTargetID: " + << "Invalid data." << std::endl; #else sif::printError( "Service20ParameterManagement::" diff --git a/src/fsfw/pus/Service3Housekeeping.cpp b/src/fsfw/pus/Service3Housekeeping.cpp index 328f5a25..4d1137d1 100644 --- a/src/fsfw/pus/Service3Housekeeping.cpp +++ b/src/fsfw/pus/Service3Housekeeping.cpp @@ -196,8 +196,8 @@ ReturnValue_t Service3Housekeeping::handleReply(const CommandMessage* reply, default: #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Service3Housekeeping::handleReply: Invalid reply with " << "reply command " - << command << std::endl; + sif::warning << "Service3Housekeeping::handleReply: Invalid reply with " + << "reply command " << command << std::endl; #else sif::printWarning( "Service3Housekeeping::handleReply: Invalid reply with " diff --git a/src/fsfw/rmap/RMAPChannelIF.h b/src/fsfw/rmap/RMAPChannelIF.h index 7fd4f9a3..60d439d0 100644 --- a/src/fsfw/rmap/RMAPChannelIF.h +++ b/src/fsfw/rmap/RMAPChannelIF.h @@ -9,7 +9,7 @@ class RMAPChannelIF { public: - virtual ~RMAPChannelIF() {}; + virtual ~RMAPChannelIF(){}; /** * Reset an RMAP channel * diff --git a/src/fsfw/storagemanager/LocalPool.cpp b/src/fsfw/storagemanager/LocalPool.cpp index f1582136..9a4b53a6 100644 --- a/src/fsfw/storagemanager/LocalPool.cpp +++ b/src/fsfw/storagemanager/LocalPool.cpp @@ -12,7 +12,8 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig, spillsToHigherPools(spillsToHigherPools) { if (NUMBER_OF_SUBPOOLS == 0) { #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 } max_subpools_t index = 0; diff --git a/src/fsfw/subsystem/Subsystem.cpp b/src/fsfw/subsystem/Subsystem.cpp index ec7b62b9..ad3afb2b 100644 --- a/src/fsfw/subsystem/Subsystem.cpp +++ b/src/fsfw/subsystem/Subsystem.cpp @@ -38,9 +38,10 @@ ReturnValue_t Subsystem::checkSequence(HybridIterator iter, if (!existsModeTable(iter->getTableId())) { #if FSFW_CPP_OSTREAM_ENABLED == 1 using namespace std; - sif::warning << "Subsystem::checkSequence: " << "Object " << setfill('0') << hex << "0x" - << setw(8) << getObjectId() << setw(0) << ": Mode table for mode ID " << "0x" - << setw(8) << iter->getTableId() << " does not exist" << dec << endl; + sif::warning << "Subsystem::checkSequence: " + << "Object " << setfill('0') << hex << "0x" << setw(8) << getObjectId() + << setw(0) << ": Mode table for mode ID " + << "0x" << setw(8) << iter->getTableId() << " does not exist" << dec << endl; #endif return TABLE_DOES_NOT_EXIST; } else { diff --git a/src/fsfw/subsystem/Subsystem.h b/src/fsfw/subsystem/Subsystem.h index 1d25222e..20925821 100644 --- a/src/fsfw/subsystem/Subsystem.h +++ b/src/fsfw/subsystem/Subsystem.h @@ -12,7 +12,7 @@ struct TableSequenceBase { public: - TableSequenceBase(Mode_t mode, ArrayList *table) : mode(mode), table(table) {}; + TableSequenceBase(Mode_t mode, ArrayList *table) : mode(mode), table(table){}; Mode_t mode; ArrayList *table; bool inStore = false; @@ -21,7 +21,7 @@ struct TableSequenceBase { struct TableEntry : public TableSequenceBase { public: - TableEntry(Mode_t mode, ArrayList *table) : TableSequenceBase(mode, table) {}; + TableEntry(Mode_t mode, ArrayList *table) : TableSequenceBase(mode, table){}; }; struct SequenceEntry : public TableSequenceBase { diff --git a/src/fsfw/tasks/ExecutableObjectIF.h b/src/fsfw/tasks/ExecutableObjectIF.h index 4248019e..1e3f19e4 100644 --- a/src/fsfw/tasks/ExecutableObjectIF.h +++ b/src/fsfw/tasks/ExecutableObjectIF.h @@ -34,7 +34,7 @@ class ExecutableObjectIF { * a reference to the executing task * @param task_ Pointer to the taskIF of this task */ - virtual void setTaskIF(PeriodicTaskIF* task_) {}; + virtual void setTaskIF(PeriodicTaskIF* task_){}; /** * This function should be called after the object was assigned to a diff --git a/src/fsfw/tasks/FixedSlotSequence.cpp b/src/fsfw/tasks/FixedSlotSequence.cpp index 3774f224..cba7a87a 100644 --- a/src/fsfw/tasks/FixedSlotSequence.cpp +++ b/src/fsfw/tasks/FixedSlotSequence.cpp @@ -101,7 +101,8 @@ ReturnValue_t FixedSlotSequence::checkSequence() const { if (result != returnvalue::OK) { // Continue for now but print error output. #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 } } diff --git a/src/fsfw/tasks/SemaphoreIF.h b/src/fsfw/tasks/SemaphoreIF.h index f9d1a795..9a692e9b 100644 --- a/src/fsfw/tasks/SemaphoreIF.h +++ b/src/fsfw/tasks/SemaphoreIF.h @@ -30,7 +30,7 @@ class SemaphoreIF { BLOCKING //!< Block indefinitely until the mutex becomes available. }; - virtual ~SemaphoreIF() {}; + virtual ~SemaphoreIF(){}; static const uint8_t INTERFACE_ID = CLASS_ID::SEMAPHORE_IF; //! Semaphore timeout diff --git a/src/fsfw/tcdistribution/definitions.h b/src/fsfw/tcdistribution/definitions.h index 04a7a4a5..bec1dd1b 100644 --- a/src/fsfw/tcdistribution/definitions.h +++ b/src/fsfw/tcdistribution/definitions.h @@ -27,5 +27,5 @@ static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TMTC_DISTRIBUTION; //! P1: Returnvalue, P2: 0 for TM issues, 1 for TC issues static constexpr Event HANDLE_PACKET_FAILED = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW); -}; // namespace tmtcdistrib +}; // namespace tmtcdistrib #endif // FSFW_TMTCPACKET_DEFINITIONS_H diff --git a/src/fsfw/timemanager/CCSDSTime.h b/src/fsfw/timemanager/CCSDSTime.h index 3d1a25ad..03a8ea8f 100644 --- a/src/fsfw/timemanager/CCSDSTime.h +++ b/src/fsfw/timemanager/CCSDSTime.h @@ -212,8 +212,8 @@ class CCSDSTime { static uint32_t subsecondsToMicroseconds(uint16_t subseconds); private: - CCSDSTime() {}; - virtual ~CCSDSTime() {}; + CCSDSTime(){}; + virtual ~CCSDSTime(){}; /** * checks a ccs time stream for validity * diff --git a/src/fsfw/tmtcpacket/pus/tm/PusTmCreator.h b/src/fsfw/tmtcpacket/pus/tm/PusTmCreator.h index 253cbe1d..f683b363 100644 --- a/src/fsfw/tmtcpacket/pus/tm/PusTmCreator.h +++ b/src/fsfw/tmtcpacket/pus/tm/PusTmCreator.h @@ -22,7 +22,7 @@ struct PusTmSecHeader { struct PusTmParams { PusTmParams() = default; - explicit PusTmParams(PusTmSecHeader secHeader) : secHeader(secHeader) {}; + explicit PusTmParams(PusTmSecHeader secHeader) : secHeader(secHeader){}; PusTmParams(PusTmSecHeader secHeader, const SerializeIF& data) : secHeader(secHeader), sourceData(&data) {} PusTmParams(PusTmSecHeader secHeader, const uint8_t* data, size_t dataLen) diff --git a/src/fsfw/tmtcservices/SpacePacketParser.cpp b/src/fsfw/tmtcservices/SpacePacketParser.cpp index 75db7a4e..b8c71cc3 100644 --- a/src/fsfw/tmtcservices/SpacePacketParser.cpp +++ b/src/fsfw/tmtcservices/SpacePacketParser.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -6,6 +7,8 @@ SpacePacketParser::SpacePacketParser(std::vector validPacketIds) : validPacketIds(validPacketIds) {} +void SpacePacketParser::enableCrcCheck() { checkCrc = true; } + ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t** buffer, const size_t maxSize, FoundPacketInfo& packetInfo) { if (buffer == nullptr or nextStartIdx > maxSize) { @@ -31,6 +34,11 @@ ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t** buffer, const } *buffer += packetInfo.sizeFound; packetInfo.startIdx = localIdx + amountRead; + if (checkCrc) { + if (CRC::crc16ccitt(bufPtr + localIdx, packetSize) != 0) { + return CRC_CHECK_FAILED; + } + } nextStartIdx = localIdx + amountRead + packetInfo.sizeFound; amountRead = nextStartIdx; return result; diff --git a/src/fsfw/tmtcservices/SpacePacketParser.h b/src/fsfw/tmtcservices/SpacePacketParser.h index ea0a2feb..ea780bed 100644 --- a/src/fsfw/tmtcservices/SpacePacketParser.h +++ b/src/fsfw/tmtcservices/SpacePacketParser.h @@ -25,6 +25,13 @@ class SpacePacketParser { static constexpr uint8_t INTERFACE_ID = CLASS_ID::SPACE_PACKET_PARSER; static constexpr ReturnValue_t NO_PACKET_FOUND = MAKE_RETURN_CODE(0x00); static constexpr ReturnValue_t SPLIT_PACKET = MAKE_RETURN_CODE(0x01); + static constexpr ReturnValue_t CRC_CHECK_FAILED = MAKE_RETURN_CODE(0x02); + + /** + * brief If the last to bytes of a space packet hold a CRC16, this function can be used to enable + * the CRC16 check when parsing the data. + */ + void enableCrcCheck(); /** * @brief Parser constructor. @@ -61,6 +68,7 @@ class SpacePacketParser { std::vector validPacketIds; size_t nextStartIdx = 0; size_t amountRead = 0; + bool checkCrc = false; }; #endif /* FRAMEWORK_TMTCSERVICES_PUSPARSER_H_ */ diff --git a/src/fsfw/tmtcservices/TmTcBridge.cpp b/src/fsfw/tmtcservices/TmTcBridge.cpp index c6249e62..f371485e 100644 --- a/src/fsfw/tmtcservices/TmTcBridge.cpp +++ b/src/fsfw/tmtcservices/TmTcBridge.cpp @@ -34,7 +34,8 @@ ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored(unsigned int maxNumberOfPa } else { #if FSFW_CPP_OSTREAM_ENABLED == 1 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 return returnvalue::FAILED; } @@ -78,13 +79,15 @@ ReturnValue_t TmTcBridge::performOperation(uint8_t operationCode) { result = handleTc(); if (result != returnvalue::OK) { #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 } result = handleTm(); if (result != returnvalue::OK) { #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 } return result; diff --git a/src/fsfw_hal/common/gpio/GpioIF.h b/src/fsfw_hal/common/gpio/GpioIF.h index 3ad5673e..20ae8a26 100644 --- a/src/fsfw_hal/common/gpio/GpioIF.h +++ b/src/fsfw_hal/common/gpio/GpioIF.h @@ -15,7 +15,7 @@ class GpioCookie; */ class GpioIF { public: - virtual ~GpioIF() {}; + virtual ~GpioIF(){}; /** * @brief Called by the GPIO using object. diff --git a/src/fsfw_hal/common/gpio/gpioDefinitions.h b/src/fsfw_hal/common/gpio/gpioDefinitions.h index 7e3aa450..1f921a57 100644 --- a/src/fsfw_hal/common/gpio/gpioDefinitions.h +++ b/src/fsfw_hal/common/gpio/gpioDefinitions.h @@ -60,7 +60,7 @@ class GpioBase { gpio::Levels initValue) : gpioType(gpioType), consumer(consumer), direction(direction), initValue(initValue) {} - virtual ~GpioBase() {}; + virtual ~GpioBase(){}; // Can be used to cast GpioBase to a concrete child implementation gpio::GpioTypes gpioType = gpio::GpioTypes::NONE; diff --git a/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp b/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp index df6afa95..701de8f0 100644 --- a/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp +++ b/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp @@ -418,8 +418,8 @@ ReturnValue_t LinuxLibgpioIF::checkForConflictsById(gpioId_t gpioIdToCheck, #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO " "definition with ID " - << gpioIdToCheck << " detected. " << "Duplicate will be removed from map to add" - << std::endl; + << gpioIdToCheck << " detected. " + << "Duplicate will be removed from map to add" << std::endl; #else sif::printWarning( "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition " diff --git a/src/fsfw_hal/linux/i2c/I2cComIF.cpp b/src/fsfw_hal/linux/i2c/I2cComIF.cpp index 436c7f5c..1a85d4d3 100644 --- a/src/fsfw_hal/linux/i2c/I2cComIF.cpp +++ b/src/fsfw_hal/linux/i2c/I2cComIF.cpp @@ -49,7 +49,8 @@ ReturnValue_t I2cComIF::initializeInterface(CookieIF* cookie) { if (not statusPair.second) { #if FSFW_CPP_OSTREAM_ENABLED == 1 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 return returnvalue::FAILED; } @@ -90,8 +91,8 @@ ReturnValue_t I2cComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s auto i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); if (i2cDeviceMapIter == i2cDeviceMap.end()) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "I2cComIF::sendMessage: i2cAddress of Cookie not " << "registered in i2cDeviceMap" - << std::endl; + sif::error << "I2cComIF::sendMessage: i2cAddress of Cookie not " + << "registered in i2cDeviceMap" << std::endl; #endif return returnvalue::FAILED; } diff --git a/src/fsfw_hal/linux/spi/SpiComIF.cpp b/src/fsfw_hal/linux/spi/SpiComIF.cpp index 6787e188..f227c685 100644 --- a/src/fsfw_hal/linux/spi/SpiComIF.cpp +++ b/src/fsfw_hal/linux/spi/SpiComIF.cpp @@ -197,8 +197,9 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie* spiCookie, const if (result == MutexIF::MUTEX_TIMEOUT) { sif::error << "SpiComIF::sendMessage: Lock timeout" << std::endl; } else { - sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code " << "0x" << std::hex - << std::setfill('0') << std::setw(4) << result << std::dec << std::endl; + sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code " + << "0x" << std::hex << std::setfill('0') << std::setw(4) << result << std::dec + << std::endl; } #else 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 FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code " << "0x" << std::hex - << std::setfill('0') << std::setw(4) << result << std::dec << std::endl; + sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code " + << "0x" << std::hex << std::setfill('0') << std::setw(4) << result << std::dec + << std::endl; #else sif::printError("SpiComIF::sendMessage: Failed to lock mutex with code %d\n", result); #endif diff --git a/src/fsfw_hal/stm32h7/definitions.h b/src/fsfw_hal/stm32h7/definitions.h index 11a2f26a..4612d2b7 100644 --- a/src/fsfw_hal/stm32h7/definitions.h +++ b/src/fsfw_hal/stm32h7/definitions.h @@ -12,10 +12,10 @@ namespace stm32h7 { * and the second entry is the pin number */ struct GpioCfg { - GpioCfg() : port(nullptr), pin(0), altFnc(0) {}; + GpioCfg() : port(nullptr), pin(0), altFnc(0){}; GpioCfg(GPIO_TypeDef* port, uint16_t pin, uint8_t altFnc = 0) - : port(port), pin(pin), altFnc(altFnc) {}; + : port(port), pin(pin), altFnc(altFnc){}; GPIO_TypeDef* port; uint16_t pin; uint8_t altFnc; diff --git a/src/fsfw_hal/stm32h7/spi/mspInit.h b/src/fsfw_hal/stm32h7/spi/mspInit.h index 697f1244..f0658fb9 100644 --- a/src/fsfw_hal/stm32h7/spi/mspInit.h +++ b/src/fsfw_hal/stm32h7/spi/mspInit.h @@ -37,7 +37,7 @@ struct MspCfgBase { }; struct MspPollingConfigStruct : public MspCfgBase { - MspPollingConfigStruct() : MspCfgBase() {}; + MspPollingConfigStruct() : MspCfgBase(){}; MspPollingConfigStruct(stm32h7::GpioCfg sck, stm32h7::GpioCfg mosi, stm32h7::GpioCfg miso, mspCb cleanupCb = nullptr, mspCb setupCb = nullptr) : MspCfgBase(sck, mosi, miso, cleanupCb, setupCb) {} @@ -46,7 +46,7 @@ struct MspPollingConfigStruct : public MspCfgBase { /* A valid instance of this struct must be passed to the MSP initialization function as a void* argument */ struct MspIrqConfigStruct : public MspPollingConfigStruct { - MspIrqConfigStruct() : MspPollingConfigStruct() {}; + MspIrqConfigStruct() : MspPollingConfigStruct(){}; MspIrqConfigStruct(stm32h7::GpioCfg sck, stm32h7::GpioCfg mosi, stm32h7::GpioCfg miso, mspCb cleanupCb = nullptr, mspCb setupCb = nullptr) : MspPollingConfigStruct(sck, mosi, miso, cleanupCb, setupCb) {} @@ -64,7 +64,7 @@ struct MspIrqConfigStruct : public MspPollingConfigStruct { /* A valid instance of this struct must be passed to the MSP initialization function as a void* argument */ struct MspDmaConfigStruct : public MspIrqConfigStruct { - MspDmaConfigStruct() : MspIrqConfigStruct() {}; + MspDmaConfigStruct() : MspIrqConfigStruct(){}; MspDmaConfigStruct(stm32h7::GpioCfg sck, stm32h7::GpioCfg mosi, stm32h7::GpioCfg miso, mspCb cleanupCb = nullptr, mspCb setupCb = nullptr) : MspIrqConfigStruct(sck, mosi, miso, cleanupCb, setupCb) {} diff --git a/unittests/container/TestArrayList.cpp b/unittests/container/TestArrayList.cpp index eaf64af0..0c327685 100644 --- a/unittests/container/TestArrayList.cpp +++ b/unittests/container/TestArrayList.cpp @@ -13,8 +13,8 @@ TEST_CASE("Array List", "[containers]") { ArrayList list(20); struct TestClass { public: - TestClass() {}; - TestClass(uint32_t number1, uint64_t number2) : number1(number1), number2(number2) {}; + TestClass(){}; + TestClass(uint32_t number1, uint64_t number2) : number1(number1), number2(number2){}; uint32_t number1 = -1; uint64_t number2 = -1; bool operator==(const TestClass& other) { diff --git a/unittests/container/TestFixedOrderedMultimap.cpp b/unittests/container/TestFixedOrderedMultimap.cpp index eedb20fa..cadb03e6 100644 --- a/unittests/container/TestFixedOrderedMultimap.cpp +++ b/unittests/container/TestFixedOrderedMultimap.cpp @@ -97,9 +97,9 @@ TEST_CASE("FixedOrderedMultimap Non Trivial Type", "[TestFixedOrderedMultimapNon class TestClass { public: - TestClass() {}; - TestClass(uint32_t number1, uint64_t number2) : number1(number1), number2(number2) {}; - ~TestClass() {}; + TestClass(){}; + TestClass(uint32_t number1, uint64_t number2) : number1(number1), number2(number2){}; + ~TestClass(){}; bool operator==(const TestClass& lhs) { return ((this->number1 == lhs.number1) and (this->number2 == lhs.number2));