2021-06-08 13:29:49 +02:00
|
|
|
#include "GenericFactory.h"
|
|
|
|
|
|
|
|
#include "OBSWConfig.h"
|
2021-10-17 23:21:38 +02:00
|
|
|
#include "example/test/FsfwExampleTask.h"
|
|
|
|
#include "example/test/FsfwReaderTask.h"
|
2022-05-05 20:55:28 +02:00
|
|
|
#include "example/utility/TmFunnel.h"
|
|
|
|
#include "fsfw/FSFW.h"
|
2021-06-08 13:29:49 +02:00
|
|
|
#include "fsfw/devicehandlers/CookieIF.h"
|
|
|
|
#include "fsfw/events/EventManager.h"
|
|
|
|
#include "fsfw/health/HealthTable.h"
|
2021-07-14 00:54:06 +02:00
|
|
|
#include "fsfw/internalerror/InternalErrorReporter.h"
|
2021-06-08 13:29:49 +02:00
|
|
|
#include "fsfw/pus/CService200ModeCommanding.h"
|
|
|
|
#include "fsfw/pus/Service17Test.h"
|
|
|
|
#include "fsfw/pus/Service1TelecommandVerification.h"
|
|
|
|
#include "fsfw/pus/Service20ParameterManagement.h"
|
|
|
|
#include "fsfw/pus/Service2DeviceAccess.h"
|
|
|
|
#include "fsfw/pus/Service3Housekeeping.h"
|
|
|
|
#include "fsfw/pus/Service5EventReporting.h"
|
|
|
|
#include "fsfw/pus/Service8FunctionManagement.h"
|
|
|
|
#include "fsfw/pus/Service9TimeManagement.h"
|
|
|
|
#include "fsfw/tcdistribution/CCSDSDistributor.h"
|
|
|
|
#include "fsfw/tcdistribution/PUSDistributor.h"
|
|
|
|
#include "fsfw/timemanager/TimeStamper.h"
|
2021-06-17 12:04:08 +02:00
|
|
|
#include "fsfw/tmtcpacket/pus/tm.h"
|
2022-05-05 20:55:28 +02:00
|
|
|
#include "fsfw_tests/integration/assemblies/TestAssembly.h"
|
|
|
|
#include "fsfw_tests/integration/controller/TestController.h"
|
|
|
|
#include "fsfw_tests/integration/devices/TestCookie.h"
|
|
|
|
#include "fsfw_tests/integration/devices/TestDeviceHandler.h"
|
|
|
|
#include "fsfw_tests/integration/devices/TestEchoComIF.h"
|
|
|
|
#include "fsfw_tests/internal/InternalUnitTester.h"
|
|
|
|
#include "objects/systemObjectList.h"
|
|
|
|
#include "tmtc/apid.h"
|
|
|
|
#include "tmtc/pusIds.h"
|
2021-06-08 13:29:49 +02:00
|
|
|
|
|
|
|
void ObjectFactory::produceGenericObjects() {
|
|
|
|
#if OBSW_ADD_CORE_COMPONENTS == 1
|
2022-05-05 20:55:28 +02:00
|
|
|
/* Framework objects */
|
|
|
|
new EventManager(objects::EVENT_MANAGER);
|
|
|
|
new HealthTable(objects::HEALTH_TABLE);
|
|
|
|
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
|
|
|
new TimeStamper(objects::TIME_STAMPER);
|
|
|
|
new CCSDSDistributor(apid::APID, objects::CCSDS_DISTRIBUTOR);
|
|
|
|
new PUSDistributor(apid::APID, objects::PUS_DISTRIBUTOR, objects::CCSDS_DISTRIBUTOR);
|
|
|
|
new TmFunnel(objects::TM_FUNNEL);
|
2021-06-08 13:29:49 +02:00
|
|
|
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
|
|
|
|
2022-05-05 20:55:28 +02:00
|
|
|
/* PUS stack */
|
2021-06-08 13:29:49 +02:00
|
|
|
#if OBSW_ADD_PUS_STACK == 1
|
2022-05-05 20:55:28 +02:00
|
|
|
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::APID,
|
|
|
|
pus::PUS_SERVICE_1, objects::TM_FUNNEL, 5);
|
|
|
|
new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS, apid::APID, pus::PUS_SERVICE_2, 3,
|
|
|
|
10);
|
|
|
|
new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::APID, pus::PUS_SERVICE_3);
|
|
|
|
new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::APID, pus::PUS_SERVICE_5,
|
|
|
|
50);
|
|
|
|
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::APID,
|
|
|
|
pus::PUS_SERVICE_8, 3, 10);
|
|
|
|
new Service9TimeManagement(objects::PUS_SERVICE_9_TIME_MGMT, apid::APID, pus::PUS_SERVICE_9);
|
|
|
|
new Service17Test(objects::PUS_SERVICE_17_TEST, apid::APID, pus::PUS_SERVICE_17);
|
|
|
|
new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, apid::APID,
|
|
|
|
pus::PUS_SERVICE_20);
|
|
|
|
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, apid::APID,
|
|
|
|
pus::PUS_SERVICE_200);
|
2021-06-08 13:29:49 +02:00
|
|
|
#endif /* OBSW_ADD_PUS_STACK == 1 */
|
|
|
|
|
|
|
|
#if OBSW_ADD_TASK_EXAMPLE == 1
|
2022-05-05 20:55:28 +02:00
|
|
|
/* Demo objects */
|
|
|
|
new FsfwExampleTask(objects::TEST_DUMMY_1);
|
|
|
|
new FsfwExampleTask(objects::TEST_DUMMY_2);
|
|
|
|
new FsfwExampleTask(objects::TEST_DUMMY_3);
|
2021-06-08 13:29:49 +02:00
|
|
|
|
2022-05-05 20:55:28 +02:00
|
|
|
bool enablePrintout = false;
|
2021-06-30 09:59:55 +02:00
|
|
|
#if OBSW_TASK_EXAMPLE_PRINTOUT == 1
|
2022-05-05 20:55:28 +02:00
|
|
|
enablePrintout = true;
|
2021-06-08 13:29:49 +02:00
|
|
|
#endif
|
2022-05-05 20:55:28 +02:00
|
|
|
new FsfwReaderTask(objects::TEST_DUMMY_4, enablePrintout);
|
2021-06-08 13:29:49 +02:00
|
|
|
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
|
|
|
|
|
|
|
|
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
|
|
|
|
|
|
|
|
#if OBSW_DEVICE_HANDLER_PRINTOUT == 1
|
2022-05-05 20:55:28 +02:00
|
|
|
bool enableInfoPrintout = true;
|
2021-06-08 13:29:49 +02:00
|
|
|
#else
|
2022-05-05 20:55:28 +02:00
|
|
|
bool enableInfoPrintout = false;
|
2021-06-08 13:29:49 +02:00
|
|
|
#endif /* OBSW_DEVICE_HANDLER_PRINTOUT == 1 */
|
|
|
|
|
2022-05-05 20:55:28 +02:00
|
|
|
/* Demo device handler object */
|
|
|
|
size_t expectedMaxReplyLen = 64;
|
|
|
|
CookieIF* testCookie = new TestCookie(static_cast<address_t>(testdevice::DeviceIndex::DEVICE_0),
|
|
|
|
expectedMaxReplyLen);
|
|
|
|
new TestEchoComIF(objects::TEST_ECHO_COM_IF);
|
|
|
|
new TestDevice(objects::TEST_DEVICE_HANDLER_0, objects::TEST_ECHO_COM_IF, testCookie,
|
|
|
|
testdevice::DeviceIndex::DEVICE_0, enableInfoPrintout);
|
|
|
|
testCookie = new TestCookie(static_cast<address_t>(testdevice::DeviceIndex::DEVICE_1),
|
|
|
|
expectedMaxReplyLen);
|
|
|
|
new TestDevice(objects::TEST_DEVICE_HANDLER_1, objects::TEST_ECHO_COM_IF, testCookie,
|
|
|
|
testdevice::DeviceIndex::DEVICE_1, enableInfoPrintout);
|
|
|
|
|
|
|
|
new TestAssembly(objects::TEST_ASSEMBLY, objects::NO_OBJECT, objects::TEST_DEVICE_HANDLER_0,
|
|
|
|
objects::TEST_DEVICE_HANDLER_1);
|
2021-06-08 13:29:49 +02:00
|
|
|
|
|
|
|
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
|
|
|
|
|
2022-05-05 20:55:28 +02:00
|
|
|
/* Demo controller object */
|
2021-06-08 13:29:49 +02:00
|
|
|
#if OBSW_ADD_CONTROLLER_DEMO == 1
|
|
|
|
|
|
|
|
#if OBSW_CONTROLLER_PRINTOUT == 1
|
|
|
|
#endif
|
2022-05-05 20:55:28 +02:00
|
|
|
new TestController(objects::TEST_CONTROLLER, objects::NO_OBJECT);
|
2021-06-08 13:29:49 +02:00
|
|
|
|
|
|
|
#endif /* OBSW_ADD_CONTROLLER_DEMO == 1 */
|
2021-07-14 10:24:24 +02:00
|
|
|
|
|
|
|
#if OBSW_PERFORM_INTERNAL_UNITTEST == 1
|
2022-05-05 20:55:28 +02:00
|
|
|
InternalUnitTester::TestConfig testCfg;
|
|
|
|
testCfg.testArrayPrinter = false;
|
2021-08-10 11:22:52 +02:00
|
|
|
#if defined FSFW_OSAL_HOST
|
2022-05-05 20:55:28 +02:00
|
|
|
// Not implemented yet for hosted OSAL (requires C++20)
|
|
|
|
testCfg.testSemaphores = false;
|
2021-08-10 11:22:52 +02:00
|
|
|
#endif
|
2022-05-05 20:55:28 +02:00
|
|
|
InternalUnitTester unittester;
|
|
|
|
unittester.performTests(testCfg);
|
2021-07-14 10:24:24 +02:00
|
|
|
#endif /* OBSW_PERFORM_INTERNAL_UNITTEST == 1 */
|
2021-06-08 13:29:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Factory::setStaticFrameworkObjectIds() {
|
2022-05-05 20:55:28 +02:00
|
|
|
MonitoringReportContent<float>::timeStamperId = objects::TIME_STAMPER;
|
|
|
|
MonitoringReportContent<double>::timeStamperId = objects::TIME_STAMPER;
|
|
|
|
MonitoringReportContent<uint32_t>::timeStamperId = objects::TIME_STAMPER;
|
|
|
|
MonitoringReportContent<int32_t>::timeStamperId = objects::TIME_STAMPER;
|
|
|
|
MonitoringReportContent<int16_t>::timeStamperId = objects::TIME_STAMPER;
|
|
|
|
MonitoringReportContent<uint16_t>::timeStamperId = objects::TIME_STAMPER;
|
2021-06-08 13:29:49 +02:00
|
|
|
|
2022-05-05 20:55:28 +02:00
|
|
|
TmFunnel::downlinkDestination = objects::DOWNLINK_DESTINATION;
|
|
|
|
// No storage object for now.
|
|
|
|
TmFunnel::storageDestination = objects::NO_OBJECT;
|
2021-06-08 13:29:49 +02:00
|
|
|
|
2022-05-05 20:55:28 +02:00
|
|
|
PusServiceBase::packetSource = objects::PUS_DISTRIBUTOR;
|
|
|
|
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
2021-06-08 13:29:49 +02:00
|
|
|
|
2022-05-05 20:55:28 +02:00
|
|
|
CommandingServiceBase::defaultPacketSource = objects::PUS_DISTRIBUTOR;
|
|
|
|
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
2021-06-08 13:29:49 +02:00
|
|
|
|
2022-05-05 20:55:28 +02:00
|
|
|
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
|
2021-06-08 13:29:49 +02:00
|
|
|
|
2022-05-05 20:55:28 +02:00
|
|
|
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
2021-06-08 13:29:49 +02:00
|
|
|
}
|