Merge remote-tracking branch 'upstream/mueller/new-cfdp-update-with-handlers' into mueller/update-cfdp-components
This commit is contained in:
commit
2de9e25ceb
@ -425,21 +425,31 @@ ReturnValue_t cfdp::DestHandler::sendFinishedPdu() {
|
|||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
uint8_t* dataPtr = nullptr;
|
uint8_t* dataPtr = nullptr;
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
fp.tcStore->getFreeElement(&storeId, finishedPdu.getSerializedSize(), &dataPtr);
|
fp.tmStore->getFreeElement(&storeId, finishedPdu.getSerializedSize(), &dataPtr);
|
||||||
if (result != OK) {
|
if (result != OK) {
|
||||||
// TODO: Error handling and event, this is a non CFDP specific error (most likely store is full)
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "cfdp::DestHandler:sendFinishedPdu: Getting store slot failed" << std::endl;
|
||||||
|
#endif
|
||||||
|
fp.eventReporter->forwardEvent(events::STORE_ERROR, result, 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t serLen = 0;
|
size_t serLen = 0;
|
||||||
result = finishedPdu.serialize(dataPtr, serLen, finishedPdu.getSerializedSize());
|
result = finishedPdu.serialize(dataPtr, serLen, finishedPdu.getSerializedSize());
|
||||||
if (result != OK) {
|
if (result != OK) {
|
||||||
// TODO: Error printout, this really should not happen
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "cfdp::DestHandler::sendFinishedPdu: Serializing Finished PDU failed"
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
|
fp.eventReporter->forwardEvent(events::SERIALIZATION_ERROR, result, 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
TmTcMessage msg(storeId);
|
TmTcMessage msg(storeId);
|
||||||
result = fp.msgQueue->sendMessage(fp.packetDest.getReportReceptionQueue(), &msg);
|
result = fp.msgQueue->sendMessage(fp.packetDest.getReportReceptionQueue(), &msg);
|
||||||
if (result != OK) {
|
if (result != OK) {
|
||||||
// TODO: Error handling and event, this is a non CFDP specific error (most likely store is full)
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "cfdp::DestHandler::sendFinishedPdu: Sending PDU failed" << std::endl;
|
||||||
|
#endif
|
||||||
|
fp.eventReporter->forwardEvent(events::MSG_QUEUE_ERROR, result, 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
fsmRes.packetsSent++;
|
fsmRes.packetsSent++;
|
||||||
|
@ -5,5 +5,15 @@ namespace cfdp {
|
|||||||
|
|
||||||
enum class CfdpStates { IDLE, BUSY_CLASS_1_NACKED, BUSY_CLASS_2_ACKED, SUSPENDED };
|
enum class CfdpStates { IDLE, BUSY_CLASS_1_NACKED, BUSY_CLASS_2_ACKED, SUSPENDED };
|
||||||
|
|
||||||
}
|
static constexpr uint8_t SSID = SUBSYSTEM_ID::CFDP;
|
||||||
|
|
||||||
|
namespace events {
|
||||||
|
|
||||||
|
static constexpr Event STORE_ERROR = event::makeEvent(SSID, 0, severity::LOW);
|
||||||
|
static constexpr Event MSG_QUEUE_ERROR = event::makeEvent(SSID, 1, severity::LOW);
|
||||||
|
static constexpr Event SERIALIZATION_ERROR = event::makeEvent(SSID, 2, severity::LOW);
|
||||||
|
|
||||||
|
} // namespace events
|
||||||
|
|
||||||
|
} // namespace cfdp
|
||||||
#endif // FSFW_CFDP_HANDLER_DEFS_H
|
#endif // FSFW_CFDP_HANDLER_DEFS_H
|
||||||
|
@ -17,7 +17,7 @@ ReturnValue_t FinishPduCreator::serialize(uint8_t **buffer, size_t *size, size_t
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (*size + 1 >= maxSize) {
|
if (*size + 1 > maxSize) {
|
||||||
return SerializeIF::BUFFER_TOO_SHORT;
|
return SerializeIF::BUFFER_TOO_SHORT;
|
||||||
}
|
}
|
||||||
**buffer = finishInfo.getConditionCode() << 4 | finishInfo.getDeliveryCode() << 2 |
|
**buffer = finishInfo.getConditionCode() << 4 | finishInfo.getDeliveryCode() << 2 |
|
||||||
|
@ -33,6 +33,7 @@ enum : uint8_t {
|
|||||||
PUS_SERVICE_23 = 103,
|
PUS_SERVICE_23 = 103,
|
||||||
MGM_LIS3MDL = 106,
|
MGM_LIS3MDL = 106,
|
||||||
MGM_RM3100 = 107,
|
MGM_RM3100 = 107,
|
||||||
|
CFDP = 108,
|
||||||
|
|
||||||
FW_SUBSYSTEM_ID_RANGE
|
FW_SUBSYSTEM_ID_RANGE
|
||||||
};
|
};
|
||||||
|
@ -14,6 +14,7 @@ SpacePacketCreator::SpacePacketCreator(ccsds::PacketType packetType, bool secHea
|
|||||||
: params(SpacePacketParams(PacketId(packetType, secHeaderFlag, apid),
|
: params(SpacePacketParams(PacketId(packetType, secHeaderFlag, apid),
|
||||||
PacketSeqCtrl(seqFlags, seqCount), dataLen)) {
|
PacketSeqCtrl(seqFlags, seqCount), dataLen)) {
|
||||||
params.version = version;
|
params.version = version;
|
||||||
|
checkFieldValidity();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t SpacePacketCreator::getPacketIdRaw() const { return params.packetId.raw(); }
|
uint16_t SpacePacketCreator::getPacketIdRaw() const { return params.packetId.raw(); }
|
||||||
|
@ -21,9 +21,9 @@ class AcceptsTelemetryIF {
|
|||||||
* receiving message queue.
|
* receiving message queue.
|
||||||
* @return The telemetry reception message queue id.
|
* @return The telemetry reception message queue id.
|
||||||
*/
|
*/
|
||||||
virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) = 0;
|
[[nodiscard]] virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) const = 0;
|
||||||
|
|
||||||
virtual MessageQueueId_t getReportReceptionQueue() { return getReportReceptionQueue(0); }
|
[[nodiscard]] virtual MessageQueueId_t getReportReceptionQueue() const { return getReportReceptionQueue(0); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_TMTCSERVICES_ACCEPTSTELEMETRYIF_H_ */
|
#endif /* FSFW_TMTCSERVICES_ACCEPTSTELEMETRYIF_H_ */
|
||||||
|
@ -245,7 +245,7 @@ void TmTcBridge::registerCommDisconnect() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t TmTcBridge::getReportReceptionQueue(uint8_t virtualChannel) {
|
MessageQueueId_t TmTcBridge::getReportReceptionQueue(uint8_t virtualChannel) const {
|
||||||
return tmTcReceptionQueue->getId();
|
return tmTcReceptionQueue->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class TmTcBridge : public AcceptsTelemetryIF,
|
|||||||
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||||
|
|
||||||
/** AcceptsTelemetryIF override */
|
/** AcceptsTelemetryIF override */
|
||||||
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
|
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) const override;
|
||||||
|
|
||||||
/** AcceptsTelecommandsIF override */
|
/** AcceptsTelecommandsIF override */
|
||||||
uint32_t getIdentifier() const override;
|
uint32_t getIdentifier() const override;
|
||||||
|
Loading…
Reference in New Issue
Block a user