|
|
|
@ -19,12 +19,15 @@ cfdp::SourceHandler::SourceHandler(SourceHandlerParams params, FsfwParams fsfwPa
|
|
|
|
|
: sourceParams(std::move(params)), fsfwParams(fsfwParams) {
|
|
|
|
|
// The entity ID portion of the transaction ID will always remain fixed.
|
|
|
|
|
transactionParams.id.entityId = sourceParams.cfg.localId;
|
|
|
|
|
transactionParams.pduConf.sourceId = sourceParams.cfg.localId;
|
|
|
|
|
if (sourceParams.seqCountProvider.bitWidth() == 8) {
|
|
|
|
|
transactionParams.seqCountWidth = cfdp::WidthInBytes::ONE_BYTE;
|
|
|
|
|
transactionParams.pduConf.seqNum.setWidth(cfdp::WidthInBytes::ONE_BYTE);
|
|
|
|
|
} else if (sourceParams.seqCountProvider.bitWidth() == 16) {
|
|
|
|
|
transactionParams.seqCountWidth = cfdp::WidthInBytes::TWO_BYTES;
|
|
|
|
|
transactionParams.pduConf.seqNum.setWidth(cfdp::WidthInBytes::TWO_BYTES);
|
|
|
|
|
} else if (sourceParams.seqCountProvider.bitWidth() == 32) {
|
|
|
|
|
transactionParams.seqCountWidth = cfdp::WidthInBytes::FOUR_BYTES;
|
|
|
|
|
transactionParams.pduConf.seqNum.setWidth(cfdp::WidthInBytes::FOUR_BYTES);
|
|
|
|
|
} else if (sourceParams.seqCountProvider.bitWidth() == 64) {
|
|
|
|
|
transactionParams.pduConf.seqNum.setWidth(cfdp::WidthInBytes::EIGHT_BYTES);
|
|
|
|
|
} else {
|
|
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
|
|
|
sif::error << "cfdp::SourceHandler: Seq count provider bit width "
|
|
|
|
@ -34,7 +37,7 @@ cfdp::SourceHandler::SourceHandler(SourceHandlerParams params, FsfwParams fsfwPa
|
|
|
|
|
sourceParams.seqCountProvider.bitWidth());
|
|
|
|
|
#endif
|
|
|
|
|
// Yeah, what am I supposed to do here? Can't throw an exception in the FSFW..
|
|
|
|
|
transactionParams.seqCountWidth = cfdp::WidthInBytes::ONE_BYTE;
|
|
|
|
|
transactionParams.pduConf.seqNum.setWidth(cfdp::WidthInBytes::ONE_BYTE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -172,10 +175,13 @@ ReturnValue_t cfdp::SourceHandler::transactionStart(PutRequest& putRequest, Remo
|
|
|
|
|
if (not putRequest.getClosureRequested(transactionParams.closureRequested)) {
|
|
|
|
|
transactionParams.closureRequested = cfg.closureRequested;
|
|
|
|
|
}
|
|
|
|
|
transactionParams.pduConf.destId = putRequest.getDestId();
|
|
|
|
|
const EntityId& destId = putRequest.getDestId();
|
|
|
|
|
transactionParams.pduConf.destId = destId;
|
|
|
|
|
// Adapt source ID width to necessary width. The width of the source and destination ID must be
|
|
|
|
|
// the same.
|
|
|
|
|
transactionParams.pduConf.sourceId.setWidth(destId.getWidth());
|
|
|
|
|
// Only used for PDU forwarding, file is sent to file receiver regularly here.
|
|
|
|
|
transactionParams.pduConf.direction = Direction::TOWARDS_RECEIVER;
|
|
|
|
|
transactionParams.pduConf.sourceId = sourceParams.cfg.localId;
|
|
|
|
|
transactionParams.id.seqNum.setValue(sourceParams.seqCountProvider.getAndIncrement());
|
|
|
|
|
|
|
|
|
|
if (transactionParams.pduConf.mode == TransmissionMode::ACKNOWLEDGED) {
|
|
|
|
|