148 lines
5.5 KiB
C++
148 lines
5.5 KiB
C++
#include "GenericFactory.h"
|
|
|
|
#include <OBSWConfig.h>
|
|
#include <tmtc/apid.h>
|
|
#include <tmtc/pusIds.h>
|
|
#include <objects/systemObjectList.h>
|
|
|
|
#include <test/FsfwExampleTask.h>
|
|
#include <test/FsfwReaderTask.h>
|
|
|
|
#include <mission/assemblies/TestAssembly.h>
|
|
|
|
#include <mission/devices/TestCookie.h>
|
|
#include <mission/devices/TestDeviceHandler.h>
|
|
#include <mission/devices/TestEchoComIF.h>
|
|
#include <mission/utility/TmFunnel.h>
|
|
#include <mission/controller/TestController.h>
|
|
|
|
#include <fsfw/devicehandlers/CookieIF.h>
|
|
#include <fsfw/events/EventManager.h>
|
|
#include <fsfw/health/HealthTable.h>
|
|
#include <fsfw/internalError/InternalErrorReporter.h>
|
|
#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>
|
|
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
|
|
|
|
|
|
|
void ObjectFactory::produceGenericObjects() {
|
|
#if OBSW_ADD_CORE_COMPONENTS == 1
|
|
/* 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);
|
|
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
|
|
|
/* PUS stack */
|
|
#if OBSW_ADD_PUS_STACK == 1
|
|
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);
|
|
#endif /* OBSW_ADD_PUS_STACK == 1 */
|
|
|
|
#if OBSW_ADD_TASK_EXAMPLE == 1
|
|
/* Demo objects */
|
|
new FsfwExampleTask(objects::TEST_DUMMY_1);
|
|
new FsfwExampleTask(objects::TEST_DUMMY_2);
|
|
new FsfwExampleTask(objects::TEST_DUMMY_3);
|
|
|
|
|
|
#if OBSW_TASK_EXAMPLE_PRINTOUT == 1
|
|
bool enablePrintout = true;
|
|
#else
|
|
bool enablePrintout = false;
|
|
#endif
|
|
new FsfwReaderTask(objects::TEST_DUMMY_4, enablePrintout);
|
|
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
|
|
|
|
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
|
|
|
|
#if OBSW_DEVICE_HANDLER_PRINTOUT == 1
|
|
bool enableInfoPrintout = true;
|
|
#else
|
|
bool enableInfoPrintout = false;
|
|
#endif /* OBSW_DEVICE_HANDLER_PRINTOUT == 1 */
|
|
|
|
/* Demo device handler object */
|
|
size_t expectedMaxReplyLen = 64;
|
|
CookieIF* testCookie = new DummyCookie(
|
|
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 DummyCookie(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);
|
|
|
|
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
|
|
|
|
|
|
/* Demo controller object */
|
|
#if OBSW_ADD_CONTROLLER_DEMO == 1
|
|
|
|
#if OBSW_CONTROLLER_PRINTOUT == 1
|
|
#endif
|
|
new TestController(objects::TEST_CONTROLLER);
|
|
|
|
#endif /* OBSW_ADD_CONTROLLER_DEMO == 1 */
|
|
}
|
|
|
|
void Factory::setStaticFrameworkObjectIds() {
|
|
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;
|
|
|
|
TmFunnel::downlinkDestination = objects::DOWNLINK_DESTINATION;
|
|
// No storage object for now.
|
|
TmFunnel::storageDestination = objects::NO_OBJECT;
|
|
|
|
PusServiceBase::packetSource = objects::PUS_DISTRIBUTOR;
|
|
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
|
|
|
CommandingServiceBase::defaultPacketSource = objects::PUS_DISTRIBUTOR;
|
|
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
|
|
|
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
|
|
|
|
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
|
|
|
}
|
|
|
|
|