souce data setter function

This commit is contained in:
Robin Müller 2020-05-19 19:00:33 +02:00
parent 483a47d353
commit 7bc29fc2d5
2 changed files with 12 additions and 0 deletions

View File

@ -102,6 +102,11 @@ void TmPacketBase::initializeTmPacket(uint16_t apid, uint8_t service, uint8_t su
} }
} }
void TmPacketBase::setSourceData(uint8_t* sourceData, size_t sourceSize) {
memcpy(getSourceData(), sourceData, sourceSize);
setSourceDataSize(sourceSize);
}
void TmPacketBase::setSourceDataSize(uint16_t size) { void TmPacketBase::setSourceDataSize(uint16_t size) {
setPacketDataLength(size + sizeof(PUSTmDataFieldHeader) + CRC_SIZE - 1); setPacketDataLength(size + sizeof(PUSTmDataFieldHeader) + CRC_SIZE - 1);
} }

View File

@ -125,6 +125,13 @@ public:
* current content of the packet. * current content of the packet.
*/ */
void setErrorControl(); void setErrorControl();
/**
* This sets the source data. It copies the provided data to
* the internal TmPacketPointer.
* @param sourceData
* @param sourceSize
*/
void setSourceData(uint8_t* sourceData, size_t sourceSize);
/** /**
* With this method, the packet data pointer can be redirected to another * With this method, the packet data pointer can be redirected to another
* location. * location.