bugfix in map packet extraction

This commit is contained in:
muellerr committed 2022-11-09 14:06:59 +01:00
1 parent ce387deee7
commit 31defac17c
2 files changed
+12 -7

No files matched your search

+11 -6
View File
@@ -89,12 +89,17 @@ ReturnValue_t MapPacketExtraction::unpackBlockingPackets(TcTransferFrame* frame)
if (totalLength > MAX_PACKET_SIZE) return CONTENT_TOO_LARGE;
uint8_t* position = frame->getDataField();
while ((totalLength > ccsds::HEADER_LEN)) {
SpacePacketBase packet(position);
uint32_t packetSize = packet.getFullSize();
SpacePacketReader packet(position, totalLength);
status = packet.checkSize();
if(status != returnvalue::OK) {
// TODO: Better error handling
status = DATA_CORRUPTED;
}
uint32_t packetSize = packet.getFullPacketLen();
if (packetSize <= totalLength) {
status = sendCompletePacket(packet.getWholeData(), packet.getFullSize());
totalLength -= packet.getFullSize();
position += packet.getFullSize();
status = sendCompletePacket(packet.getFullData(), packet.getFullPacketLen());
totalLength -= packet.getFullPacketLen();
position += packet.getFullPacketLen();
status = returnvalue::OK;
} else {
status = DATA_CORRUPTED;
@@ -107,7 +112,7 @@ ReturnValue_t MapPacketExtraction::unpackBlockingPackets(TcTransferFrame* frame)
return status;
}
ReturnValue_t MapPacketExtraction::sendCompletePacket(uint8_t* data, uint32_t size) {
ReturnValue_t MapPacketExtraction::sendCompletePacket(const uint8_t* data, uint32_t size) {
store_address_t store_id;
ReturnValue_t status = this->packetStore->addData(&store_id, data, size);
if (status == returnvalue::OK) {
+1 -1
View File
@@ -47,7 +47,7 @@ class MapPacketExtraction : public MapPacketExtractionIF {
* @param size Complete total size of the packet.
* @return Return Code of the Packet Store or the Message Queue.
*/
ReturnValue_t sendCompletePacket(uint8_t* data, uint32_t size);
ReturnValue_t sendCompletePacket(const uint8_t* data, uint32_t size);
/**
* Helper method to reset the internal buffer.
*/