fsfw/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp

54 lines
1.9 KiB
C++
Raw Normal View History

2020-12-30 22:56:46 +01:00
#include "FsfwFactory.h"
#include <OBSWConfig.h>
2020-10-20 17:38:41 +02:00
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h>
2021-07-06 18:17:24 +02:00
#include <fsfw/tmtcpacket/pus/tm/TmPacketStored.h>
2020-10-20 17:38:41 +02:00
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
2020-12-30 22:56:46 +01:00
#include <fsfw/internalError/InternalErrorReporter.h>
2020-10-20 17:38:41 +02:00
#include <cstdint>
/**
2020-12-30 22:56:46 +01:00
* This function builds all system objects required for using
* the FSFW. It is recommended to build all other required objects
* in a function with an identical prototype, call this function in it and
* then pass the function to the object manager so it builds all system
* objects on software startup.
2020-10-20 17:38:41 +02:00
*
2020-12-30 22:56:46 +01:00
* All system objects are registered in the internal object manager
* automatically. The objects should be added to tasks at a later stage, using
* their objects IDs.
2020-10-20 17:47:52 +02:00
*
2020-12-30 22:56:46 +01:00
* This function also sets static framework IDs.
2020-10-20 17:38:41 +02:00
*
2020-12-30 22:56:46 +01:00
* Framework should be created first before creating mission system objects.
2020-10-20 17:38:41 +02:00
* @ingroup init
*/
2020-12-30 22:56:46 +01:00
void Factory::produceFsfwObjects(void) {
2020-10-20 17:38:41 +02:00
setStaticFrameworkObjectIds();
new EventManager(objects::EVENT_MANAGER);
new HealthTable(objects::HEALTH_TABLE);
2020-11-09 21:21:56 +01:00
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
2020-10-20 17:38:41 +02:00
}
void Factory::setStaticFrameworkObjectIds() {
2020-11-09 21:21:56 +01:00
PusServiceBase::packetSource = objects::NO_OBJECT;
PusServiceBase::packetDestination = objects::NO_OBJECT;
2020-10-20 17:38:41 +02:00
2020-11-09 21:21:56 +01:00
CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT;
2020-10-20 17:38:41 +02:00
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
DeviceHandlerBase::rawDataReceiverId = objects::PUS_SERVICE_2_DEVICE_ACCESS;
DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT;
2020-11-09 21:21:56 +01:00
TmPacketStored::timeStamperId = objects::NO_OBJECT;
2020-10-20 17:38:41 +02:00
}