TMTC Packet Base improvements #80
No reviewers
Labels
No Label
API Change
Breaking API Change
bug
build
cosmetics
Documentation
duplicate
feature
help wanted
hotfix
invalid
question
Refactor
Tests
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: fsfw/fsfw#80
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "KSat/fsfw:mueller_tcPacketBase"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
fixes #81. includes possible bugfix in initializeTcPacket()
@ -73,3 +80,3 @@
initSpacePacketHeader(true, true, apid, sequenceCount);
memset(&tcData->data_field, 0, sizeof(tcData->data_field));
setPacketDataLength(sizeof(tcData->data_field) + CRC_SIZE);
setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1);
Bug here. I think a minus one was missing: the value is the data length field should be the actual size of the data field minus 1.
redordered CTOR argument order for TcPacketStored
There is still a bug in here, setApplicationData and setData() of Tc/TmPacketBase are (very!) confusing to use on their own.
I added new setAppData, setSourceData functions which perform the memcpy normally performed by TmPacketStored and TcPacketStored. If a framework user wants to create TM/TC by itself without using the store, this is possible inutitively now.
mueller_tcPacketBaseto WIP: mueller_tcPacketBaseWIP: mueller_tcPacketBaseto mueller_tcPacketBasemueller_tcPacketBaseto TMTC Packet Base improvementsI think we should see the base classes as a Helper for parsing.
It does not contain the data itself and does not know anything about the available size.
Therefore, a TcPacketStored and the Tm equivalent are the way to go for users.
Hence, setters after construction in the BaseClasses are all potentials difficult bugs.
@ -52,0 +51,4 @@
tcData = (TcPacketPointer*) pData;
}
void TcPacketBase::setAppData(uint8_t * appData, uint16_t dataLen) {
The getter is called "getApplicationData", we should keep the names the same.
@ -52,0 +52,4 @@
}
void TcPacketBase::setAppData(uint8_t * appData, uint16_t dataLen) {
memcpy(&tcData->appData, appData, dataLen);
As tcData->appData is only a "fake" pointer of which we are not able to check the length, this operation is dangerous and there is no warning about it. TcPacketStored is the way the user does not have to thing about that. The whole class is only intended as Parsing Helper for a existing Packet or it is hidden behind a safe operation as in TcPacketStored.
I'm not sure if we should allow setting of anything here after the constructor.
Even the setData function is interessting maybe we could make that protected as its only used in TcPacketStored.
@ -14,1 +11,3 @@
TcPacketBase(NULL) {
TcPacketStored::TcPacketStored(uint8_t service, uint8_t subservice,
uint16_t apid, uint8_t sequence_count, const uint8_t* data,
size_t size, uint8_t ack ) :
The order of arguments is changed. This is an API Change. The APID has no default argument, so changing the order does not seem useful.
@ -103,2 +103,4 @@
}
void TmPacketBase::setSourceData(uint8_t* sourceData, size_t sourceSize) {
memcpy(getSourceData(), sourceData, sourceSize);
See TcPacketBase::set..