24 FileUplink(
const char *
const name) :
25 FileUplinkComponentBase(name),
29 packetsReceived(this),
41 FileUplinkComponentBase::init(queueDepth, instance);
63 this->log_WARNING_HI_DecodeError(status);
66 switch (header.
type) {
77 this->handleCancelPacket();
84 this->bufferSendOut_out(0, buffer);
94 this->pingOut_out(0,key);
105 this->log_WARNING_HI_FileWriteError_ThrottleClear();
106 this->log_WARNING_HI_InvalidReceiveMode_ThrottleClear();
107 this->log_WARNING_HI_PacketOutOfBounds_ThrottleClear();
108 this->log_WARNING_HI_PacketOutOfOrder_ThrottleClear();
109 this->packetsReceived.packetReceived();
110 if (this->receiveMode != START) {
111 this->file.osFile.close();
116 this->goToDataMode();
119 this->warnings.fileOpen(this->file.name);
120 this->goToStartMode();
127 this->packetsReceived.packetReceived();
128 if (this->receiveMode != DATA) {
133 this->checkSequenceIndex(sequenceIndex);
135 const U32 dataSize = dataPacket.
dataSize;
136 if (byteOffset + dataSize > this->file.size) {
137 this->warnings.packetOutOfBounds(sequenceIndex, this->file.name);
146 this->warnings.fileWrite(this->file.name);
153 this->packetsReceived.packetReceived();
154 if (this->receiveMode == DATA) {
155 this->filesReceived.fileReceived();
157 this->compareChecksums(endPacket);
158 this->log_ACTIVITY_HI_FileReceived(this->file.name);
163 this->goToStartMode();
169 this->packetsReceived.packetReceived();
170 this->log_ACTIVITY_HI_UplinkCanceled();
171 this->goToStartMode();
175 checkSequenceIndex(
const U32 sequenceIndex)
177 if (sequenceIndex != this->lastSequenceIndex + 1) {
178 this->warnings.packetOutOfOrder(
180 this->lastSequenceIndex
183 this->lastSequenceIndex = sequenceIndex;
190 this->file.getChecksum(computed);
192 if (computed != stored) {
193 this->warnings.badChecksum(
203 this->file.osFile.close();
204 this->receiveMode = START;
205 this->lastSequenceIndex = 0;
211 this->receiveMode = DATA;
212 this->lastSequenceIndex = 0;
PlatformIntType NATIVE_INT_TYPE
C++-compatible configuration header for fprime configuration.
Class representing a CFDP checksum.
U32 getValue() const
Get the checksum value.
The type of a data packet.
Header header
The packet header.
U32 byteOffset
The byte offset of the packet data into the destination file.
U16 dataSize
The size of the file data in the packet.
const U8 * data
Pointer to the file data.
The type of an end packet.
void getChecksum(CFDP::Checksum &checksum) const
Get the checksum.
Header header
The packet header.
@ OP_OK
Operation was successful.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
The type of a start packet.
SerializeStatus fromBuffer(const Buffer &buffer)
const StartPacket & asStartPacket() const
const EndPacket & asEndPacket() const
const DataPacket & asDataPacket() const
const Header & asHeader() const