27 m_lastSequenceIndex(0),
28 m_lastPacketWriteStatus(
Os::File::MAX_STATUS),
29 m_filesReceived(this),
30 m_packetsReceived(this),
53 if (packetType != Fw::ComPacketType::FW_PACKET_FILE) {
68 switch (header_type) {
70 this->handleStartPacket(filePacket.asStartPacket());
73 this->handleDataPacket(filePacket.asDataPacket());
76 this->handleEndPacket(filePacket.asEndPacket());
79 this->handleCancelPacket();
89 void FileUplink ::pingIn_handler(
const FwIndexType portNum, U32 key) {
104 this->m_packetsReceived.packetReceived();
105 if (this->m_receiveMode != START) {
106 this->m_file.osFile.close();
111 this->goToDataMode();
113 this->m_warnings.fileOpen(this->m_file.name);
114 this->goToStartMode();
119 this->m_packetsReceived.packetReceived();
120 if (this->m_receiveMode != DATA) {
128 if (this->m_lastPacketWriteStatus ==
Os::File::OP_OK && this->checkDuplicatedPacket(sequenceIndex)) {
132 this->checkSequenceIndex(sequenceIndex);
135 if (byteOffset + dataSize > this->m_file.size) {
136 this->m_warnings.packetOutOfBounds(sequenceIndex, this->m_file.name);
141 this->m_warnings.fileWrite(this->m_file.name);
144 this->m_lastPacketWriteStatus = status;
148 this->m_packetsReceived.packetReceived();
149 if (this->m_receiveMode == DATA) {
150 this->m_filesReceived.fileReceived();
152 this->compareChecksums(endPacket);
157 this->goToStartMode();
160 void FileUplink ::handleCancelPacket() {
161 this->m_packetsReceived.packetReceived();
163 this->goToStartMode();
166 void FileUplink ::checkSequenceIndex(
const U32 sequenceIndex) {
167 if (sequenceIndex != this->m_lastSequenceIndex + 1) {
168 this->m_warnings.packetOutOfOrder(sequenceIndex, this->m_lastSequenceIndex);
170 this->m_lastSequenceIndex = sequenceIndex;
173 bool FileUplink ::checkDuplicatedPacket(
const U32 sequenceIndex) {
175 if (sequenceIndex == this->m_lastSequenceIndex) {
176 this->m_warnings.packetDuplicate(sequenceIndex);
185 this->m_file.getChecksum(computed);
187 if (computed != stored) {
192 void FileUplink ::goToStartMode() {
193 this->m_file.osFile.close();
194 this->m_receiveMode = START;
195 this->m_lastSequenceIndex = 0;
199 void FileUplink ::goToDataMode() {
200 this->m_receiveMode = DATA;
201 this->m_lastSequenceIndex = 0;
const U8 * getData() const
Get the data.
Serialization/Deserialization operation was successful.
FwIdType FwPacketDescriptorType
The type of a com packet descriptor.
void log_ACTIVITY_HI_UplinkCanceled() const
const FilePacket::Header & asHeader() const
Get this as a Header.
void log_WARNING_HI_InvalidReceiveMode_ThrottleClear()
Reset throttle value for InvalidReceiveMode.
U32 getByteOffset() const
Get the byte offset.
const FilePacket::Header & asHeader() const
Get this as a Header.
The type of a data packet.
void getChecksum(CFDP::Checksum &checksum) const
Get the checksum.
U32 getDataSize() const
Get the data size.
void log_WARNING_HI_DecodeError(I32 status) const
SerializeStatus
forward declaration for string
ExternalSerializeBufferWithMemberCopy getDeserializer()
void log_ACTIVITY_HI_FileReceived(const Fw::StringBase &fileName) const
Class representing a 32-bit checksum as mandated by the CCSDS File Delivery Protocol.
void log_WARNING_HI_PacketOutOfOrder_ThrottleClear()
Reset throttle value for PacketOutOfOrder.
The type of a start packet.
void log_WARNING_HI_FileWriteError_ThrottleClear()
Reset throttle value for FileWriteError.
U32 getValue() const
Get the checksum value.
FileUplink(const char *const name)
SerializeStatus fromBuffer(const Buffer &buffer)
Auto-generated base for FileUplink component.
void log_WARNING_HI_InvalidPacketReceived(FwPacketDescriptorType packetType) const
Operation was successful.
void bufferSendOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferSendOut.
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
PlatformIndexType FwIndexType
RateGroupDivider component implementation.
void log_WARNING_HI_PacketOutOfBounds_ThrottleClear()
Reset throttle value for PacketOutOfBounds.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
U32 SizeType
The size type for a buffer.
The type of an end packet.