that should cause a transaction start
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-08-30 11:58:21 +02:00
parent b6b342bf99
commit fa43c5480b
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
2 changed files with 18 additions and 2 deletions

View File

@ -17,6 +17,7 @@ CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwHandlerParams, const CfdpH
pduQueue(fsfwHandlerParams.tmtcQueue),
cfdpRequestQueue(fsfwHandlerParams.cfdpQueue),
localCfg(cfdpCfg.id, cfdpCfg.indicCfg, cfdpCfg.faultHandler),
remoteCfgProvider(cfdpCfg.remoteCfgProvider),
fsfwParams(fsfwHandlerParams.packetDest, &fsfwHandlerParams.tmtcQueue, this,
fsfwHandlerParams.tcStore, fsfwHandlerParams.tmStore),
destHandler(DestHandlerParams(localCfg, cfdpCfg.userHandler, cfdpCfg.remoteCfgProvider,
@ -145,7 +146,6 @@ ReturnValue_t CfdpHandler::handleCfdpRequest(CommandMessage& msg) {
// TODO: Handle CFDP requests here, most importantly put requests. If a put request is received,
// check whether one is pending. If none are, start a transaction with the put request,
// otherwise store for put request inside a FIFO for later processing.
auto accessorPair = ipcStore.getData(CfdpMessage::getStoreId(&msg));
if (msg.getCommand() == CfdpMessage::PUT_REQUEST) {
sif::info << "Received CFDP put request" << std::endl;
if (srcHandler.getState() != CfdpState::IDLE) {
@ -156,7 +156,22 @@ ReturnValue_t CfdpHandler::handleCfdpRequest(CommandMessage& msg) {
putRequestQueue.push(CfdpMessage::getStoreId(&msg));
} else {
// TODO: Retrieve put request and remote configuration.
// srcHandler.transactionStart()
PutRequest putRequest;
auto accessorPair = ipcStore.getData(CfdpMessage::getStoreId(&msg));
const uint8_t* dataPtr = accessorPair.second.data();
size_t dataSize = accessorPair.second.size();
ReturnValue_t result =
putRequest.deSerialize(&dataPtr, &dataSize, SerializeIF::Endianness::MACHINE);
if (result != OK) {
return result;
}
RemoteEntityCfg* remoteCfg;
remoteCfgProvider.getRemoteCfg(putRequest.getDestId(), &remoteCfg);
if (remoteCfg == nullptr) {
// TODO: Trigger event
return FAILED;
}
return srcHandler.transactionStart(putRequest, *remoteCfg);
}
}
return OK;

View File

@ -74,6 +74,7 @@ class CfdpHandler : public SystemObject, public ExecutableObjectIF, public Accep
MessageQueueIF& pduQueue;
MessageQueueIF& cfdpRequestQueue;
cfdp::LocalEntityCfg localCfg;
cfdp::RemoteConfigTableIF& remoteCfgProvider;
cfdp::FsfwParams fsfwParams;
SeqCountProviderU16 seqCntProvider;
cfdp::DestHandler destHandler;