bugfix in map packet extraction
This commit is contained in:
parent
ce387deee7
commit
31defac17c
@ -89,12 +89,17 @@ ReturnValue_t MapPacketExtraction::unpackBlockingPackets(TcTransferFrame* frame)
|
|||||||
if (totalLength > MAX_PACKET_SIZE) return CONTENT_TOO_LARGE;
|
if (totalLength > MAX_PACKET_SIZE) return CONTENT_TOO_LARGE;
|
||||||
uint8_t* position = frame->getDataField();
|
uint8_t* position = frame->getDataField();
|
||||||
while ((totalLength > ccsds::HEADER_LEN)) {
|
while ((totalLength > ccsds::HEADER_LEN)) {
|
||||||
SpacePacketBase packet(position);
|
SpacePacketReader packet(position, totalLength);
|
||||||
uint32_t packetSize = packet.getFullSize();
|
status = packet.checkSize();
|
||||||
|
if(status != returnvalue::OK) {
|
||||||
|
// TODO: Better error handling
|
||||||
|
status = DATA_CORRUPTED;
|
||||||
|
}
|
||||||
|
uint32_t packetSize = packet.getFullPacketLen();
|
||||||
if (packetSize <= totalLength) {
|
if (packetSize <= totalLength) {
|
||||||
status = sendCompletePacket(packet.getWholeData(), packet.getFullSize());
|
status = sendCompletePacket(packet.getFullData(), packet.getFullPacketLen());
|
||||||
totalLength -= packet.getFullSize();
|
totalLength -= packet.getFullPacketLen();
|
||||||
position += packet.getFullSize();
|
position += packet.getFullPacketLen();
|
||||||
status = returnvalue::OK;
|
status = returnvalue::OK;
|
||||||
} else {
|
} else {
|
||||||
status = DATA_CORRUPTED;
|
status = DATA_CORRUPTED;
|
||||||
@ -107,7 +112,7 @@ ReturnValue_t MapPacketExtraction::unpackBlockingPackets(TcTransferFrame* frame)
|
|||||||
return status;
|
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;
|
store_address_t store_id;
|
||||||
ReturnValue_t status = this->packetStore->addData(&store_id, data, size);
|
ReturnValue_t status = this->packetStore->addData(&store_id, data, size);
|
||||||
if (status == returnvalue::OK) {
|
if (status == returnvalue::OK) {
|
||||||
|
@ -47,7 +47,7 @@ class MapPacketExtraction : public MapPacketExtractionIF {
|
|||||||
* @param size Complete total size of the packet.
|
* @param size Complete total size of the packet.
|
||||||
* @return Return Code of the Packet Store or the Message Queue.
|
* @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.
|
* Helper method to reset the internal buffer.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user