add cfdp components to generic factory
This commit is contained in:
parent
29593e3142
commit
c6276fca11
@ -3,3 +3,4 @@ add_subdirectory(core)
|
||||
add_subdirectory(devices)
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(utility)
|
||||
add_subdirectory(cfdp)
|
||||
|
1
example/cfdp/CMakeLists.txt
Normal file
1
example/cfdp/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
|
56
example/cfdp/Config.h
Normal file
56
example/cfdp/Config.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef FSFW_EXAMPLE_HOSTED_CONFIG_H
|
||||
#define FSFW_EXAMPLE_HOSTED_CONFIG_H
|
||||
|
||||
#include "fsfw/cfdp.h"
|
||||
|
||||
namespace cfdp {
|
||||
|
||||
class ExampleUserHandler : public UserBase {
|
||||
public:
|
||||
explicit ExampleUserHandler(HasFileSystemIF& vfs) : cfdp::UserBase(vfs) {}
|
||||
|
||||
void transactionIndication(const cfdp::TransactionId& id) override {}
|
||||
void eofSentIndication(const cfdp::TransactionId& id) override {}
|
||||
void transactionFinishedIndication(const cfdp::TransactionFinishedParams& params) override {
|
||||
sif::info << "File transaction finished for transaction with " << params.id << std::endl;
|
||||
}
|
||||
void metadataRecvdIndication(const cfdp::MetadataRecvdParams& params) override {
|
||||
sif::info << "Metadata received for transaction with " << params.id << std::endl;
|
||||
}
|
||||
void fileSegmentRecvdIndication(const cfdp::FileSegmentRecvdParams& params) override {}
|
||||
void reportIndication(const cfdp::TransactionId& id, cfdp::StatusReportIF& report) override {}
|
||||
void suspendedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code) override {}
|
||||
void resumedIndication(const cfdp::TransactionId& id, size_t progress) override {}
|
||||
void faultIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code,
|
||||
size_t progress) override {}
|
||||
void abandonedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code,
|
||||
size_t progress) override {}
|
||||
void eofRecvIndication(const cfdp::TransactionId& id) override {
|
||||
sif::info << "EOF PDU received for transaction with " << id << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
class ExampleFaultHandler : public cfdp::FaultHandlerBase {
|
||||
public:
|
||||
void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
|
||||
sif::warning << "Notice of suspension detected for transaction " << id
|
||||
<< " with condition code: " << cfdp::getConditionCodeString(code) << std::endl;
|
||||
}
|
||||
void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
|
||||
sif::warning << "Notice of suspension detected for transaction " << id
|
||||
<< " with condition code: " << cfdp::getConditionCodeString(code) << std::endl;
|
||||
}
|
||||
void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
|
||||
sif::warning << "Transaction " << id
|
||||
<< " was abandoned, condition code : " << cfdp::getConditionCodeString(code)
|
||||
<< std::endl;
|
||||
}
|
||||
void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
|
||||
sif::warning << "Fault ignored for transaction " << id
|
||||
<< ", condition code: " << cfdp::getConditionCodeString(code) << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace cfdp
|
||||
|
||||
#endif // FSFW_EXAMPLE_HOSTED_CONFIG_H
|
@ -1,12 +1,13 @@
|
||||
#include "GenericFactory.h"
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "common/definitions.h"
|
||||
#include "definitions.h"
|
||||
#include "example/cfdp/Config.h"
|
||||
#include "example/test/FsfwExampleTask.h"
|
||||
#include "example/test/FsfwReaderTask.h"
|
||||
#include "example/utility/TmFunnel.h"
|
||||
#include "fsfw/FSFW.h"
|
||||
#include "fsfw/cfdp.h"
|
||||
#include "fsfw/cfdp/CfdpDistributor.h"
|
||||
#include "fsfw/devicehandlers/CookieIF.h"
|
||||
#include "fsfw/events/EventManager.h"
|
||||
@ -27,6 +28,7 @@
|
||||
#include "fsfw/tcdistribution/PusDistributor.h"
|
||||
#include "fsfw/timemanager/CdsShortTimeStamper.h"
|
||||
#include "fsfw/tmtcservices/VerificationReporter.h"
|
||||
#include "fsfw_hal/host/HostFilesystem.h"
|
||||
#include "fsfw_tests/integration/assemblies/TestAssembly.h"
|
||||
#include "fsfw_tests/integration/controller/TestController.h"
|
||||
#include "fsfw_tests/integration/devices/TestCookie.h"
|
||||
@ -35,8 +37,19 @@
|
||||
#include "fsfw_tests/internal/InternalUnitTester.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
#if OBSW_ADD_CFDP_COMPONENTS == 1
|
||||
namespace cfdp {
|
||||
EntityId REMOTE_CFDP_ID(cfdp::WidthInBytes::TWO_BYTES, common::COMMON_CFDP_CLIENT_ENTITY_ID);
|
||||
RemoteEntityCfg GROUND_REMOTE_CFG(REMOTE_CFDP_ID);
|
||||
OneRemoteConfigProvider REMOTE_CFG_PROVIDER(GROUND_REMOTE_CFG);
|
||||
HostFilesystem HOST_FS;
|
||||
ExampleUserHandler USER_HANDLER(HOST_FS);
|
||||
ExampleFaultHandler EXAMPLE_FAULT_HANDLER;
|
||||
} // namespace cfdp
|
||||
#endif
|
||||
|
||||
void ObjectFactory::produceGenericObjects(TmFunnel **tmFunnel, CcsdsDistributor **ccsdsDistrib,
|
||||
StorageManagerIF &tcStore) {
|
||||
StorageManagerIF &tcStore, StorageManagerIF &tmStore) {
|
||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||
/* Framework objects */
|
||||
new EventManager(objects::EVENT_MANAGER);
|
||||
@ -141,6 +154,29 @@ void ObjectFactory::produceGenericObjects(TmFunnel **tmFunnel, CcsdsDistributor
|
||||
InternalUnitTester unittester;
|
||||
unittester.performTests(testCfg);
|
||||
#endif /* OBSW_PERFORM_INTERNAL_UNITTEST == 1 */
|
||||
|
||||
#if OBSW_ADD_CFDP_COMPONENTS == 1
|
||||
using namespace cfdp;
|
||||
auto *msgQueue = QueueFactory::instance()->createMessageQueue(32);
|
||||
UnsignedByteField<uint16_t> remoteEntityId(common::COMMON_CFDP_CLIENT_ENTITY_ID);
|
||||
cfdp::EntityId remoteId(remoteEntityId);
|
||||
cfdp::RemoteEntityCfg remoteCfg(remoteId);
|
||||
remoteCfg.defaultChecksum = cfdp::ChecksumType::CRC_32;
|
||||
FsfwHandlerParams params(objects::CFDP_HANDLER, HOST_FS, **tmFunnel, tcStore, tmStore, *msgQueue);
|
||||
cfdp::IndicationCfg indicationCfg;
|
||||
UnsignedByteField<uint16_t> apid(common::COMMON_CFDP_APID);
|
||||
cfdp::EntityId localId(apid);
|
||||
GROUND_REMOTE_CFG.defaultChecksum = cfdp::ChecksumType::CRC_32;
|
||||
if (PACKET_LIST_PTR == nullptr or LOST_SEGMENTS_PTR == nullptr) {
|
||||
sif::error << "CFDP: No packet list or lost segments container set" << std::endl;
|
||||
}
|
||||
CfdpHandlerCfg cfdpCfg(localId, indicationCfg, USER_HANDLER, EXAMPLE_FAULT_HANDLER,
|
||||
*PACKET_LIST_PTR, *LOST_SEGMENTS_PTR, REMOTE_CFG_PROVIDER);
|
||||
auto *cfdpHandler = new CfdpHandler(params, cfdpCfg);
|
||||
CcsdsDistributorIF::DestInfo info("CFDP Destination", common::COMMON_CFDP_APID,
|
||||
cfdpHandler->getRequestQueue(), true);
|
||||
(*ccsdsDistrib)->registerApplication(info);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Factory::setStaticFrameworkObjectIds() {
|
||||
|
@ -1,13 +1,22 @@
|
||||
#ifndef MISSION_CORE_GENERICFACTORY_H_
|
||||
#define MISSION_CORE_GENERICFACTORY_H_
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include <fsfw/objectmanager/SystemObjectIF.h>
|
||||
|
||||
#include "fsfw/cfdp/handler/DestHandler.h"
|
||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||
|
||||
class TmFunnel;
|
||||
class CcsdsDistributor;
|
||||
|
||||
#if OBSW_ADD_CFDP_COMPONENTS == 1
|
||||
namespace cfdp {
|
||||
extern PacketInfoListBase* PACKET_LIST_PTR;
|
||||
extern LostSegmentsListBase* LOST_SEGMENTS_PTR;
|
||||
} // namespace cfdp
|
||||
#endif
|
||||
|
||||
namespace ObjectFactory {
|
||||
|
||||
/**
|
||||
@ -15,7 +24,7 @@ namespace ObjectFactory {
|
||||
* object factory.
|
||||
*/
|
||||
void produceGenericObjects(TmFunnel** funnel, CcsdsDistributor** ccsdsDistributor,
|
||||
StorageManagerIF& tcStore);
|
||||
StorageManagerIF& tcStore, StorageManagerIF& tmStore);
|
||||
|
||||
} // namespace ObjectFactory
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user